Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show layout in blueprint tree view #2465

Merged
merged 20 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"args": [
"build",
"--package=rerun-cli",
"--no-default-features",
"--features=native_viewer"
],
"filter": {
Expand All @@ -49,7 +50,9 @@
"cargo": {
"args": [
"build",
"--package=rerun-cli"
"--package=rerun-cli",
"--no-default-features",
"--features=native_viewer"
],
"filter": {
"name": "rerun",
Expand All @@ -68,7 +71,9 @@
"cargo": {
"args": [
"build",
"--package=rerun-cli"
"--package=rerun-cli",
"--no-default-features",
"--features=native_viewer"
],
"filter": {
"name": "rerun",
Expand Down
64 changes: 35 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,5 @@ debug = true
# If that is not possible, patch to a branch that has a PR open on the upstream repo.
# As a last resport, patch with a commit to our own repository.
# ALWAYS document what PR the commit hash is part of, or when it was merged into the upstream trunk.

egui_tiles = { git = "https://github.com/rerun-io/egui_tiles.git", rev = "bee1b7f69ee1e4b8ddc1d78cd53540545a8f591e" } # TODO: don't merge
2 changes: 0 additions & 2 deletions crates/re_viewport/src/auto_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ enum SplitDirection {
pub(crate) fn tree_from_space_views(
ctx: &mut ViewerContext<'_>,
viewport_size: egui::Vec2,
visible: &std::collections::BTreeSet<SpaceViewId>,
space_views: &BTreeMap<SpaceViewId, SpaceViewBlueprint>,
space_view_states: &HashMap<SpaceViewId, Box<dyn re_viewer_context::SpaceViewState>>,
) -> egui_tiles::Tree<SpaceViewId> {
let mut space_make_infos = space_views
.iter()
.filter(|(space_view_id, _space_view)| visible.contains(space_view_id))
// Sort for determinism:
.sorted_by_key(|(space_view_id, space_view)| {
(
Expand Down
4 changes: 1 addition & 3 deletions crates/re_viewport/src/blueprint_components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ mod space_view;
mod viewport;

pub use space_view::SpaceViewComponent;
pub use viewport::{
AutoSpaceViews, SpaceViewMaximized, SpaceViewVisibility, ViewportLayout, VIEWPORT_PATH,
};
pub use viewport::{AutoSpaceViews, SpaceViewMaximized, ViewportLayout, VIEWPORT_PATH};
36 changes: 5 additions & 31 deletions crates/re_viewport/src/blueprint_components/viewport.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use ahash::HashMap;
use arrow2_convert::{ArrowDeserialize, ArrowField, ArrowSerialize};

use re_log_types::{serde_field::SerdeField, Component, ComponentName};

pub use re_viewer_context::SpaceViewId;

use crate::viewport::VisibilitySet;

pub const VIEWPORT_PATH: &str = "viewport";

/// A flag indicating space views should be automatically populated
Expand All @@ -32,31 +29,6 @@ impl Component for AutoSpaceViews {
}
}

/// The set of currently visible spaces
///
/// ## Example
/// ```
/// # use re_viewport::blueprint_components::SpaceViewVisibility;
/// # use arrow2_convert::field::ArrowField;
/// # use arrow2::datatypes::{DataType, Field};
/// assert_eq!(
/// SpaceViewVisibility::data_type(),
/// DataType::Binary
/// );
/// ```
#[derive(Clone, Default, ArrowField, ArrowSerialize, ArrowDeserialize)]
#[arrow_field(transparent)]
pub struct SpaceViewVisibility(
#[arrow_field(type = "SerdeField<VisibilitySet>")] pub VisibilitySet,
);

impl Component for SpaceViewVisibility {
#[inline]
fn name() -> ComponentName {
"rerun.blueprint.space_view_visibility".into()
}
}

/// Whether a space view is maximized
///
/// ## Example
Expand Down Expand Up @@ -93,7 +65,7 @@ impl Component for SpaceViewMaximized {
/// ViewportLayout::data_type(),
/// DataType::Struct(vec![
/// Field::new("space_view_keys", DataType::Binary, false),
/// Field::new("trees", DataType::Binary, false),
/// Field::new("tree", DataType::Binary, false),
/// Field::new("has_been_user_edited", DataType::Boolean, false),
/// ])
/// );
Expand All @@ -102,8 +74,10 @@ impl Component for SpaceViewMaximized {
pub struct ViewportLayout {
#[arrow_field(type = "SerdeField<std::collections::BTreeSet<SpaceViewId>>")]
pub space_view_keys: std::collections::BTreeSet<SpaceViewId>,
#[arrow_field(type = "SerdeField<HashMap<VisibilitySet, egui_tiles::Tree<SpaceViewId>>>")]
pub trees: HashMap<VisibilitySet, egui_tiles::Tree<SpaceViewId>>,

#[arrow_field(type = "SerdeField<egui_tiles::Tree<SpaceViewId>>")]
pub tree: egui_tiles::Tree<SpaceViewId>,

pub has_been_user_edited: bool,
}

Expand Down
Loading