mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-21 07:55:55 +00:00
Scene in memory persistance and debug tools (#24)
 Debug tools example --------- Co-authored-by: Danny McGee <dannymcgee@gmail.com>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user