refactor(idl): create_inteface macro

This commit is contained in:
Nova
2024-02-04 09:55:39 -05:00
parent f8fab6bf5a
commit ed28914f86
31 changed files with 73 additions and 50 deletions

View File

@@ -28,7 +28,8 @@ pub struct EyePointer {
}
impl EyePointer {
pub fn new() -> Result<Self> {
let node = Node::create(&INTERNAL_CLIENT, "", &nanoid!(), false).add_to_scenegraph()?;
let node = Node::create_parent_name(&INTERNAL_CLIENT, "", &nanoid!(), false)
.add_to_scenegraph()?;
let spatial = Spatial::add_to(&node, None, Mat4::IDENTITY, false).unwrap();
let pointer =
InputMethod::add_to(&node, InputType::Pointer(Pointer::default()), None).unwrap();

View File

@@ -56,7 +56,8 @@ pub struct MousePointer {
}
impl MousePointer {
pub fn new() -> Result<Self> {
let node = Node::create(&INTERNAL_CLIENT, "", &nanoid!(), false).add_to_scenegraph()?;
let node = Node::create_parent_name(&INTERNAL_CLIENT, "", &nanoid!(), false)
.add_to_scenegraph()?;
let spatial = Spatial::add_to(&node, None, Mat4::IDENTITY, false).unwrap();
let pointer =
InputMethod::add_to(&node, InputType::Pointer(Pointer::default()), None).unwrap();

View File

@@ -32,7 +32,7 @@ pub struct SkController {
}
impl SkController {
pub fn new(sk: &impl StereoKitMultiThread, handed: Handed) -> Result<Self> {
let _node = Node::create(
let _node = Node::create_parent_name(
&INTERNAL_CLIENT,
"",
if handed == Handed::Left {

View File

@@ -40,7 +40,8 @@ pub struct SkHand {
}
impl SkHand {
pub fn new(handed: Handed) -> Result<Self> {
let _node = Node::create(&INTERNAL_CLIENT, "", &nanoid!(), false).add_to_scenegraph()?;
let _node = Node::create_parent_name(&INTERNAL_CLIENT, "", &nanoid!(), false)
.add_to_scenegraph()?;
Spatial::add_to(&_node, None, Mat4::IDENTITY, false)?;
let hand = InputType::Hand(Box::new(Hand {
base: FlatHand {

View File

@@ -39,7 +39,8 @@ pub struct PlaySpace {
}
impl PlaySpace {
pub fn new() -> Result<Self> {
let node = Node::create(&INTERNAL_CLIENT, "", &nanoid!(), false).add_to_scenegraph()?;
let node = Node::create_parent_name(&INTERNAL_CLIENT, "", &nanoid!(), false)
.add_to_scenegraph()?;
let spatial = Spatial::add_to(&node, None, Mat4::IDENTITY, false)?;
let field = BoxField::add_to(&node, [0.0; 3].into())?;
@@ -60,7 +61,9 @@ impl PlaySpace {
pose.orientation,
pose.position,
));
let Field::Box(box_field) = self.field.as_ref() else {return};
let Field::Box(box_field) = self.field.as_ref() else {
return;
};
box_field.set_size(
[
sk.world_get_bounds_size().x,