Skip to content

Commit be19460

Browse files
committed
Merge remote-tracking branch 'origin/main' into xiyu/improve_tasks
2 parents 8c278e2 + 14dcaf9 commit be19460

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1730
-557
lines changed

Cargo.lock

Lines changed: 39 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ bevy_ptr = "0.16"
109109
bevy_reflect = "0.16"
110110
bevy_remote = "0.16"
111111
bevy_render = "0.16"
112+
bevy_rich_text3d = "0.4.1"
112113
bevy_scene = "0.16"
113114
bevy_sprite = "0.16"
114115
bevy_state = "0.16"

assets/demo_maps/test.site.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@
136136
"name": "<Unnamed>",
137137
"kind": {
138138
"SingleSliding": {
139-
"towards": "Left"
139+
"towards": "Left",
140+
"position": 1.0
140141
}
141142
}
142143
}
@@ -590,7 +591,9 @@
590591
"47": {
591592
"kind": {
592593
"DoubleSliding": {
593-
"left_right_ratio": 1.0
594+
"left_right_ratio": 1.0,
595+
"left_position": 1.0,
596+
"right_position": 1.0
594597
}
595598
},
596599
"reference_anchors": [

crates/rmf_site_editor/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ anyhow = {workspace = true}
5555
uuid = { workspace = true, features = ["v4"] }
5656
bytemuck = {workspace = true}
5757
bevy_infinite_grid = {workspace = true}
58+
bevy_rich_text3d = {workspace = true}
5859
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
5960
clap = { workspace = true, features = ["color", "derive", "help", "usage", "suggestions"] }
6061
bevy_egui = {workspace = true}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (C) 2025 Open Source Robotics Foundation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
use crate::{interaction::*, site::*};
19+
use bevy_rich_text3d::*;
20+
21+
pub fn update_door_interactive_cues(
22+
changed_doors: Query<
23+
(&Hovered, &Selected, &DoorSegments),
24+
Or<(Changed<Hovered>, Changed<Selected>)>,
25+
>,
26+
mut styles: Query<&mut Text3dStyling>,
27+
mut materials: Query<&mut MeshMaterial3d<StandardMaterial>>,
28+
assets: Res<SiteAssets>,
29+
) {
30+
for (hovered, selected, segments) in &changed_doors {
31+
let text_color = if hovered.cue() && selected.cue() {
32+
HOVER_SELECT_COLOR
33+
} else if hovered.cue() {
34+
HOVER_COLOR
35+
} else if selected.cue() {
36+
SELECT_COLOR
37+
} else {
38+
Color::BLACK
39+
};
40+
41+
for text in segments.name_displays() {
42+
if let Ok(mut style) = styles.get_mut(text) {
43+
style.color = text_color.into();
44+
}
45+
}
46+
47+
let cue_material = if hovered.cue() {
48+
assets.door_cue_highlighted_material.clone()
49+
} else {
50+
assets.door_cue_material.clone()
51+
};
52+
53+
if let Ok(mut material) = materials.get_mut(segments.cue) {
54+
**material = cue_material;
55+
}
56+
}
57+
}

crates/rmf_site_editor/src/interaction/lane.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
use crate::{interaction::*, layers::ZLayer, site::*};
19+
use bevy::pbr::ExtendedMaterial;
1920
use bevy::prelude::*;
2021
use rmf_site_format::{Edge, LaneMarker};
2122

@@ -39,6 +40,10 @@ pub fn update_lane_visual_cues(
3940
),
4041
>,
4142
mut materials: Query<&mut MeshMaterial3d<StandardMaterial>>,
43+
mut lane_materials: Query<
44+
&MeshMaterial3d<ExtendedMaterial<StandardMaterial, LaneArrowMaterial>>,
45+
>,
46+
mut extended_materials: ResMut<Assets<ExtendedMaterial<StandardMaterial, LaneArrowMaterial>>>,
4247
mut visibility: Query<&mut Visibility>,
4348
site_assets: Res<SiteAssets>,
4449
cursor: Res<Cursor>,
@@ -76,5 +81,15 @@ pub fn update_lane_visual_cues(
7681
}
7782

7883
tf.translation.z = h;
84+
85+
if let Some(mat) = lane_materials.get_mut(pieces.mid).ok() {
86+
if let Some(lane_mat) = extended_materials.get_mut(&mat.0) {
87+
lane_mat.extension.is_active = if hovered.cue() || selected.cue() {
88+
true as u32
89+
} else {
90+
false as u32
91+
};
92+
}
93+
}
7994
}
8095
}

0 commit comments

Comments
 (0)