Skip to content

Commit

Permalink
Update camera_view.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rewin123 committed Oct 13, 2024
1 parent bb5641a commit 061a880
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions crates/editor_ui/src/camera_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ fn set_camera_viewport(
mut local: Local<LastCamTabRect>,
mut ui_state: ResMut<CameraViewTab>,
primary_window: Query<&mut Window, With<PrimaryWindow>>,
mut cameras: Query<(&mut Camera, &mut GlobalTransform), Without<EditorCameraMarker>>,
mut cameras: Query<
(&mut Camera, &mut GlobalTransform, &mut Transform),
Without<EditorCameraMarker>,
>,
mut ctxs: EguiContexts,
images: Res<Assets<Image>>,
) {
Expand All @@ -325,10 +328,11 @@ fn set_camera_viewport(
ui_state.need_reinit_egui_tex = false;
}

let Ok([(mut real_cam, mut real_cam_transform), (watch_cam, camera_transform)]) =
cameras.get_many_mut([real_cam_entity, camera_entity])
let Ok(
[(mut real_cam, _, mut real_cam_local_transform), (watch_cam, camera_transform, _)],
) = cameras.get_many_mut([real_cam_entity, camera_entity])
else {
if let Ok((mut real_cam, _)) = cameras.get_mut(real_cam_entity) {
if let Ok((mut real_cam, _, _)) = cameras.get_mut(real_cam_entity) {
real_cam.is_active = false;
ui_state.camera_entity = None;
}
Expand All @@ -355,7 +359,7 @@ fn set_camera_viewport(
};
real_cam.target = RenderTarget::Image(target_handle.clone());

*real_cam_transform = *camera_transform;
*real_cam_local_transform = camera_transform.compute_transform();

local.0 = Some(viewport_rect);

Expand Down

0 comments on commit 061a880

Please sign in to comment.