Scene in memory persistance and debug tools (#24)

![image](https://github.com/storytold/storyteller-bevy/assets/10954133/10eb5c33-2154-4e9d-95ce-1d8e8b822d22)
Debug tools example

---------

Co-authored-by: Danny McGee <dannymcgee@gmail.com>
This commit is contained in:
rewin
2024-02-02 22:51:18 +03:00
committed by GitHub
parent 2df86eaf58
commit 8f0b916eaa
15 changed files with 415 additions and 388 deletions
+18 -1
View File
@@ -3,13 +3,14 @@ use bevy::{
prelude::*,
render::view::RenderLayers,
};
use space_editor::space_editor_ui::NotShowCamera;
use crate::MainCamera;
use super::GIZMO_RENDER_LAYER;
#[derive(Component)]
pub(super) struct GizmoCamera;
pub struct GizmoCamera;
pub(super) fn spawn_gizmo_camera(
mut cmd: Commands,
@@ -35,6 +36,22 @@ pub(super) fn spawn_gizmo_camera(
},
RenderLayers::layer(GIZMO_RENDER_LAYER),
Fxaa::default(),
NotShowCamera,
));
});
}
pub(super) fn sync_gizmo_and_main_cameras(
q_main_camera: Query<&Camera, (With<MainCamera>, Without<GizmoCamera>)>,
mut q_gizmo_camera: Query<&mut Camera, (With<GizmoCamera>, Without<MainCamera>)>,
) {
let Ok(main_cam) = q_main_camera.get_single() else {
return;
};
let Ok(mut gizmo_cam) = q_gizmo_camera.get_single_mut() else {
return;
};
gizmo_cam.viewport = main_cam.viewport.clone();
}