From 5c637a13939a9a9797755700f4713b13520336d9 Mon Sep 17 00:00:00 2001 From: Andrew J Westlake Date: Sat, 18 Mar 2023 03:31:51 -0500 Subject: [PATCH 01/11] Patched up game_of_life example (wasn't working on windows) Co-authored-by: Andrew J Westlake --- assets/scripts/game_of_life.tl | 4 ++-- bevy_api_gen/src/main.rs | 2 +- bevy_script_api/src/generated.rs | 22 ++++++++++----------- languages/bevy_mod_scripting_lua/Cargo.toml | 2 +- makefile | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/assets/scripts/game_of_life.tl b/assets/scripts/game_of_life.tl index df188a1ef9..cae45df9b1 100644 --- a/assets/scripts/game_of_life.tl +++ b/assets/scripts/game_of_life.tl @@ -2,7 +2,7 @@ math.randomseed(os.time()) global function init() local LifeState = world:get_type_by_name("LifeState") - local life_state = world:get_component(entity,LifeState) as types.LuaLifeState + local life_state = world:get_component(entity,LifeState) as BevyAPI.LuaLifeState local cells = life_state.cells as {integer} -- set some cells alive @@ -16,7 +16,7 @@ global 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) as types.LuaLifeState + local life_state = world:get_component(entity,LifeState) as BevyAPI.LuaLifeState local cells = life_state.cells as {integer} -- note that here we do not make use of LuaProxyable and just go off pure reflection diff --git a/bevy_api_gen/src/main.rs b/bevy_api_gen/src/main.rs index 613d0e97c2..e47e1f508c 100644 --- a/bevy_api_gen/src/main.rs +++ b/bevy_api_gen/src/main.rs @@ -274,7 +274,7 @@ pub(crate) fn generate_macros( // get_doc_fragment writer.write_no_newline("fn get_doc_fragment(&self) -> Option"); writer.open_brace(); - writer.write_no_newline("Some(\"BevyAPI\",LuaDocFragment::new(|tw|"); + writer.write_no_newline("Some(LuaDocFragment::new(\"BevyAPI\", |tw|"); writer.open_brace(); writer.write_line("tw"); writer.write_line(".document_global_instance::().expect(\"Something went wrong documenting globals\")"); diff --git a/bevy_script_api/src/generated.rs b/bevy_script_api/src/generated.rs index bce20c5641..a89050fe75 100644 --- a/bevy_script_api/src/generated.rs +++ b/bevy_script_api/src/generated.rs @@ -10358,21 +10358,21 @@ impl APIProvider for LuaBevyAPIProvider { app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.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/languages/bevy_mod_scripting_lua/Cargo.toml b/languages/bevy_mod_scripting_lua/Cargo.toml index 1f6dca8908..4f2913edce 100644 --- a/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/languages/bevy_mod_scripting_lua/Cargo.toml @@ -42,7 +42,7 @@ path="src/lib.rs" [dependencies] bevy= { version = "0.9", default-features = false} bevy_mod_scripting_core = {path="../../bevy_mod_scripting_core", version = "0.2.2" } -tealr = { version = "=0.9.0-alpha4", features=["mlua_vendored","mlua_send"]} +tealr = { version = "=0.9.0-alpha4", git = "https://github.com/awestlake87/tealr", rev = "120ab2da424fbfaaf1a96f77c60072707399a4ba", features=["mlua_vendored","mlua_send"]} parking_lot = "0.12.1" serde_json = "1.0.81" serde = { version = "1", features = ["derive"] } diff --git a/makefile b/makefile index 2a30a233d8..f1af18f67b 100644 --- a/makefile +++ b/makefile @@ -75,5 +75,5 @@ make_json_files: rustup run nightly-2022-12-18 cargo rustdoc -p bevy_time@0.9.1 -- -Zunstable-options --output-format json && \ rustup run nightly-2022-12-18 cargo rustdoc -p bevy_utils@0.9.1 -- -Zunstable-options --output-format json && \ rustup run nightly-2022-12-18 cargo rustdoc -p bevy_reflect@0.9.1 -- -Zunstable-options --output-format json && \ - rustup run nightly-2022-12-18 cargo rustdoc -p glam -- -Zunstable-options --output-format json && \ + rustup run nightly-2022-12-18 cargo rustdoc -p glam@0.22.0 -- -Zunstable-options --output-format json && \ rustup run nightly-2022-12-18 cargo rustdoc -p bevy@0.9.1 -- -Zunstable-options --output-format json From 0f8e43a0b259bc3b6ca354f582a0fa7bb5d64838 Mon Sep 17 00:00:00 2001 From: Andrew J Westlake Date: Sat, 18 Mar 2023 03:56:05 -0500 Subject: [PATCH 02/11] Upgraded lua/teal to Bevy 0.10 Co-authored-by: Andrew J Westlake --- Cargo.toml | 6 +- bevy_event_priority/Cargo.toml | 2 +- bevy_mod_scripting_core/Cargo.toml | 2 +- bevy_mod_scripting_core/src/hosts.rs | 14 +- bevy_mod_scripting_core/src/lib.rs | 137 +++++++++++--- bevy_mod_scripting_core/src/systems.rs | 10 +- bevy_script_api/Cargo.toml | 2 +- bevy_script_api/src/common/bevy/mod.rs | 22 +-- bevy_script_api/src/generated.rs | 182 +------------------ bevy_script_api/src/sub_reflect.rs | 5 +- examples/lua/complex_game_loop.rs | 74 ++++---- examples/lua/coroutines.rs | 4 +- examples/lua/event_recipients.rs | 4 +- examples/lua/game_of_life.rs | 57 +++--- examples/rhai/game_of_life.rs | 9 +- languages/bevy_mod_scripting_lua/Cargo.toml | 2 +- languages/bevy_mod_scripting_lua/src/lib.rs | 59 ++++-- languages/bevy_mod_scripting_rhai/Cargo.toml | 2 +- languages/bevy_mod_scripting_rhai/src/lib.rs | 2 +- readme.md | 86 ++++----- 20 files changed, 303 insertions(+), 378 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3c3f6161bb..96a9c8d660 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,16 +59,16 @@ rhai = ["bevy_mod_scripting_rhai"] rhai_script_api=["bevy_script_api/rhai"] [dependencies] -bevy = { version = "0.9", default-features = false} +bevy = { version = "0.10", default-features = false} bevy_mod_scripting_core = { path = "bevy_mod_scripting_core", version = "0.2.2" } bevy_mod_scripting_lua = { path = "languages/bevy_mod_scripting_lua", version = "0.2.2", optional = true } bevy_mod_scripting_rhai = { path = "languages/bevy_mod_scripting_rhai", version = "0.2.2", optional = true} bevy_script_api = { path = "bevy_script_api", version = "0.2.2", optional = true } [dev-dependencies] -bevy = { version = "0.9"} +bevy = { version = "0.10"} rand = "0.8.5" -bevy_console = "0.5.0" +bevy_console = "0.6.0" rhai-rand = "0.1" [workspace] diff --git a/bevy_event_priority/Cargo.toml b/bevy_event_priority/Cargo.toml index 10b036021f..47b17c80bf 100644 --- a/bevy_event_priority/Cargo.toml +++ b/bevy_event_priority/Cargo.toml @@ -21,5 +21,5 @@ name = "bevy_event_priority" path = "src/lib.rs" [dependencies] -bevy = { version = "0.9", default-features = false} +bevy = { version = "0.10", default-features = false} diff --git a/bevy_mod_scripting_core/Cargo.toml b/bevy_mod_scripting_core/Cargo.toml index d0ba91fd1e..9bef30ea37 100644 --- a/bevy_mod_scripting_core/Cargo.toml +++ b/bevy_mod_scripting_core/Cargo.toml @@ -29,7 +29,7 @@ doc_always = [] [dependencies] -bevy = { version = "0.9", default-features = false, features=["bevy_asset","bevy_gltf","bevy_animation","bevy_core_pipeline","bevy_ui","bevy_pbr","bevy_render","bevy_text","bevy_sprite","filesystem_watcher"]} +bevy = { version = "0.10", default-features = false, features=["bevy_asset","bevy_gltf","bevy_animation","bevy_core_pipeline","bevy_ui","bevy_pbr","bevy_render","bevy_text","bevy_sprite","filesystem_watcher"]} bevy_event_priority = {path = "../bevy_event_priority", version = "0.2.2" } thiserror = "1.0.31" paste = "1.0.7" diff --git a/bevy_mod_scripting_core/src/hosts.rs b/bevy_mod_scripting_core/src/hosts.rs index 6baa073526..4e10dceb01 100644 --- a/bevy_mod_scripting_core/src/hosts.rs +++ b/bevy_mod_scripting_core/src/hosts.rs @@ -1,5 +1,10 @@ //! All script host related stuff -use bevy::{asset::Asset, prelude::*, reflect::FromReflect}; +use bevy::{ + asset::Asset, + ecs::schedule::{BaseSystemSet, FreeSystemSet}, + prelude::*, + reflect::FromReflect, +}; use std::{ collections::HashMap, iter::once, @@ -127,7 +132,12 @@ pub trait ScriptHost: Send + Sync + 'static + Default + Resource { /// Registers the script host with the given app, and attaches handlers to deal with spawning/removing scripts at the given stage. /// /// Ideally place after any game logic which can spawn/remove/modify scripts to avoid frame lag. (typically `CoreStage::Post_Update`) - fn register_with_app(app: &mut App, stage: impl StageLabel); + fn register_with_app_in_set(app: &mut App, set: impl FreeSystemSet + Clone); + + /// Registers the script host with the given app, and attaches handlers to deal with spawning/removing scripts at the given stage. + /// + /// Ideally place after any game logic which can spawn/remove/modify scripts to avoid frame lag. (typically `CoreStage::Post_Update`) + fn register_with_app_in_base_set(app: &mut App, set: impl BaseSystemSet + Clone); } /// Implementors can modify a script context in order to enable diff --git a/bevy_mod_scripting_core/src/lib.rs b/bevy_mod_scripting_core/src/lib.rs index 23eabf3ab0..a94ee75967 100644 --- a/bevy_mod_scripting_core/src/lib.rs +++ b/bevy_mod_scripting_core/src/lib.rs @@ -2,9 +2,12 @@ use crate::{ event::ScriptErrorEvent, hosts::{APIProvider, APIProviders, ScriptHost}, }; -use bevy::{ecs::schedule::IntoRunCriteria, prelude::*}; +use bevy::{ + ecs::schedule::{BaseSystemSet, FreeSystemSet}, + prelude::*, +}; use event::ScriptLoaded; -use systems::{script_event_handler, ScriptSystemLabel}; +use systems::script_event_handler; pub mod asset; pub mod docs; @@ -24,6 +27,7 @@ pub mod prelude { APIProvider, APIProviders, Recipients, Script, ScriptCollection, ScriptContexts, ScriptData, ScriptHost, }, + crate::systems::script_event_handler, crate::{ AddScriptApiProvider, AddScriptHost, AddScriptHostHandler, GenDocumentation, ScriptingPlugin, @@ -74,16 +78,37 @@ pub trait AddScriptHost { /// the given stage will contain systems handling script loading,re-loading, removal etc. /// This stage will also send events related to the script lifecycle. /// Any systems which need to run the same frame a script is loaded must run after this stage. - fn add_script_host(&mut self, stage: S) -> &mut Self; + fn add_script_host_to_set( + &mut self, + set: S, + ) -> &mut Self; + /// registers the given script host with your app, + /// the given stage will contain systems handling script loading,re-loading, removal etc. + /// This stage will also send events related to the script lifecycle. + /// Any systems which need to run the same frame a script is loaded must run after this stage. + fn add_script_host_to_base_set( + &mut self, + set: S, + ) -> &mut Self; } impl AddScriptHost for App { - fn add_script_host(&mut self, stage: S) -> &mut Self + fn add_script_host_to_set(&mut self, set: S) -> &mut Self where T: ScriptHost, - S: StageLabel, + S: FreeSystemSet + Clone, { - T::register_with_app(self, stage); + T::register_with_app_in_set(self, set); + self.init_resource::(); + self.add_event::(); + self + } + fn add_script_host_to_base_set(&mut self, set: S) -> &mut Self + where + T: ScriptHost, + S: BaseSystemSet + Clone, + { + T::register_with_app_in_base_set(self, set); self.init_resource::(); self.add_event::(); self @@ -146,58 +171,110 @@ pub trait AddScriptHostHandler { /// /// The *frequency* of running these events, is controlled by your systems, if the event is not emitted, it cannot not handled. /// Of course there is nothing stopping your from emitting a single event type at varying priorities. - fn add_script_handler_stage( + fn add_script_handler_to_set( + &mut self, + set: S, + ) -> &mut Self; + fn add_script_handler_to_base_set< + T: ScriptHost, + S: BaseSystemSet, + const MAX: u32, + const MIN: u32, + >( + &mut self, + set: S, + ) -> &mut Self; + + /// Like `add_script_handler_stage` but with additional run criteria + fn add_script_handler_to_set_with_criteria< + T: ScriptHost, + S: FreeSystemSet, + M, + C: Condition, + const MAX: u32, + const MIN: u32, + >( &mut self, - stage: S, + set: S, + condition: C, ) -> &mut Self; /// Like `add_script_handler_stage` but with additional run criteria - fn add_script_handler_stage_with_criteria< + fn add_script_handler_to_base_set_with_criteria< T: ScriptHost, - S: StageLabel, + S: BaseSystemSet, M, - C: IntoRunCriteria, + C: Condition, const MAX: u32, const MIN: u32, >( &mut self, - stage: S, - criteria: C, + set: S, + condition: C, ) -> &mut Self; } impl AddScriptHostHandler for App { - fn add_script_handler_stage( + fn add_script_handler_to_set< + T: ScriptHost, + S: FreeSystemSet, + const MAX: u32, + const MIN: u32, + >( &mut self, - stage: S, + set: S, ) -> &mut Self { - self.add_system_to_stage( - stage, + self.add_system(script_event_handler::.in_set(set)); + self + } + fn add_script_handler_to_base_set< + T: ScriptHost, + S: BaseSystemSet, + const MAX: u32, + const MIN: u32, + >( + &mut self, + set: S, + ) -> &mut Self { + self.add_system(script_event_handler::.in_base_set(set)); + self + } + + fn add_script_handler_to_set_with_criteria< + T: ScriptHost, + S: FreeSystemSet, + M, + C: Condition, + const MAX: u32, + const MIN: u32, + >( + &mut self, + set: S, + condition: C, + ) -> &mut Self { + self.add_system( script_event_handler:: - .label(ScriptSystemLabel::EventHandling) - .at_end(), + .in_set(set) + .run_if(condition), ); self } - - fn add_script_handler_stage_with_criteria< + fn add_script_handler_to_base_set_with_criteria< T: ScriptHost, - S: StageLabel, + S: BaseSystemSet, M, - C: IntoRunCriteria, + C: Condition, const MAX: u32, const MIN: u32, >( &mut self, - stage: S, - criteria: C, + set: S, + condition: C, ) -> &mut Self { - self.add_system_to_stage( - stage, + self.add_system( script_event_handler:: - .label(ScriptSystemLabel::EventHandling) - .at_end() - .with_run_criteria(criteria), + .in_base_set(set) + .run_if(condition), ); self } diff --git a/bevy_mod_scripting_core/src/systems.rs b/bevy_mod_scripting_core/src/systems.rs index cdc8b83967..c8a9269e9c 100644 --- a/bevy_mod_scripting_core/src/systems.rs +++ b/bevy_mod_scripting_core/src/systems.rs @@ -4,7 +4,7 @@ use bevy::{ ecs::system::SystemState, prelude::{ debug, AssetEvent, Assets, ChangeTrackers, Changed, Entity, EventReader, EventWriter, - FromWorld, Query, RemovedComponents, Res, ResMut, Resource, SystemLabel, World, + FromWorld, Query, RemovedComponents, Res, ResMut, Resource, SystemSet, World, }, }; use bevy_event_priority::PriorityEventReader; @@ -16,8 +16,8 @@ use crate::{ }; /// Labels for scripting related systems -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SystemLabel)] -pub enum ScriptSystemLabel { +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SystemSet)] +pub enum ScriptSystemSet { /// event handling systems are always marked with this label EventHandling, } @@ -98,7 +98,7 @@ pub fn script_add_synchronizer( /// Handles the removal of script components and their contexts pub fn script_remove_synchronizer( - query: RemovedComponents>, + mut query: RemovedComponents>, mut contexts: ResMut>, ) { query.iter().for_each(|v| { @@ -210,7 +210,7 @@ pub fn script_event_handler(world pub struct CachedScriptState { pub event_state: SystemState<( PriorityEventReader<'static, 'static, H::ScriptEvent>, - EventWriter<'static, 'static, ScriptErrorEvent>, + EventWriter<'static, ScriptErrorEvent>, EventReader<'static, 'static, ScriptLoaded>, )>, } diff --git a/bevy_script_api/Cargo.toml b/bevy_script_api/Cargo.toml index 57132a6d8d..e3c8f321d2 100644 --- a/bevy_script_api/Cargo.toml +++ b/bevy_script_api/Cargo.toml @@ -26,7 +26,7 @@ lua = ["bevy_mod_scripting_lua","bevy_mod_scripting_lua_derive"] rhai = ["bevy_mod_scripting_rhai"] [dependencies] -bevy = { version = "0.9", default-features = false, features=["bevy_asset","bevy_gltf","bevy_animation","bevy_core_pipeline","bevy_ui","bevy_pbr","bevy_render","bevy_text","bevy_sprite","filesystem_watcher"]} +bevy = { version = "0.10", default-features = false, features=["bevy_asset","bevy_gltf","bevy_animation","bevy_core_pipeline","bevy_ui","bevy_pbr","bevy_render","bevy_text","bevy_sprite","filesystem_watcher"]} bevy_mod_scripting_derive = { path="../bevy_mod_scripting_derive", version = "0.2.2" } bevy_mod_scripting_core = { path="../bevy_mod_scripting_core", version = "0.2.2" } parking_lot="0.12.1" diff --git a/bevy_script_api/src/common/bevy/mod.rs b/bevy_script_api/src/common/bevy/mod.rs index f4fda89ec5..93a97b6ed8 100644 --- a/bevy_script_api/src/common/bevy/mod.rs +++ b/bevy_script_api/src/common/bevy/mod.rs @@ -177,19 +177,19 @@ impl ScriptWorld { // 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 w, entity, &DynamicStruct::default()), - bevy::reflect::TypeInfo::TupleStruct(_) => component_data.insert(&mut w, entity, &DynamicTupleStruct::default()), - bevy::reflect::TypeInfo::Tuple(_) => component_data.insert(&mut w, entity, &DynamicTuple::default()), - bevy::reflect::TypeInfo::List(_) => component_data.insert(&mut w, entity, &DynamicList::default()), - bevy::reflect::TypeInfo::Array(_) => component_data.insert(&mut w, entity, &DynamicArray::new(Box::new([]))), - bevy::reflect::TypeInfo::Map(_) => component_data.insert(&mut w, entity, &DynamicMap::default()), + bevy::reflect::TypeInfo::Struct(_) => component_data.insert(&mut w.entity_mut(entity), &DynamicStruct::default()), + bevy::reflect::TypeInfo::TupleStruct(_) => component_data.insert(&mut w.entity_mut(entity), &DynamicTupleStruct::default()), + bevy::reflect::TypeInfo::Tuple(_) => component_data.insert(&mut w.entity_mut(entity), &DynamicTuple::default()), + bevy::reflect::TypeInfo::List(_) => component_data.insert(&mut w.entity_mut(entity), &DynamicList::default()), + bevy::reflect::TypeInfo::Array(_) => component_data.insert(&mut w.entity_mut(entity), &DynamicArray::new(Box::new([]))), + bevy::reflect::TypeInfo::Map(_) => component_data.insert(&mut w.entity_mut(entity), &DynamicMap::default()), bevy::reflect::TypeInfo::Value(_) | - bevy::reflect::TypeInfo::Dynamic(_) => component_data.insert(&mut w, entity, + bevy::reflect::TypeInfo::Dynamic(_) => component_data.insert(&mut w.entity_mut(entity), 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()), - bevy::reflect::TypeInfo::Enum(_) => component_data.insert(&mut w, entity, &DynamicEnum::default()) + bevy::reflect::TypeInfo::Enum(_) => component_data.insert(&mut w.entity_mut(entity), &DynamicEnum::default()) }; Ok(ScriptRef::new_component_ref( @@ -210,7 +210,7 @@ impl ScriptWorld { ScriptError::Other(format!("Not a component {}", comp_type.short_name())) })?; - Ok(component_data.reflect(&w, entity).map(|_component| { + Ok(component_data.reflect(w.entity(entity)).map(|_component| { ScriptRef::new_component_ref(component_data.clone(), entity, self.clone().into()) })) } @@ -225,7 +225,7 @@ impl ScriptWorld { ScriptError::Other(format!("Not a component {}", comp_type.short_name())) })?; - Ok(component_data.reflect(&w, entity).is_some()) + Ok(component_data.reflect(w.entity(entity)).is_some()) } pub fn remove_component( @@ -237,7 +237,7 @@ impl ScriptWorld { let component_data = comp_type.data::().ok_or_else(|| { ScriptError::Other(format!("Not a component {}", comp_type.short_name())) })?; - component_data.remove(&mut w, entity); + component_data.remove(&mut w.entity_mut(entity)); Ok(()) } diff --git a/bevy_script_api/src/generated.rs b/bevy_script_api/src/generated.rs index a89050fe75..d15dc418d5 100644 --- a/bevy_script_api/src/generated.rs +++ b/bevy_script_api/src/generated.rs @@ -76,7 +76,6 @@ use bevy::render::camera::Projection; use bevy::render::camera::RenderTarget; use bevy::render::camera::ScalingMode; use bevy::render::camera::Viewport; -use bevy::render::camera::WindowOrigin; use bevy::render::color::Color; use bevy::render::mesh::skinning::SkinnedMesh; use bevy::render::primitives::Aabb; @@ -91,20 +90,16 @@ use bevy::sprite::Anchor; use bevy::sprite::Mesh2dHandle; use bevy::sprite::Sprite; use bevy::sprite::TextureAtlasSprite; -use bevy::text::HorizontalAlign; use bevy::text::Text; use bevy::text::Text2dBounds; -use bevy::text::Text2dSize; use bevy::text::TextAlignment; use bevy::text::TextSection; use bevy::text::TextStyle; -use bevy::text::VerticalAlign; use bevy::time::Stopwatch; use bevy::time::Timer; use bevy::transform::components::GlobalTransform; use bevy::transform::components::Transform; use bevy::ui::widget::Button; -use bevy::ui::widget::ImageMode; use bevy::ui::AlignContent; use bevy::ui::AlignItems; use bevy::ui::AlignSelf; @@ -606,28 +601,6 @@ impl_script_newtype! { { } } -impl_script_newtype! { - #[languages(on_feature(lua))] - ///Describes how to resize the Image node - bevy_ui::widget::ImageMode : - Clone + - Debug + - Methods - ( - ) - + Fields - ( - ) - + BinOps - ( - ) - + UnaryOps - ( - ) - lua impl - { - } -} impl_script_newtype! { #[languages(on_feature(lua))] ///Whether to use a Flexbox layout model. @@ -824,29 +797,6 @@ impl_script_newtype! { { } } -impl_script_newtype! { - #[languages(on_feature(lua))] - ///The calculated size of text drawn in 2D scene. - bevy_text::Text2dSize : - Clone + - Debug + - Methods - ( - ) - + Fields - ( - size: Wrapped(Vec2), - ) - + BinOps - ( - ) - + UnaryOps - ( - ) - lua impl - { - } -} impl_script_newtype! { #[languages(on_feature(lua))] bevy_text::Text : @@ -854,37 +804,10 @@ impl_script_newtype! { Debug + Methods ( - ///Returns this [`Text`] with a new [`TextAlignment`]. - with_alignment(self:Wrapped(TextAlignment)) -> self, - ) + Fields ( sections: Raw(ReflectedValue), - alignment: Wrapped(TextAlignment), - ) - + BinOps - ( - ) - + UnaryOps - ( - ) - lua impl - { - } -} -impl_script_newtype! { - #[languages(on_feature(lua))] - bevy_text::TextAlignment : - Clone + - Debug + - Methods - ( - ) - + Fields - ( - vertical: Wrapped(VerticalAlign), - horizontal: Wrapped(HorizontalAlign), ) + BinOps ( @@ -946,51 +869,6 @@ impl_script_newtype! { { } } -impl_script_newtype! { - #[languages(on_feature(lua))] - ///Describes horizontal alignment preference for positioning & bounds. - bevy_text::HorizontalAlign : - Clone + - Debug + - Methods - ( - ) - + Fields - ( - ) - + BinOps - ( - ) - + UnaryOps - ( - ) - lua impl - { - } -} -impl_script_newtype! { - #[languages(on_feature(lua))] - ///Describes vertical alignment preference for positioning & bounds. Currently a placeholder - ///for future functionality. - bevy_text::VerticalAlign : - Clone + - Debug + - Methods - ( - ) - + Fields - ( - ) - + BinOps - ( - ) - + UnaryOps - ( - ) - lua impl - { - } -} impl_script_newtype! { #[languages(on_feature(lua))] ///A Stopwatch is a struct that track elapsed time when started. @@ -2406,16 +2284,9 @@ impl_script_newtype! { Debug + Methods ( - ///Toggle the visibility. - toggle(&mut self:), - ) + Fields ( - /// Indicates whether this entity is visible. Hidden values will propagate down the entity hierarchy. - /// If this entity is hidden, all of its descendants will be hidden as well. See [`Children`] and [`Parent`] for - /// hierarchy info. - is_visible: Raw(bool), ) + BinOps ( @@ -2557,27 +2428,6 @@ impl_script_newtype! { { } } -impl_script_newtype! { - #[languages(on_feature(lua))] - bevy_render::camera::WindowOrigin : - Clone + - Debug + - Methods - ( - ) - + Fields - ( - ) - + BinOps - ( - ) - + UnaryOps - ( - ) - lua impl - { - } -} impl_script_newtype! { #[languages(on_feature(lua))] bevy_render::color::Color : @@ -2789,10 +2639,7 @@ impl_script_newtype! { Debug + Methods ( - from_view_projection(Wrapped(&Mat4),Wrapped(&Vec3),Wrapped(&Vec3),Raw(f32)) -> self, - - intersects_obb(&self:Wrapped(&Aabb),Wrapped(&Mat4),Raw(bool)) -> Raw(bool), - + intersects_obb(&self:Wrapped(&Aabb),Wrapped(&Mat4),Raw(bool), Raw(bool)) -> Raw(bool), ) + Fields ( @@ -2826,14 +2673,6 @@ impl_script_newtype! { ) + Fields ( - /// The number of samples to run for Multi-Sample Anti-Aliasing. Higher numbers result in - /// smoother edges. - /// Defaults to 4. - /// - /// Note that WGPU currently only supports 1 or 4 samples. - /// Ultimately we plan on supporting whatever is natively supported on a given device. - /// Check out this issue for more info: - samples: Raw(u32), ) + BinOps ( @@ -2870,8 +2709,6 @@ impl_script_newtype! { ( /// If set, this camera will render to the given [`Viewport`] rectangle within the configured [`RenderTarget`]. viewport: Raw(ReflectedValue), - /// Cameras with a lower priority will be rendered before cameras with a higher priority. - priority: Raw(isize), /// If this is set to `true`, this camera will be rendered to its specified [`RenderTarget`]. If `false`, this /// camera will not be rendered. is_active: Raw(bool), @@ -2994,14 +2831,9 @@ impl_script_newtype! { ) + Fields ( - left: Raw(f32), - right: Raw(f32), - bottom: Raw(f32), - top: Raw(f32), near: Raw(f32), #[rename("_far")] far: Raw(f32), - window_origin: Wrapped(WindowOrigin), scaling_mode: Wrapped(ScalingMode), scale: Raw(f32), ) @@ -10060,7 +9892,6 @@ impl APIProvider for LuaBevyAPIProvider { .process_type::() .process_type::() .process_type::() - .process_type::() .process_type::() .process_type::() .process_type::() @@ -10069,15 +9900,11 @@ impl APIProvider for LuaBevyAPIProvider { .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::() @@ -10115,7 +9942,6 @@ impl APIProvider for LuaBevyAPIProvider { .process_type::() .process_type::() .process_type::() - .process_type::() .process_type::() .process_type::>() .process_type::() @@ -10262,7 +10088,6 @@ impl APIProvider for LuaBevyAPIProvider { app.register_foreign_lua_type::