Skip to content

Commit

Permalink
Merge branch 'main' into luca/new_floor_panic
Browse files Browse the repository at this point in the history
  • Loading branch information
mxgrey authored Aug 17, 2023
2 parents 5389ea1 + e45f497 commit 6043e37
Show file tree
Hide file tree
Showing 85 changed files with 5,445 additions and 1,428 deletions.
Binary file added assets/textures/add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/alignment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
173 changes: 173 additions & 0 deletions assets/textures/alignment.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion assets/textures/attribution.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
* [`select.png`](https://thenounproject.com/icon/select-3324735/)
* [`edit.png`](https://thenounproject.com/icon/edit-2162449/)
* [`exit.png`](https://thenounproject.com/icon/exit-1826632/)
* [`confirm.png`](https://thenounproject.com/icon/confirm-2261637/)
* [`reject.png`](https://thenounproject.com/icon/x-2289933/)
* [`empty.png`](https://thenounproject.com/icon/empty-194055/)
* [`add.png`](https://thenounproject.com/icon/plus-1809810/)
* [`search.png`](https://thenounproject.com/icon/search-3743008/)
* `trash.png`: @mxgrey

* `selected.png`: @mxgrey
* `alignment.png`: @mxgrey
Binary file added assets/textures/confirm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/exit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/reject.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions assets/textures/selected.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions rmf_site_editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ tracing = "0.1.37"
tracing-subscriber = "0.3.1"
rfd = "0.11"
urdf-rs = "0.7"
# sdformat_rs = { path = "../../sdf_rust_experimental/sdformat_rs"}
sdformat_rs = { git = "https://github.com/open-rmf/sdf_rust_experimental", rev = "f86344f"}
sdformat_rs = { git = "https://github.com/open-rmf/sdf_rust_experimental", rev = "a5daef0"}
pathdiff = "*"

# only enable the 'dynamic' feature if we're not building for web or windows
[target.'cfg(all(not(target_arch = "wasm32"), not(target_os = "windows")))'.dependencies]
Expand Down
1 change: 0 additions & 1 deletion rmf_site_editor/src/interaction/anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub fn add_anchor_visual_cues(
>,
categories: Query<&Category>,
site_assets: Res<SiteAssets>,
interaction_assets: Res<InteractionAssets>,
) {
for (e, parent, subordinate, anchor) in &new_anchors {
let body_mesh = match categories.get(parent.get()).unwrap() {
Expand Down
41 changes: 41 additions & 0 deletions rmf_site_editor/src/interaction/camera_controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ impl ProjectionMode {
}
}

pub struct ChangeProjectionMode(pub ProjectionMode);

impl ChangeProjectionMode {
pub fn to_perspective() -> ChangeProjectionMode {
ChangeProjectionMode(ProjectionMode::Perspective)
}

pub fn to_orthographic() -> ChangeProjectionMode {
ChangeProjectionMode(ProjectionMode::Orthographic)
}
}

#[derive(Debug, Clone, Reflect, Resource)]
pub struct CameraControls {
mode: ProjectionMode,
Expand Down Expand Up @@ -152,6 +164,23 @@ impl CameraControls {
self.use_perspective(!choice, cameras, visibilities, headlights_on);
}

pub fn use_mode(
&mut self,
mode: ProjectionMode,
cameras: &mut Query<&mut Camera>,
visibilities: &mut Query<&mut Visibility>,
headlights_on: bool,
) {
match mode {
ProjectionMode::Perspective => {
self.use_perspective(true, cameras, visibilities, headlights_on);
}
ProjectionMode::Orthographic => {
self.use_orthographic(true, cameras, visibilities, headlights_on);
}
}
}

pub fn mode(&self) -> ProjectionMode {
self.mode
}
Expand Down Expand Up @@ -329,10 +358,21 @@ fn camera_controls(
mut previous_mouse_location: ResMut<MouseLocation>,
mut controls: ResMut<CameraControls>,
mut cameras: Query<(&mut Projection, &mut Transform)>,
mut bevy_cameras: Query<&mut Camera>,
mut visibility: Query<&mut Visibility>,
headlight_toggle: Res<HeadlightToggle>,
picking_blockers: Res<PickingBlockers>,
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,
);
}

if headlight_toggle.is_changed() {
controls.toggle_lights(headlight_toggle.0, &mut visibility);
}
Expand Down Expand Up @@ -488,6 +528,7 @@ impl Plugin for CameraControlsPlugin {
app.insert_resource(MouseLocation::default())
.init_resource::<CameraControls>()
.init_resource::<HeadlightToggle>()
.add_event::<ChangeProjectionMode>()
.add_system(camera_controls);
}
}
Loading

0 comments on commit 6043e37

Please sign in to comment.