Skip to content

Commit

Permalink
More refactors
Browse files Browse the repository at this point in the history
Signed-off-by: Arjo Chakravarty <[email protected]>
  • Loading branch information
arjo129 committed Jul 28, 2023
1 parent c0cbe57 commit df93732
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Taken from https://github.com/bevyengine/bevy/pull/5550/files
// Might be useful to move this to a utils folder.
use std::sync::Arc;

use bevy::prelude::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ impl ColorEntityMap {
g = rand::random::<u8>();
b = rand::random::<u8>();
}
println!("Handling new color {} {} {}", r, g, b);
self.color_to_entity_map.insert((r, g, b), *entity);

let color = Color::rgb_u8(r, g, b);
Expand Down
10 changes: 7 additions & 3 deletions rmf_site_editor/src/interaction/ColorBasedPicker/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
use bevy::prelude::*;

pub mod color_based_picking;
pub use color_based_picking::*;
pub mod rendering_helper;
pub use rendering_helper::*;

pub mod color_entity_mapping;
pub use color_entity_mapping::*;

pub mod camera_capture;
pub use camera_capture::*;

use super::{LINE_PICKING_LAYER, POINT_PICKING_LAYER};

pub struct ColorBasedPicker;
Expand All @@ -24,6 +27,7 @@ impl Plugin for ColorBasedPicker {
)
.init_resource::<ColorEntityMap>()
.add_system(color_entity_mapping_system::<LINE_PICKING_LAYER>)
.add_system(color_entity_mapping_system::<POINT_PICKING_LAYER>);
.add_system(color_entity_mapping_system::<POINT_PICKING_LAYER>)
.add_plugin(ImageCopyPlugin);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use crate::interaction::Hover;
use crate::interaction::Select;
use bevy::core_pipeline::clear_color::ClearColorConfig;
use bevy::core_pipeline::fxaa::Fxaa;
use bevy::core_pipeline::tonemapping::Tonemapping;
Expand All @@ -11,10 +9,11 @@ use bevy::render::view::RenderLayers;
use bevy::window::WindowResized;
use rmf_site_format::Anchor;

use crate::site::{LaneSegments, ImageCopier};
use crate::site::LaneSegments;
use super::{ColorEntityMap, ScreenSpaceSelection};
use crate::interaction::*;
use crate::interaction::camera_controls::MouseLocation;
use crate::interaction::{CameraControls, ProjectionMode, Selected, POINT_PICKING_LAYER};
use crate::interaction::{CameraControls, ProjectionMode, POINT_PICKING_LAYER};
use crate::keyboard::DebugMode;

#[derive(Component, Clone, Debug, Default)]
Expand Down Expand Up @@ -43,7 +42,7 @@ pub fn resize_notificator<const Layer: u8>(
ProjectionMode::Orthographic => camera_controls.orthographic_camera_entities[0],
};

if let Ok((camera, camera_transform)) = cameras.get(view_cam_entity) {
if let Ok((camera, _)) = cameras.get(view_cam_entity) {
for _e in resize_event.iter() {
//Despawn old allocations
if let Some(camera) = render_buffer_details.selection_cam_entity {
Expand Down
5 changes: 3 additions & 2 deletions rmf_site_editor/src/interaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ pub use preview::*;
pub mod scale_factor_limiting;
pub use scale_factor_limiting::*;

pub mod screen_space_selection;
pub use screen_space_selection::*;
pub mod ColorBasedPicker;
pub use ColorBasedPicker::*;

pub mod select;
pub use select::*;
Expand Down Expand Up @@ -143,6 +143,7 @@ impl Plugin for InteractionPlugin {
.add_plugin(PickingPlugin)
.add_plugin(OutlinePlugin)
.add_plugin(CameraControlsPlugin)
.add_plugin(ColorBasedPicker)
.add_system_set(
SystemSet::on_update(InteractionState::Enable)
.with_system(make_lift_doormat_gizmo)
Expand Down
4 changes: 0 additions & 4 deletions rmf_site_editor/src/site/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ pub use util::*;
pub mod wall;
pub use wall::*;

pub mod camera_capture;
pub use camera_capture::*;

use bevy_points::prelude::PointsPlugin;

use crate::{
Expand Down Expand Up @@ -199,7 +196,6 @@ impl Plugin for SitePlugin {
.add_plugin(RecencyRankingPlugin::<FloorMarker>::default())
.add_plugin(RecencyRankingPlugin::<DrawingMarker>::default())
.add_plugin(DeletionPlugin)
.add_plugin(ImageCopyPlugin)
.add_system(load_site)
.add_system(import_nav_graph)
.add_system_set_to_stage(
Expand Down

0 comments on commit df93732

Please sign in to comment.