Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawing editor mode #132

Merged
merged 63 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
36bb7c4
Cleanup and restore drawing asset source update behavior
luca-della-vedova May 15, 2023
4170acb
Refactor loading drawing to be a component
luca-della-vedova May 15, 2023
d9706d1
Bare drawing editor mode with 2d camera and visibility toggling
luca-della-vedova May 17, 2023
0f0a6d7
Refactor top menu bar code
luca-della-vedova May 17, 2023
2e1994a
Add fiducials, fix glitches with visibility toggling
luca-della-vedova May 18, 2023
88407a5
Make fiducials selectable, cleanup
luca-della-vedova May 18, 2023
872b057
Spawn traffic editor layers
luca-della-vedova May 19, 2023
47e39f4
WIP fiducials and features as children of drawings
luca-della-vedova May 24, 2023
ce8f0cc
Cleanup and fix system ordering
luca-della-vedova May 24, 2023
4911a89
Fiducial and anchor scaling working
luca-della-vedova May 25, 2023
13e9a03
Minor cleanup
luca-della-vedova May 25, 2023
607d0bd
Fix measurement scale
luca-della-vedova May 25, 2023
cdce56b
Implement constraints
luca-della-vedova May 25, 2023
2e3dfa2
Minor fix for layering
luca-della-vedova May 26, 2023
1859621
Add a component for ground truth drawings
luca-della-vedova May 26, 2023
c69c55f
Add widget
luca-della-vedova May 26, 2023
35b7209
Hide anchors on change to drawing editor mode
luca-della-vedova May 26, 2023
40fa108
Fix layering measurements
luca-della-vedova May 26, 2023
7fcd0f3
Assign parent to newly spawned measurements and fiducials
luca-della-vedova May 26, 2023
2cef81f
Add spawning of drawings
luca-della-vedova May 26, 2023
a62d1cd
Fixed hierarchy for newly spawned fiducials
luca-della-vedova May 29, 2023
d52c917
Fixed scale and transfor for new fiducials
luca-della-vedova May 29, 2023
4b1d562
Cleanups, fix measurement parent
luca-della-vedova May 29, 2023
1005d82
Cleanup
luca-della-vedova May 29, 2023
68bd3cb
Improve UX
luca-della-vedova May 29, 2023
7d0d010
Split constraints into site and level
luca-della-vedova May 30, 2023
b3f3978
Add inspector for measurement distance
luca-della-vedova May 30, 2023
3cb3996
Basic implementation of pixels per meter calculation
luca-della-vedova May 30, 2023
b3fb95e
Fix regression for create widget
luca-della-vedova May 30, 2023
1972d2d
Refactor category visibility into generic plugin
luca-della-vedova May 30, 2023
6dafcd9
Fix panic when spawning constraints
luca-della-vedova May 30, 2023
e162a7b
Add layer transparency for drawings
luca-della-vedova May 31, 2023
fd0cb9e
First implementation of layer alignment
luca-della-vedova Jun 1, 2023
d3ffa29
Cleanups to optimizer code
luca-della-vedova Jun 1, 2023
d6f52fa
Cleanup and refactor
luca-della-vedova Jun 1, 2023
83721bd
Cleanup
luca-della-vedova Jun 1, 2023
90727b7
More cleanups in optimization code
luca-della-vedova Jun 1, 2023
154b914
Minor cleanups, add default transparency logic to drawings
luca-della-vedova Jun 1, 2023
985c009
Make layer transparency a resource, different for drawings and floors
luca-della-vedova Jun 1, 2023
05b2510
Remove workaround and fix fiducial scale
luca-della-vedova Jun 5, 2023
68b597f
Revert "Remove workaround and fix fiducial scale"
luca-della-vedova Jun 5, 2023
c1681dc
Force constraints to only be spawned between fiducials
luca-della-vedova Jun 5, 2023
a348592
Prevent user from drawing constraints between fiducials in the same
luca-della-vedova Jun 5, 2023
cc51def
Fix visibility in backout behavior
luca-della-vedova Jun 5, 2023
0c62f02
Fix constraints saving, cleanup drawing logic
luca-della-vedova Jun 6, 2023
0be0e04
Minor cleanup
luca-della-vedova Jun 6, 2023
43eb002
Implement parsing of multilevel fiducials
luca-della-vedova Jun 8, 2023
4a65c71
First draft of multilevel alignment
luca-della-vedova Jun 9, 2023
3ae7e05
Only populate constraints from reference to other floors
luca-della-vedova Jun 9, 2023
e4c616d
Cleanup into systemparams
luca-della-vedova Jun 9, 2023
b2b8b1b
Minor cleanups
luca-della-vedova Jun 9, 2023
8c2f332
Hide drawing anchors when spawning site entities
luca-della-vedova Jun 9, 2023
59d84b9
Convert line stroke transform to 3d
luca-della-vedova Jun 12, 2023
70587a7
Added 3d site preview mode
luca-della-vedova Jun 12, 2023
9e4e03d
Add button to trigger site alignment
luca-della-vedova Jun 12, 2023
0122a71
Cleanup duplicated packages a bit
luca-della-vedova Jun 13, 2023
e807007
Spawn multilevel constraints based on label values
luca-della-vedova Jun 14, 2023
ed4b0d1
Merge branch 'main' into luca/drawing_editor
luca-della-vedova Jul 10, 2023
dc0406e
Remove spawn model widget from drawing editor
luca-della-vedova Jul 10, 2023
46a1dec
Minor cleanups, avoid creating a constraint between fiducials with no
luca-della-vedova Jul 17, 2023
fbf9856
Merge branch 'main' into luca/drawing_editor
mxgrey Jul 26, 2023
c2951bc
Merge branch 'main' into luca/drawing_editor
mxgrey Jul 26, 2023
785c19c
Drawing editor updates (#157)
luca-della-vedova Aug 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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