fix(spatial): ensure node does not have a spatial aspect
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use super::core::Node;
|
use super::core::Node;
|
||||||
use crate::core::client::Client;
|
use crate::core::client::Client;
|
||||||
use anyhow::{anyhow, bail, Result};
|
use anyhow::{anyhow, ensure, Result};
|
||||||
use glam::{Mat4, Quat, Vec3};
|
use glam::{Mat4, Quat, Vec3};
|
||||||
use libstardustxr::flex::flexbuffer_from_vector_arguments;
|
use libstardustxr::flex::flexbuffer_from_vector_arguments;
|
||||||
use libstardustxr::push_to_vec;
|
use libstardustxr::push_to_vec;
|
||||||
@@ -21,9 +21,10 @@ impl Spatial {
|
|||||||
parent: Option<Rc<Spatial>>,
|
parent: Option<Rc<Spatial>>,
|
||||||
transform: Mat4,
|
transform: Mat4,
|
||||||
) -> Result<Rc<Spatial>> {
|
) -> Result<Rc<Spatial>> {
|
||||||
if node.borrow_mut().spatial.is_none() {
|
ensure!(
|
||||||
bail!("Node already has a Spatial aspect!");
|
node.borrow_mut().spatial.is_none(),
|
||||||
}
|
"Node already has a Spatial aspect!"
|
||||||
|
);
|
||||||
let spatial = Spatial {
|
let spatial = Spatial {
|
||||||
// node: node.downgrade(),
|
// node: node.downgrade(),
|
||||||
parent: RefCell::new(parent),
|
parent: RefCell::new(parent),
|
||||||
|
|||||||
Reference in New Issue
Block a user