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

[pure refactor] Separate viewport related files out to a new re_viewport crate #2251

Merged
merged 8 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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