Skip to content

Commit

Permalink
Don't include the camera part in a 2D scene
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Oct 11, 2023
1 parent e021608 commit 94a0903
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/re_space_view_spatial/src/contexts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl ViewContextSystem for PrimitiveCounter {
}
}

pub fn register_contexts(
pub fn register_spatial_contexts(
system_registry: &mut re_viewer_context::SpaceViewSystemRegistry,
) -> Result<(), SpaceViewClassRegistryError> {
system_registry.register_context_system::<TransformContext>()?;
Expand Down
21 changes: 20 additions & 1 deletion crates/re_space_view_spatial/src/parts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,26 @@ pub type Keypoints = HashMap<(re_types::components::ClassId, i64), HashMap<Keypo
pub const SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES: f32 = 1.5;
pub const SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES: f32 = 2.5;

pub fn register_parts(
pub fn register_2d_spatial_parts(
system_registry: &mut SpaceViewSystemRegistry,
) -> Result<(), SpaceViewClassRegistryError> {
// Note: 2D spatial systems don't include cameras as this
// part only shows a 2D projection WITHIN a 3D view.
system_registry.register_part_system::<arrows3d::Arrows3DPart>()?;
system_registry.register_part_system::<assets3d::Asset3DPart>()?;
system_registry.register_part_system::<boxes2d::Boxes2DPart>()?;
system_registry.register_part_system::<boxes3d::Boxes3DPart>()?;
system_registry.register_part_system::<images::ImagesPart>()?;
system_registry.register_part_system::<lines2d::Lines2DPart>()?;
system_registry.register_part_system::<lines3d::Lines3DPart>()?;
system_registry.register_part_system::<meshes::Mesh3DPart>()?;
system_registry.register_part_system::<points2d::Points2DPart>()?;
system_registry.register_part_system::<points3d::Points3DPart>()?;
system_registry.register_part_system::<transform3d_arrows::Transform3DArrowsPart>()?;
Ok(())
}

pub fn register_3d_spatial_parts(
system_registry: &mut SpaceViewSystemRegistry,
) -> Result<(), SpaceViewClassRegistryError> {
system_registry.register_part_system::<arrows3d::Arrows3DPart>()?;
Expand Down
9 changes: 5 additions & 4 deletions crates/re_space_view_spatial/src/space_view_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use re_viewer_context::{
};

use crate::{
contexts::{register_contexts, PrimitiveCounter},
contexts::{register_spatial_contexts, PrimitiveCounter},
heuristics::{auto_spawn_heuristic, update_object_property_heuristics},
parts::{calculate_bounding_box, register_parts},
parts::{calculate_bounding_box, register_2d_spatial_parts},
ui::SpatialSpaceViewState,
view_kind::SpatialSpaceViewKind,
};
Expand All @@ -35,8 +35,9 @@ impl SpaceViewClass for SpatialSpaceView2D {
&self,
system_registry: &mut re_viewer_context::SpaceViewSystemRegistry,
) -> Result<(), SpaceViewClassRegistryError> {
register_contexts(system_registry)?;
register_parts(system_registry)?;
register_spatial_contexts(system_registry)?;
register_2d_spatial_parts(system_registry)?;

Ok(())
}

Expand Down
9 changes: 5 additions & 4 deletions crates/re_space_view_spatial/src/space_view_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use re_viewer_context::{
};

use crate::{
contexts::{register_contexts, PrimitiveCounter},
contexts::{register_spatial_contexts, PrimitiveCounter},
heuristics::{auto_spawn_heuristic, update_object_property_heuristics},
parts::{calculate_bounding_box, register_parts, CamerasPart},
parts::{calculate_bounding_box, register_3d_spatial_parts, CamerasPart},
ui::SpatialSpaceViewState,
view_kind::SpatialSpaceViewKind,
};
Expand All @@ -35,8 +35,9 @@ impl SpaceViewClass for SpatialSpaceView3D {
&self,
system_registry: &mut re_viewer_context::SpaceViewSystemRegistry,
) -> Result<(), SpaceViewClassRegistryError> {
register_contexts(system_registry)?;
register_parts(system_registry)?;
register_spatial_contexts(system_registry)?;
register_3d_spatial_parts(system_registry)?;

Ok(())
}

Expand Down

0 comments on commit 94a0903

Please sign in to comment.