feat(spatial): setTransform local signal
This commit is contained in:
@@ -3,10 +3,11 @@ use crate::nodes::spatial::Spatial;
|
||||
use anyhow::Result;
|
||||
use libstardustxr::scenegraph;
|
||||
use libstardustxr::scenegraph::ScenegraphError;
|
||||
use rccell::RcCell;
|
||||
use rccell::{RcCell, WeakCell};
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub struct Scenegraph<'a> {
|
||||
client: WeakCell<Client<'a>>,
|
||||
pub spatial_nodes: HashMap<String, RcCell<Spatial<'a>>>,
|
||||
}
|
||||
|
||||
@@ -15,6 +16,7 @@ impl<'a> Scenegraph<'a> {
|
||||
// root: Spatial::new(Some(client), "/", Default::default()),
|
||||
// hmd: Spatial::new(Some(client), "/hmd", Default::default()),
|
||||
Scenegraph {
|
||||
client: client.downgrade(),
|
||||
spatial_nodes: HashMap::new(),
|
||||
}
|
||||
}
|
||||
@@ -23,6 +25,7 @@ impl<'a> Scenegraph<'a> {
|
||||
impl<'a> Default for Scenegraph<'a> {
|
||||
fn default() -> Self {
|
||||
Scenegraph {
|
||||
client: WeakCell::new(),
|
||||
spatial_nodes: HashMap::new(),
|
||||
}
|
||||
}
|
||||
@@ -35,7 +38,7 @@ impl<'a> scenegraph::Scenegraph for Scenegraph<'a> {
|
||||
.ok_or(ScenegraphError::NodeNotFound)?
|
||||
.borrow()
|
||||
.node
|
||||
.send_local_signal(method, data)
|
||||
.send_local_signal(self.client.upgrade().unwrap(), method, data)
|
||||
.map_err(|_| ScenegraphError::MethodNotFound)
|
||||
}
|
||||
fn execute_method(
|
||||
@@ -49,7 +52,7 @@ impl<'a> scenegraph::Scenegraph for Scenegraph<'a> {
|
||||
.ok_or(ScenegraphError::NodeNotFound)?
|
||||
.borrow()
|
||||
.node
|
||||
.execute_local_method(method, data)
|
||||
.execute_local_method(self.client.upgrade().unwrap(), method, data)
|
||||
.map_err(|_| ScenegraphError::MethodNotFound)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user