diff --git a/src/nodes/items/camera.rs b/src/nodes/items/camera.rs index 93fcfa9..08b161d 100644 --- a/src/nodes/items/camera.rs +++ b/src/nodes/items/camera.rs @@ -74,22 +74,19 @@ pub struct CameraItem { #[allow(unused)] impl CameraItem { pub fn add_to(node: &Arc, proj_matrix: Mat4, px_size: Vector2) { - Item::add_to( - node, - &ITEM_TYPE_INFO_CAMERA, - ItemType::Camera(CameraItem { - space: node.get_aspect::().unwrap().clone(), - frame_info: Mutex::new(FrameInfo { - proj_matrix, - px_size, - }), - sk_tex: OnceCell::new(), - sk_mat: OnceCell::new(), - applied_to: Registry::new(), - apply_to: Registry::new(), + let item = Arc::new(CameraItem { + space: node.get_aspect::().unwrap().clone(), + frame_info: Mutex::new(FrameInfo { + proj_matrix, + px_size, }), - ); - node.add_aspect(CameraItemUi); + sk_tex: OnceCell::new(), + sk_mat: OnceCell::new(), + applied_to: Registry::new(), + apply_to: Registry::new(), + }); + Item::add_to(node, &ITEM_TYPE_INFO_CAMERA, ItemType::Camera(item.clone())); + node.add_aspect_raw(item); } fn frame_flex( @@ -171,6 +168,9 @@ impl CameraItem { } } } +impl Aspect for CameraItem { + impl_aspect_for_camera_item_aspect! {} +} impl CameraItemAspect for CameraItem {} pub struct CameraItemUi; diff --git a/src/nodes/items/mod.rs b/src/nodes/items/mod.rs index f6c81cf..83acd41 100644 --- a/src/nodes/items/mod.rs +++ b/src/nodes/items/mod.rs @@ -130,7 +130,7 @@ impl Drop for Item { } pub enum ItemType { - Camera(CameraItem), + Camera(Arc), Panel(Arc), } impl ItemType { diff --git a/src/nodes/items/panel.rs b/src/nodes/items/panel.rs index d7e8642..50b0205 100644 --- a/src/nodes/items/panel.rs +++ b/src/nodes/items/panel.rs @@ -122,6 +122,7 @@ impl PanelItem { &ITEM_TYPE_INFO_PANEL, ItemType::Panel(generic_panel_item), ); + node.add_aspect_raw(panel_item.clone()); (node, panel_item) }