Skip to content

Commit ee88b93

Browse files
ActuallyHappeningjakobhellermann
authored andcommitted
fmt: Fixed formatting
and added documentation here and there
1 parent bcdff1a commit ee88b93

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

crates/bevy_editor_pls/src/controls.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ pub enum Action {
136136
PauseUnpauseTime,
137137
FocusSelected,
138138

139+
// maybe investigate [GizmoOptions].hotkeys
140+
// https://docs.rs/transform-gizmo-bevy/latest/transform_gizmo_bevy/struct.GizmoHotkeys.html
139141
#[cfg(feature = "default_windows")]
140142
SetGizmoModeTranslate,
141143
#[cfg(feature = "default_windows")]

crates/bevy_editor_pls_default_windows/src/gizmos.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
use bevy::{
22
ecs::{query::QueryFilter, system::RunSystemOnce},
33
prelude::*,
4-
render::{camera::CameraProjection, view::RenderLayers},
4+
render::view::RenderLayers,
55
};
66

77
use bevy_editor_pls_core::editor_window::{EditorWindow, EditorWindowContext};
8-
use bevy_inspector_egui::{bevy_inspector::hierarchy::SelectedEntities, egui};
9-
use transform_gizmo_bevy::{EnumSet, GizmoMode};
8+
use bevy_inspector_egui::egui;
109
use transform_gizmo_bevy::GizmoTarget;
10+
use transform_gizmo_bevy::{EnumSet, GizmoMode};
1111

1212
use crate::{
13-
cameras::{ActiveEditorCamera, CameraWindow, EditorCamera, EDITOR_RENDER_LAYER},
13+
cameras::{EditorCamera, EDITOR_RENDER_LAYER},
1414
hierarchy::HierarchyWindow,
1515
};
1616

1717
pub struct GizmoState {
18+
/// If [false], doesn't show any gizmos
1819
pub camera_gizmo_active: bool,
19-
/// TODO: Take these settings into account
20+
/// Synced with the [transform_gizmo_bevy::GizmoOptions] resource
2021
pub gizmo_modes: EnumSet<GizmoMode>,
2122
}
2223

@@ -38,17 +39,17 @@ impl EditorWindow for GizmoWindow {
3839

3940
fn ui(_world: &mut World, _cx: EditorWindowContext, ui: &mut egui::Ui) {
4041
ui.label("Gizmos can currently not be configured");
41-
// could definitely change some settings here in the future
42+
// could definitely change some settings here in the future
4243
}
4344

44-
/// Called every frame (hopefully), could this invariant (namely being called every frame) be documented,
45-
/// ideally in the [EditorWindow] trait?
45+
/// Called every frame (hopefully), could this invariant (namely being called every frame) be documented,
46+
/// ideally in the [EditorWindow] trait?
4647
fn viewport_toolbar_ui(world: &mut World, cx: EditorWindowContext, _ui: &mut egui::Ui) {
4748
let gizmo_state = cx.state::<GizmoWindow>().unwrap();
4849

49-
// syncs the [GizmoOptions] resource with the current state of the gizmo window
50-
let mut gizmo_options = world.resource_mut::<transform_gizmo_bevy::GizmoOptions>();
51-
gizmo_options.gizmo_modes = gizmo_state.gizmo_modes;
50+
// syncs the [GizmoOptions] resource with the current state of the gizmo window
51+
let mut gizmo_options = world.resource_mut::<transform_gizmo_bevy::GizmoOptions>();
52+
gizmo_options.gizmo_modes = gizmo_state.gizmo_modes;
5253

5354
if gizmo_state.camera_gizmo_active {
5455
/// Before [hydrate_gizmos] and [deconstruct_gizmos] are run, this system resets the state of all entities that have a [EntityShouldShowGizmo] component.
@@ -68,8 +69,12 @@ impl EditorWindow for GizmoWindow {
6869
entities: Query<Entity, (With<EntityShouldShowGizmo>, Without<GizmoTarget>)>,
6970
) {
7071
for entity in entities.iter() {
71-
trace!("Hydrating a gizmo on entity {:?} because it is selected", entity);
72-
// TODO: Maybe change the exact gizmo target instance instead of using default? should this load from some config?
72+
trace!(
73+
"Hydrating a gizmo on entity {:?} because it is selected",
74+
entity
75+
);
76+
// implicitly assumes it is the only gizmo system in the world,
77+
// otherwise setting [GizmoTarget].is_focussed may be necessary
7378
commands.entity(entity).insert(GizmoTarget::default());
7479
}
7580
}

0 commit comments

Comments
 (0)