Skip to content

Commit

Permalink
[pure refactor] Separate viewport related files out to a new re_viewp…
Browse files Browse the repository at this point in the history
…ort crate (#2251)

<!--
Open the PR up as a draft until you feel it is ready for a proper
review.

Do not make PR:s from your own `main` branch, as that makes it difficult
for reviewers to add their own fixes.

Add any improvements to the branch as new commits to make it easier for
reviewers to follow the progress. All commits will be squashed to a
single commit once the PR is merged into `main`.

Make sure you mention any issues that this PR closes in the description,
as well as any other related issues.

To get an auto-generated PR description you can put "copilot:summary" or
"copilot:walkthrough" anywhere.
-->

### What

First step towards:
* #2249 

and getting close to finish of:
* #1873 

This PR moves almost everything viewport related out to a separate crate
that is eclipses the `re_viewer` package in size now. In upcoming steps
space view definition will be separated out of this new crate in turn.
Also, blueprint things will likely need a new home as well similar to
`re_log_types`. But one thing after the other :)

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2251
  • Loading branch information
Wumpf authored May 29, 2023
1 parent e1f0e39 commit 00a7030
Show file tree
Hide file tree
Showing 77 changed files with 414 additions and 445 deletions.
71 changes: 46 additions & 25 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ re_tuid = { path = "crates/re_tuid", version = "0.7.0-alpha.0", default-features
re_ui = { path = "crates/re_ui", version = "0.7.0-alpha.0", default-features = false }
re_viewer = { path = "crates/re_viewer", version = "0.7.0-alpha.0", default-features = false }
re_viewer_context = { path = "crates/re_viewer_context", version = "0.7.0-alpha.0", default-features = false }
re_viewport = { path = "crates/re_viewport", version = "0.7.0-alpha.0", default-features = false }
re_web_viewer_server = { path = "crates/re_web_viewer_server", version = "0.7.0-alpha.0", default-features = false }
re_ws_comms = { path = "crates/re_ws_comms", version = "0.7.0-alpha.0", default-features = false }
rerun = { path = "crates/rerun", version = "0.7.0-alpha.0", default-features = false }
Expand Down
21 changes: 21 additions & 0 deletions crates/re_arrow_store/src/store_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,27 @@ impl DataStore {
component
}

/// Call `query_latest_component` at the given path, walking up the hierarchy until an instance is found.
pub fn query_latest_component_at_closest_ancestor<C: DeserializableComponent>(
&self,
entity_path: &EntityPath,
query: &LatestAtQuery,
) -> Option<(EntityPath, C)>
where
for<'b> &'b C::ArrayType: IntoIterator,
{
crate::profile_function!();

let mut cur_path = Some(entity_path.clone());
while let Some(path) = cur_path {
if let Some(component) = self.query_latest_component::<C>(&path, query) {
return Some((path, component));
}
cur_path = path.parent();
}
None
}

/// Get the latest value for a given [`re_log_types::Component`], assuming it is timeless.
///
/// This assumes that the row we get from the store only contains a single instance for this
Expand Down
28 changes: 3 additions & 25 deletions crates/re_viewer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,15 @@ re_data_ui.workspace = true
re_error.workspace = true
re_format.workspace = true
re_log_encoding = { workspace = true, features = ["decoder", "encoder"] }
re_log_types = { workspace = true, features = ["ecolor", "glam", "image"] }
re_log_types = { workspace = true, features = ["ecolor", "image"] }
re_log.workspace = true
re_memory.workspace = true
re_query.workspace = true
re_renderer = { workspace = true, default-features = false, features = [
"arrow",
"import-gltf",
"import-obj",
"serde",
] }
re_renderer = { workspace = true, default-features = false }
re_smart_channel.workspace = true
re_tensor_ops.workspace = true
re_time_panel.workspace = true
re_ui = { workspace = true, features = ["eframe"] }
re_viewer_context.workspace = true
re_viewport.workspace = true
re_ws_comms = { workspace = true, features = ["client"] }

# Internal (optional):
Expand All @@ -71,7 +65,6 @@ ahash.workspace = true
anyhow.workspace = true
arrow2.workspace = true
arrow2_convert.workspace = true
bytemuck = { version = "1.11", features = ["extern_crate_alloc"] }
cfg-if.workspace = true
eframe = { workspace = true, default-features = false, features = [
"default_fonts",
Expand All @@ -80,30 +73,15 @@ eframe = { workspace = true, default-features = false, features = [
"wgpu",
] }
egui.workspace = true
egui_extras.workspace = true
egui_tiles.workspace = true
egui-wgpu.workspace = true
enumset.workspace = true
glam = { workspace = true, features = [
"mint",
] } # can't update glam until a new version of `macaw` is released
half.workspace = true
image = { workspace = true, default-features = false, features = [
"jpeg",
"png",
] }
itertools = { workspace = true }
lazy_static.workspace = true
macaw = { workspace = true, features = ["with_serde"] }
ndarray = "0.15"
nohash-hasher = "0.2"
poll-promise = "0.2"
rfd.workspace = true
rmp-serde = { version = "1.1" }
serde = { version = "1", features = ["derive"] }
slotmap.workspace = true
smallvec = { workspace = true, features = ["serde"] }
thiserror.workspace = true
time = { workspace = true, features = ["formatting"] }
web-time.workspace = true
wgpu.workspace = true
Expand Down
6 changes: 2 additions & 4 deletions crates/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use anyhow::Context;
use egui::NumExt as _;
use itertools::Itertools as _;
use poll_promise::Promise;
use re_viewport::ViewportState;
use web_time::Instant;

use re_arrow_store::{DataStoreConfig, DataStoreStats};
Expand All @@ -18,10 +19,7 @@ use re_viewer_context::{
AppOptions, Caches, ComponentUiRegistry, PlayState, RecordingConfig, ViewerContext,
};

use crate::{
ui::{Blueprint, ViewportState},
viewer_analytics::ViewerAnalytics,
};
use crate::{ui::Blueprint, viewer_analytics::ViewerAnalytics};

#[cfg(not(target_arch = "wasm32"))]
use re_log_types::TimeRangeF;
Expand Down
5 changes: 1 addition & 4 deletions crates/re_viewer/src/blueprint_components/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//! Potentially user-facing components to be used in blueprints.
// TODO(jleibs): These should live in their own crate so we don't need a
// viewer dep in order to make use of them.
pub mod panel;
pub mod space_view;
pub mod viewport;
10 changes: 3 additions & 7 deletions crates/re_viewer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@
mod app;
pub mod blueprint_components;
pub mod env_vars;
pub mod math;
mod misc;
#[cfg(not(target_arch = "wasm32"))]
mod profiler;
mod remote_viewer_app;
mod ui;
mod viewer_analytics;

pub(crate) use misc::mesh_loader;
use re_log_types::PythonVersion;
pub(crate) use ui::{memory_panel, selection_panel};

// TODO(jleibs): Do we want to expose this
pub use ui::{SpaceViewBlueprint, ViewCategory};

pub use app::{App, StartupOptions};
pub use remote_viewer_app::RemoteViewerApp;

Expand All @@ -37,7 +33,7 @@ mod native;
pub use native::{run_native_app, run_native_viewer_with_messages};

#[cfg(not(target_arch = "wasm32"))]
pub use misc::profiler::Profiler;
pub use profiler::Profiler;

// ----------------------------------------------------------------------------
// When compiling for web:
Expand Down
Loading

0 comments on commit 00a7030

Please sign in to comment.