Skip to content

Commit

Permalink
add filter for os string temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
makspll committed Mar 28, 2024
1 parent 2997bbb commit 8346ec3
Show file tree
Hide file tree
Showing 8 changed files with 850 additions and 1,265 deletions.
1 change: 1 addition & 0 deletions crates/bevy_api_gen/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ fn default_ignored_types() -> String {
"bevy_reflect::DynamicTuple",
"bevy_reflect::DynamicTupleStruct",
"bevy_reflect::DynamicEnum",
"bevy_reflect::OsString", // TODO: once macros allow Vecs for primitives as args remove this from ignored types
]
.join(",")
}
Expand Down
24 changes: 12 additions & 12 deletions crates/bevy_script_api/src/providers/bevy_ecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ functions[r#"
"#,
r#"
#[lua(as_trait = "std::cmp::PartialEq", kind = "Function", composite = "eq")]
fn eq(&self, #[proxy] other: &component::ComponentId) -> bool;
#[lua(as_trait = "std::cmp::Eq", kind = "Method")]
fn assert_receiver_is_total_eq(&self) -> ();
"#,
r#"
Expand All @@ -85,8 +85,8 @@ functions[r#"
"#,
r#"
#[lua(as_trait = "std::cmp::Eq", kind = "Method")]
fn assert_receiver_is_total_eq(&self) -> ();
#[lua(as_trait = "std::cmp::PartialEq", kind = "Function", composite = "eq")]
fn eq(&self, #[proxy] other: &component::ComponentId) -> bool;
"#]
)]
Expand Down Expand Up @@ -148,8 +148,8 @@ functions[r#"
"#,
r#"
#[lua(as_trait = "std::cmp::PartialEq", kind = "Function", composite = "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#"
Expand All @@ -160,8 +160,8 @@ functions[r#"
"#,
r#"
#[lua(as_trait = "std::cmp::Eq", kind = "Method")]
fn assert_receiver_is_total_eq(&self) -> ();
#[lua(as_trait = "std::cmp::PartialEq", kind = "Function", composite = "eq")]
fn eq(&self, #[proxy] other: &component::Tick) -> bool;
"#]
)]
Expand Down Expand Up @@ -442,14 +442,14 @@ functions[r#"
"#,
r#"
#[lua(as_trait = "std::cmp::PartialEq", kind = "Function", composite = "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#"
#[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
fn clone(&self) -> bevy::ecs::entity::Entity;
#[lua(as_trait = "std::cmp::PartialEq", kind = "Function", composite = "eq")]
fn eq(&self, #[proxy] other: &entity::Entity) -> bool;
"#]
)]
Expand Down
82 changes: 19 additions & 63 deletions crates/bevy_script_api/src/providers/bevy_hierarchy.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
#![allow(clippy::all, unused_imports, deprecated, dead_code)]
// @generated by cargo bevy-api-gen generate, modify the templates not this file



use super::bevy_ecs::*;



use super::bevy_reflect::*;



use super::bevy_core::*;




extern crate self as bevy_script_api;
use crate::lua::RegisterForeignLuaType;






/// Contains references to the child entities of this entity.
/// Each child must contain a [`Parent`] component that points back to this entity.
Expand All @@ -44,7 +30,6 @@ use crate::lua::RegisterForeignLuaType;
/// [`BuildChildren::with_children`]: crate::child_builder::BuildChildren::with_children

#[derive(bevy_mod_scripting_lua_derive::LuaProxy)]
#[proxy(
derive(debug,),
Expand All @@ -58,17 +43,8 @@ functions[r#"
"#]
)]

pub struct Children();


pub struct Children(





);


/// Holds a reference to the parent entity of this entity.
/// This component should only be present on entities that actually have a parent entity.
Expand All @@ -89,7 +65,6 @@ pub struct Children(
/// [`BuildChildren::with_children`]: crate::child_builder::BuildChildren::with_children

#[derive(bevy_mod_scripting_lua_derive::LuaProxy)]
#[proxy(
derive(debug,),
Expand All @@ -115,22 +90,10 @@ functions[r#"
"#]
)]



pub struct Parent(





);



pub struct Parent();

crate::impl_tealr_generic!(pub(crate) struct T);


#[derive(Default)]
pub(crate) struct Globals;

Expand All @@ -139,23 +102,21 @@ impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals {
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<bevy_mod_scripting_lua::tealr::mlu::mlua::Lua>;
type ScriptContext = std::sync::Mutex<bevy_mod_scripting_lua::tealr::mlu::mlua::Lua>;
type DocTarget = bevy_mod_scripting_lua::docs::LuaDocFragment;
type APITarget = std::sync::Mutex<bevy_mod_scripting_lua::tealr::mlu::mlua::Lua>;
type ScriptContext = std::sync::Mutex<bevy_mod_scripting_lua::tealr::mlu::mlua::Lua>;
type DocTarget = bevy_mod_scripting_lua::docs::LuaDocFragment;

fn attach_api(&mut self, ctx: &mut Self::APITarget) -> Result<(), bevy_mod_scripting_core::error::ScriptError> {
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");
Expand All @@ -164,17 +125,14 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyHierarchyAPIProvider {
}

fn get_doc_fragment(&self) -> Option<Self::DocTarget> {
Some(bevy_mod_scripting_lua::docs::LuaDocFragment::new("BevyHierarchyAPI", |tw| {
tw
.document_global_instance::<Globals>().expect("Something went wrong documenting globals")

.process_type::<LuaChildren>()


.process_type::<LuaParent>()


}
Some(bevy_mod_scripting_lua::docs::LuaDocFragment::new(
"BevyHierarchyAPI",
|tw| {
tw.document_global_instance::<Globals>()
.expect("Something went wrong documenting globals")
.process_type::<LuaChildren>()
.process_type::<LuaParent>()
},
))
}

Expand All @@ -196,10 +154,8 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyHierarchyAPIProvider {
}

fn register_with_app(&self, app: &mut bevy::app::App) {

app.register_foreign_lua_type::<bevy::hierarchy::prelude::Children>();

app.register_foreign_lua_type::<bevy::hierarchy::prelude::Parent>();

}
}
}
Loading

0 comments on commit 8346ec3

Please sign in to comment.