Skip to content

Commit

Permalink
Minor cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Della Vedova <[email protected]>
  • Loading branch information
luca-della-vedova committed Jul 14, 2023
1 parent 12672a9 commit 13ca180
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 43 deletions.
12 changes: 1 addition & 11 deletions rmf_site_editor/src/interaction/model_preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ pub struct ModelPreviewCamera {

pub struct ModelPreviewPlugin;

// TODO(luca) implement this system to scale the view based on the model's Aabb
fn scale_preview_for_model_bounding_box(
aabbs: Query<&Aabb, Changed<Aabb>>,
parents: Query<&Parent>,
model_preview: Res<ModelPreviewCamera>,
camera_transforms: Query<&mut Transform, With<Camera>>,
) {
}

impl FromWorld for ModelPreviewCamera {
fn from_world(world: &mut World) -> Self {
// camera
Expand Down Expand Up @@ -94,7 +85,6 @@ impl FromWorld for ModelPreviewCamera {

impl Plugin for ModelPreviewPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<ModelPreviewCamera>()
.add_system(scale_preview_for_model_bounding_box);
app.init_resource::<ModelPreviewCamera>();
}
}
2 changes: 1 addition & 1 deletion rmf_site_editor/src/site/fuel_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub fn handle_update_fuel_cache_requests(
channels: Res<UpdateFuelCacheChannels>,
) {
if events.iter().last().is_some() {
info!("Updating fuel cache");
info!("Updating fuel cache, this might take a few minutes");
gallery_status.fetching_cache = true;
let mut fuel_client = fuel_client.clone();
let sender = channels.sender.clone();
Expand Down
35 changes: 4 additions & 31 deletions rmf_site_editor/src/widgets/new_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use bevy_egui::egui::{Button, ComboBox, RichText, ScrollArea, Ui, Window};
use gz_fuel::FuelModel;

/// Filters applied to models in the fuel list
#[derive(Default)]
pub struct ShowAssetFilters {
pub owner: Option<String>,
pub recall_owner: Option<String>,
Expand All @@ -33,7 +34,7 @@ pub struct ShowAssetFilters {
}

/// Used to signals whether to show or hide the left side panel with the asset gallery
#[derive(Resource)]
#[derive(Resource, Default)]
pub struct AssetGalleryStatus {
pub show: bool,
pub selected: Option<FuelModel>,
Expand All @@ -45,34 +46,6 @@ pub struct AssetGalleryStatus {
pub show_api_window: bool,
}

impl Default for ShowAssetFilters {
fn default() -> Self {
Self {
owner: Some("OpenRobotics".into()),
recall_owner: None,
tag: None,
recall_tag: None,
private: None,
recall_private: None,
}
}
}

impl Default for AssetGalleryStatus {
fn default() -> Self {
Self {
show: true,
selected: None,
cached_owners: None,
cached_tags: None,
filters: Default::default(),
proposed_api_key: Default::default(),
fetching_cache: false,
show_api_window: false,
}
}
}

#[derive(SystemParam)]
pub struct NewModelParams<'w, 's> {
pub fuel_client: ResMut<'w, FuelClient>,
Expand Down Expand Up @@ -202,7 +175,7 @@ impl<'a, 'w, 's> NewModel<'a, 'w, 's> {

ui.add_space(10.0);

// TODO(luca) should we cache the models by owner result to avoid calling at every
// TODO(luca) should we cache the models by filters result to avoid calling at every
// frame?
let models = models
.iter()
Expand Down Expand Up @@ -299,7 +272,7 @@ impl<'a, 'w, 's> NewModel<'a, 'w, 's> {
if ui.add(Button::new("Set API key")).clicked() {
gallery_status.show_api_window = true;
}
if gallery_status.fetching_cache == true {
if gallery_status.fetching_cache {
ui.label("Updating model cache...");
} else {
if ui.add(Button::new("Update model cache")).clicked() {
Expand Down

0 comments on commit 13ca180

Please sign in to comment.