Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
Signed-off-by: Michael X. Grey <[email protected]>
  • Loading branch information
mxgrey committed Aug 13, 2023
1 parent ab4ced0 commit 5454eb0
Show file tree
Hide file tree
Showing 45 changed files with 764 additions and 541 deletions.
7 changes: 6 additions & 1 deletion rmf_site_editor/src/interaction/camera_controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,12 @@ fn camera_controls(
mut change_mode: EventReader<ChangeProjectionMode>,
) {
if let Some(mode) = change_mode.iter().last() {
controls.use_mode(mode.0, &mut bevy_cameras, &mut visibility, headlight_toggle.0);
controls.use_mode(
mode.0,
&mut bevy_cameras,
&mut visibility,
headlight_toggle.0,
);
}

if headlight_toggle.is_changed() {
Expand Down
17 changes: 9 additions & 8 deletions rmf_site_editor/src/interaction/highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
*
*/

use crate::{
interaction::*,
site::DrawingMarker,
};
use crate::{interaction::*, site::DrawingMarker};
use bevy::prelude::*;

#[derive(Component)]
Expand Down Expand Up @@ -46,15 +43,19 @@ pub fn add_highlight_visualization(
new_drawings: Query<Entity, Added<DrawingMarker>>,
) {
for e in &new_drawings {
commands
.entity(e)
.insert(Highlight::for_drawing());
commands.entity(e).insert(Highlight::for_drawing());
}
}

pub fn update_highlight_visualization(
highlightable: Query<
(&Hovered, &Selected, &Handle<StandardMaterial>, &Highlight, Option<&SuppressHighlight>),
(
&Hovered,
&Selected,
&Handle<StandardMaterial>,
&Highlight,
Option<&SuppressHighlight>,
),
Or<(
Changed<Hovered>,
Changed<Selected>,
Expand Down
19 changes: 13 additions & 6 deletions rmf_site_editor/src/interaction/outline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
*
*/

use crate::{
site::DrawingMarker,
interaction::*,
};
use crate::{interaction::*, site::DrawingMarker};
use bevy::render::view::RenderLayers;
use bevy_mod_outline::{OutlineBundle, OutlineRenderLayers, OutlineVolume, SetOutlineDepth};
use rmf_site_format::{
Expand Down Expand Up @@ -143,8 +140,18 @@ pub fn add_outline_visualization(
pub fn update_outline_visualization(
mut commands: Commands,
outlinable: Query<
(Entity, &Hovered, &Selected, &OutlineVisualization, Option<&SuppressOutline>),
Or<(Changed<Hovered>, Changed<Selected>, Changed<SuppressOutline>)>,
(
Entity,
&Hovered,
&Selected,
&OutlineVisualization,
Option<&SuppressOutline>,
),
Or<(
Changed<Hovered>,
Changed<Selected>,
Changed<SuppressOutline>,
)>,
>,
descendants: Query<(Option<&Children>, Option<&ComputedVisualCue>)>,
) {
Expand Down
10 changes: 2 additions & 8 deletions rmf_site_editor/src/interaction/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
*
*/

use crate::{
interaction::*,
site::*,
};
use crate::{interaction::*, site::*};

#[derive(Component, Clone, Copy)]
pub struct Popup {
Expand All @@ -29,10 +26,7 @@ pub struct Popup {

pub fn add_popups(
mut commands: Commands,
new_poppers: Query<Entity, Or<(
Added<LocationTags>,
Added<FiducialMarker>,
)>>,
new_poppers: Query<Entity, Or<(Added<LocationTags>, Added<FiducialMarker>)>>,
) {
for e in &new_poppers {
commands.entity(e).insert(Popup {
Expand Down
24 changes: 14 additions & 10 deletions rmf_site_editor/src/interaction/select_anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
use crate::{
interaction::*,
site::{
drawing_editor::CurrentEditDrawing,
Anchor, AnchorBundle, Category, Dependents, DrawingMarker, Original, PathBehavior, Pending,
drawing_editor::CurrentEditDrawing, Anchor, AnchorBundle, Category, Dependents,
DrawingMarker, Original, PathBehavior, Pending,
},
CurrentWorkspace,
};
use bevy::{ecs::system::SystemParam, prelude::*};
use rmf_site_format::{
Constraint, ConstraintDependents, Door, Edge, Fiducial, Floor, Lane, LiftProperties, Location,
Measurement, MeshConstraint, MeshElement, Model, ModelMarker, NameInWorkcell, Path,
PixelsPerMeter, Point, Pose, Side, NameOfSite, Wall, WorkcellCollisionMarker,
WorkcellModel, WorkcellVisualMarker,
Measurement, MeshConstraint, MeshElement, Model, ModelMarker, NameInWorkcell, NameOfSite, Path,
PixelsPerMeter, Point, Pose, Side, Wall, WorkcellCollisionMarker, WorkcellModel,
WorkcellVisualMarker,
};
use std::collections::HashSet;
use std::sync::Arc;
Expand Down Expand Up @@ -2038,8 +2038,14 @@ pub fn handle_select_anchor_mode(
new_anchor
}
Scope::Drawing => {
let drawing_entity = current_drawing.target().expect("No drawing while spawning drawing anchor").drawing;
let (parent, ppm) = params.drawings.get(drawing_entity).expect("Entity being edited is not a drawing");
let drawing_entity = current_drawing
.target()
.expect("No drawing while spawning drawing anchor")
.drawing;
let (parent, ppm) = params
.drawings
.get(drawing_entity)
.expect("Entity being edited is not a drawing");
// We also need to have a transform such that the anchor will spawn in the
// right spot
let pose = compute_parent_inverse_pose(&tf, &transforms, parent);
Expand Down Expand Up @@ -2103,9 +2109,7 @@ pub fn handle_select_anchor_mode(
.filter(|s| anchors.contains(*s))
{
request = match request.next(AnchorSelection::existing(new_selection), &mut params) {
Some(next_mode) => {
next_mode
}
Some(next_mode) => next_mode,
None => {
params.cleanup();
*mode = InteractionMode::Inspect;
Expand Down
2 changes: 1 addition & 1 deletion rmf_site_editor/src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use crate::{
interaction::{
camera_controls::{CameraControls, HeadlightToggle},
ChangeMode, InteractionMode, Selection, ChangeProjectionMode,
ChangeMode, ChangeProjectionMode, InteractionMode, Selection,
},
site::{AlignSiteDrawings, CurrentLevel, Delete},
CreateNewWorkspace, CurrentWorkspace, LoadWorkspace, SaveWorkspace,
Expand Down
2 changes: 1 addition & 1 deletion rmf_site_editor/src/occupancy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use crate::{
interaction::ComputedVisualCue,
shapes::*,
site::{Category, LevelElevation, SiteAssets, NameOfSite, LANE_LAYER_START},
site::{Category, LevelElevation, NameOfSite, SiteAssets, LANE_LAYER_START},
};
use bevy::{
math::{swizzles::*, Affine3A, Mat3A, Vec2, Vec3A},
Expand Down
14 changes: 6 additions & 8 deletions rmf_site_editor/src/site/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,18 @@ impl FromWorld for SiteAssets {
);
let location_mesh = meshes.add(
Mesh::from(
make_icon_halo(1.1 * LANE_WIDTH / 2.0, 0.01, 6)
.transform_by(Affine3A::from_translation(
(0.00125 + LOCATION_LAYER_HEIGHT) * Vec3::Z)
),
make_icon_halo(1.1 * LANE_WIDTH / 2.0, 0.01, 6).transform_by(
Affine3A::from_translation((0.00125 + LOCATION_LAYER_HEIGHT) * Vec3::Z),
),
)
.with_generated_outline_normals()
.unwrap(),
);
let fiducial_mesh = meshes.add(
Mesh::from(
make_icon_halo(1.1 * LANE_WIDTH / 2.0, 0.01, 4)
.transform_by(Affine3A::from_translation(
(0.00125 + LOCATION_LAYER_HEIGHT) * Vec3::Z)
),
make_icon_halo(1.1 * LANE_WIDTH / 2.0, 0.01, 4).transform_by(
Affine3A::from_translation((0.00125 + LOCATION_LAYER_HEIGHT) * Vec3::Z),
),
)
.with_generated_outline_normals()
.unwrap(),
Expand Down
4 changes: 2 additions & 2 deletions rmf_site_editor/src/site/deletion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use crate::{
interaction::{Select, Selection},
log::Log,
site::{
Category, CurrentLevel, Dependents, LevelProperties, NameInSite,
LevelElevation, SiteUpdateStage,
Category, CurrentLevel, Dependents, LevelElevation, LevelProperties, NameInSite,
SiteUpdateStage,
},
};
use bevy::{ecs::system::SystemParam, prelude::*};
Expand Down
Loading

0 comments on commit 5454eb0

Please sign in to comment.