Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/rmf_site_editor/src/interaction/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl Cursor {
&mut self,
commands: &mut Commands,
model_loader: &mut ModelLoader,
model_instance: Option<ModelInstance<Entity>>,
model_instance: Option<ModelInstance>,
) {
self.remove_preview(commands);
self.preview_model = model_instance.map(|instance| {
Expand Down
22 changes: 8 additions & 14 deletions crates/rmf_site_editor/src/interaction/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ use bevy::prelude::*;
pub struct EdgeVisualCue {
/// If the edge is using support from some anchors, the entities of those
/// anchors will be saved here.
supporters: Option<Edge<Entity>>,
supporters: Option<Edge>,
}

pub fn add_edge_visual_cues(
mut commands: Commands,
new_edges: Query<(Entity, &Edge<Entity>), Without<EdgeVisualCue>>,
new_edges: Query<(Entity, &Edge), Without<EdgeVisualCue>>,
) {
for (e, edge) in &new_edges {
commands.entity(e).insert(EdgeVisualCue {
Expand All @@ -38,18 +38,12 @@ pub fn add_edge_visual_cues(

pub fn update_edge_visual_cues(
mut edges: Query<
(
Entity,
&Hovered,
&Selected,
&Edge<Entity>,
&mut EdgeVisualCue,
),
(Entity, &Hovered, &Selected, &Edge, &mut EdgeVisualCue),
(
Without<AnchorVisualization>,
Without<Point<Entity>>,
Without<Path<Entity>>,
Or<(Changed<Hovered>, Changed<Selected>, Changed<Edge<Entity>>)>,
Without<Point>,
Without<Path>,
Or<(Changed<Hovered>, Changed<Selected>, Changed<Edge>)>,
),
>,
mut anchors: Query<(&mut Hovered, &mut Selected), With<AnchorVisualization>>,
Expand All @@ -62,7 +56,7 @@ pub fn update_edge_visual_cues(
// of the lane.
if old.array() != [a0, a1] {
for v in old.array() {
if let Ok((mut hover, mut selected)) = anchors.get_mut(v) {
if let Ok((mut hover, mut selected)) = anchors.get_mut(*v) {
hover.support_hovering.remove(&e);
selected.support_selected.remove(&e);
}
Expand All @@ -77,7 +71,7 @@ pub fn update_edge_visual_cues(
}

if let Ok([(mut hovered_a0, mut selected_a0), (mut hover_a1, mut selected_a1)]) =
anchors.get_many_mut([a0, a1])
anchors.get_many_mut([*a0, *a1])
{
if hovered.cue() {
hovered_a0.support_hovering.insert(e);
Expand Down
2 changes: 1 addition & 1 deletion crates/rmf_site_editor/src/interaction/lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn update_lane_visual_cues(
(
With<LaneMarker>,
Without<AnchorVisualization>,
Or<(Changed<Hovered>, Changed<Selected>, Changed<Edge<Entity>>)>,
Or<(Changed<Hovered>, Changed<Selected>, Changed<Edge>)>,
),
>,
mut materials: Query<&mut MeshMaterial3d<StandardMaterial>>,
Expand Down
2 changes: 1 addition & 1 deletion crates/rmf_site_editor/src/interaction/lift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn handle_lift_doormat_clicks(
}
}

pub fn dirty_changed_lifts(mut lifts: Query<&mut Hovered, Changed<LiftCabin<Entity>>>) {
pub fn dirty_changed_lifts(mut lifts: Query<&mut Hovered, Changed<LiftCabin>>) {
for mut lift in &mut lifts {
// This is a hack to force the outline to re-render after the lift cabin
// has been reconstructed since any changes to the lift cabin will lazily
Expand Down
2 changes: 1 addition & 1 deletion crates/rmf_site_editor/src/interaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl Plugin for InteractionPlugin {
CategoryVisibilityPlugin::<DoorMarker>::visible(true),
CategoryVisibilityPlugin::<FloorMarker>::visible(true),
CategoryVisibilityPlugin::<LaneMarker>::visible(true),
CategoryVisibilityPlugin::<LiftCabin<Entity>>::visible(true),
CategoryVisibilityPlugin::<LiftCabin>::visible(true),
CategoryVisibilityPlugin::<LiftCabinDoorMarker>::visible(true),
CategoryVisibilityPlugin::<LocationTags>::visible(true),
CategoryVisibilityPlugin::<FiducialMarker>::visible(true),
Expand Down
10 changes: 6 additions & 4 deletions crates/rmf_site_editor/src/interaction/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,28 @@ pub fn update_model_instance_visual_cues(
),
>,
mut model_instances: Query<
(&mut Selected, &mut Hovered, &mut Affiliation<Entity>),
(&mut Selected, &mut Hovered, &mut Affiliation),
(With<ModelMarker>, Without<Group>),
>,
) {
for (mut instance_selected, mut instance_hovered, affiliation) in &mut model_instances {
if let Some(description_entity) = affiliation.0 {
if let Ok((_, description_selected, description_hovered)) =
model_descriptions.get(description_entity)
model_descriptions.get(*description_entity)
{
if description_selected.cue() {
instance_selected
.support_selected
.insert(description_entity);
.insert(*description_entity);
} else {
instance_selected
.support_selected
.remove(&description_entity);
}
if description_hovered.cue() {
instance_hovered.support_hovering.insert(description_entity);
instance_hovered
.support_hovering
.insert(*description_entity);
} else {
instance_hovered
.support_hovering
Expand Down
2 changes: 1 addition & 1 deletion crates/rmf_site_editor/src/interaction/outline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub fn add_outline_visualization(
Or<(
Added<WallMarker>,
Added<DoorType>,
Added<LiftCabin<Entity>>,
Added<LiftCabin>,
Added<MeasurementMarker>,
Added<FiducialMarker>,
Added<FloorMarker>,
Expand Down
22 changes: 8 additions & 14 deletions crates/rmf_site_editor/src/interaction/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ use bevy::prelude::*;

#[derive(Component, Default)]
pub struct PathVisualCue {
supporters: Option<Path<Entity>>,
supporters: Option<Path>,
}

pub fn add_path_visual_cues(
mut commands: Commands,
new_paths: Query<(Entity, &Path<Entity>), Without<PointVisualCue>>,
new_paths: Query<(Entity, &Path), Without<PointVisualCue>>,
) {
for (e, path) in &new_paths {
commands.entity(e).insert(PathVisualCue {
Expand All @@ -36,18 +36,12 @@ pub fn add_path_visual_cues(

pub fn update_path_visual_cues(
mut paths: Query<
(
Entity,
&Hovered,
&Selected,
&Path<Entity>,
&mut PathVisualCue,
),
(Entity, &Hovered, &Selected, &Path, &mut PathVisualCue),
(
Without<AnchorVisualization>,
Without<Edge<Entity>>,
Without<Point<Entity>>,
Or<(Changed<Hovered>, Changed<Selected>, Changed<Path<Entity>>)>,
Without<Edge>,
Without<Point>,
Or<(Changed<Hovered>, Changed<Selected>, Changed<Path>)>,
),
>,
mut anchors: Query<(&mut Hovered, &mut Selected), With<AnchorVisualization>>,
Expand All @@ -59,7 +53,7 @@ pub fn update_path_visual_cues(
// path.
if *old != *path {
for anchor in &old.0 {
if let Ok((mut hover, mut selected)) = anchors.get_mut(*anchor) {
if let Ok((mut hover, mut selected)) = anchors.get_mut(**anchor) {
hover.support_hovering.remove(&p);
selected.support_selected.remove(&p);
}
Expand All @@ -74,7 +68,7 @@ pub fn update_path_visual_cues(
}

for anchor in &path.0 {
if let Ok((mut anchor_hovered, mut anchor_selected)) = anchors.get_mut(*anchor) {
if let Ok((mut anchor_hovered, mut anchor_selected)) = anchors.get_mut(**anchor) {
if hovered.cue() {
anchor_hovered.support_hovering.insert(p);
} else {
Expand Down
22 changes: 8 additions & 14 deletions crates/rmf_site_editor/src/interaction/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ use crate::{interaction::*, site::*};
pub struct PointVisualCue {
/// If the point is using support from an anchor, the entity of that
/// anchor will be saved here.
supporter: Option<Point<Entity>>,
supporter: Option<Point>,
}

pub fn add_point_visual_cues(
mut commands: Commands,
new_points: Query<(Entity, &Point<Entity>), Without<PointVisualCue>>,
new_points: Query<(Entity, &Point), Without<PointVisualCue>>,
) {
for (e, point) in &new_points {
commands.entity(e).insert(PointVisualCue {
Expand All @@ -37,18 +37,12 @@ pub fn add_point_visual_cues(

pub fn update_point_visual_cues(
mut points: Query<
(
Entity,
&Hovered,
&Selected,
&Point<Entity>,
&mut PointVisualCue,
),
(Entity, &Hovered, &Selected, &Point, &mut PointVisualCue),
(
Without<AnchorVisualization>,
Without<Edge<Entity>>,
Without<Path<Entity>>,
Or<(Changed<Hovered>, Changed<Selected>, Changed<Point<Entity>>)>,
Without<Edge>,
Without<Path>,
Or<(Changed<Hovered>, Changed<Selected>, Changed<Point>)>,
),
>,
mut anchors: Query<(&mut Hovered, &mut Selected), With<AnchorVisualization>>,
Expand All @@ -60,7 +54,7 @@ pub fn update_point_visual_cues(
// This can happen if a user changes the reference anchor for the
// point.
if old.0 != anchor {
if let Ok((mut hover, mut selected)) = anchors.get_mut(old.0) {
if let Ok((mut hover, mut selected)) = anchors.get_mut(*old.0) {
hover.support_hovering.remove(&p);
selected.support_selected.remove(&p);
}
Expand All @@ -73,7 +67,7 @@ pub fn update_point_visual_cues(
cue.supporter = None;
}

if let Ok((mut anchor_hovered, mut anchor_selected)) = anchors.get_mut(anchor) {
if let Ok((mut anchor_hovered, mut anchor_selected)) = anchors.get_mut(*anchor) {
if hovered.cue() {
anchor_hovered.support_hovering.insert(p);
} else {
Expand Down
Loading