Skip to content

Commit

Permalink
Rename WorkspaceLoadingParams to WorkspaceLoader
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
  • Loading branch information
luca-della-vedova committed Aug 5, 2024
1 parent 659da70 commit 41f6233
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
6 changes: 3 additions & 3 deletions 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::{ChangeMode, ChangeProjectionMode, InteractionMode, Selection},
site::{AlignSiteDrawings, Delete},
CreateNewWorkspace, CurrentWorkspace, SaveWorkspace, WorkspaceLoadingParams,
CreateNewWorkspace, CurrentWorkspace, SaveWorkspace, WorkspaceLoader,
};
use bevy::{prelude::*, window::PrimaryWindow};
use bevy_egui::EguiContexts;
Expand Down Expand Up @@ -55,7 +55,7 @@ fn handle_keyboard_input(
mut align_site: EventWriter<AlignSiteDrawings>,
current_workspace: Res<CurrentWorkspace>,
primary_windows: Query<Entity, With<PrimaryWindow>>,
mut load_workspace: WorkspaceLoadingParams,
mut workspace_loader: WorkspaceLoader,
) {
let Some(egui_context) = primary_windows
.get_single()
Expand Down Expand Up @@ -122,7 +122,7 @@ fn handle_keyboard_input(
}

if keyboard_input.just_pressed(KeyCode::O) {
load_workspace.load_from_dialog();
workspace_loader.load_from_dialog();
}
}
}
14 changes: 7 additions & 7 deletions rmf_site_editor/src/main_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/

use super::demo_world::*;
use crate::{AppState, Autoload, WorkspaceData, WorkspaceLoadingParams};
use crate::{AppState, Autoload, WorkspaceData, WorkspaceLoader};
use bevy::{app::AppExit, prelude::*, window::PrimaryWindow};
use bevy_egui::{egui, EguiContexts};

fn egui_ui(
mut egui_context: EguiContexts,
mut _exit: EventWriter<AppExit>,
mut load_workspace: WorkspaceLoadingParams,
mut workspace_loader: WorkspaceLoader,
mut _app_state: ResMut<State<AppState>>,
autoload: Option<ResMut<Autoload>>,
primary_windows: Query<Entity, With<PrimaryWindow>>,
Expand All @@ -32,7 +32,7 @@ fn egui_ui(
#[cfg(not(target_arch = "wasm32"))]
{
if let Some(filename) = autoload.filename.take() {
load_workspace.load_from_path(filename);
workspace_loader.load_from_path(filename);
}
}
return;
Expand All @@ -57,21 +57,21 @@ fn egui_ui(

ui.horizontal(|ui| {
if ui.button("View demo map").clicked() {
load_workspace.load_from_data(WorkspaceData::LegacyBuilding(demo_office()));
workspace_loader.load_from_data(WorkspaceData::LegacyBuilding(demo_office()));
}

if ui.button("Open a file").clicked() {
load_workspace.load_from_dialog();
workspace_loader.load_from_dialog();
}

if ui.button("Create new file").clicked() {
load_workspace.create_empty_from_dialog();
workspace_loader.create_empty_from_dialog();
}

// TODO(@mxgrey): Bring this back when we have finished developing
// the key features for workcell editing.
// if ui.button("Workcell Editor").clicked() {
// load_workspace.send(LoadWorkspace::Data(WorkspaceData::Workcell(
// workspace_loader.send(LoadWorkspace::Data(WorkspaceData::Workcell(
// demo_workcell(),
// )));
// }
Expand Down
6 changes: 3 additions & 3 deletions rmf_site_editor/src/site/sdf_exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
ChildLiftCabinGroup, CollisionMeshMarker, DoorSegments, DrawingMarker, FloorSegments,
LiftDoormat, ModelSceneRoot, TentativeModelFormat, VisualMeshMarker,
},
Autoload, WorkspaceLoadingParams,
Autoload, WorkspaceLoader,
};
use rmf_site_format::{
IsStatic, LevelElevation, LiftCabin, ModelMarker, NameInSite, NameOfSite, SiteID, WallMarker,
Expand Down Expand Up @@ -51,11 +51,11 @@ pub fn headless_sdf_export(
sites: Query<(Entity, &NameOfSite)>,
drawings: Query<Entity, With<DrawingMarker>>,
autoload: Option<ResMut<Autoload>>,
mut load_workspace: WorkspaceLoadingParams,
mut workspace_loader: WorkspaceLoader,
) {
if let Some(mut autoload) = autoload {
if let Some(filename) = autoload.filename.take() {
load_workspace.load_from_path(filename);
workspace_loader.load_from_path(filename);
}
} else {
error!("Cannot perform a headless export since no site file was specified for loading");
Expand Down
8 changes: 3 additions & 5 deletions rmf_site_editor/src/widgets/menu_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
*
*/

use crate::{
widgets::prelude::*, AppState, CreateNewWorkspace, SaveWorkspace, WorkspaceLoadingParams,
};
use crate::{widgets::prelude::*, AppState, CreateNewWorkspace, SaveWorkspace, WorkspaceLoader};

use bevy::ecs::query::Has;
use bevy::prelude::*;
Expand Down Expand Up @@ -279,7 +277,7 @@ fn top_menu_bar(
In(input): In<PanelWidgetInput>,
mut new_workspace: EventWriter<CreateNewWorkspace>,
mut save: EventWriter<SaveWorkspace>,
mut load_workspace: WorkspaceLoadingParams,
mut workspace_loader: WorkspaceLoader,
file_menu: Res<FileMenu>,
top_level_components: Query<(), Without<Parent>>,
children: Query<&Children>,
Expand Down Expand Up @@ -310,7 +308,7 @@ fn top_menu_bar(
.add(Button::new("Open").shortcut_text("Ctrl+O"))
.clicked()
{
load_workspace.load_from_dialog();
workspace_loader.load_from_dialog();
}

render_sub_menu(
Expand Down
4 changes: 2 additions & 2 deletions rmf_site_editor/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ impl FromWorld for WorkspaceLoadingServices {
}
}

impl<'w, 's> WorkspaceLoadingParams<'w, 's> {
impl<'w, 's> WorkspaceLoader<'w, 's> {
/// Request to spawn a dialog and load a workspace
pub fn load_from_dialog(&mut self) {
self.commands
Expand Down Expand Up @@ -503,7 +503,7 @@ impl<'w, 's> WorkspaceLoadingParams<'w, 's> {

/// `SystemParam` used to request for workspace loading operations
#[derive(SystemParam)]
pub struct WorkspaceLoadingParams<'w, 's> {
pub struct WorkspaceLoader<'w, 's> {
workspace_loading: Res<'w, WorkspaceLoadingServices>,
commands: Commands<'w, 's>,
}
Expand Down

0 comments on commit 41f6233

Please sign in to comment.