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

@@ -78,7 +78,7 @@ impl ClientState {
.iter()
.map(|(k, v)| {
(k.clone(), {
let node = Node::create(client, "/spatial/anchor", k, true)
let node = Node::create_parent_name(client, "/spatial/anchor", k, true)
.add_to_scenegraph()
.unwrap();
Spatial::add_to(&node, None, *v, false).unwrap();

11
src/core/idl_utils.rs Normal file
View File

@@ -0,0 +1,11 @@
#[macro_export]
macro_rules! create_interface {
($iface:ident, $aspect:ident, $path:expr) => {
pub fn create_interface(client: &Arc<Client>) -> Result<()> {
let node = Node::create_path(client, $path, false);
<$iface as $aspect>::add_node_members(&node);
node.add_to_scenegraph()?;
Ok(())
}
};
}

View File

@@ -3,6 +3,7 @@ pub mod client_state;
pub mod delta;
pub mod destroy_queue;
pub mod eventloop;
pub mod idl_utils;
pub mod node_collections;
pub mod registry;
pub mod resource;