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

Initial Space View trait & port of text space views to the new Space View trait system #2281

Merged
merged 33 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
507246d
very first draft of space view type
Wumpf May 29, 2023
33c5418
implementation utility tratis
Wumpf May 29, 2023
a705d7d
Add re_space_view crate
Wumpf May 29, 2023
e77a7a7
move new space view types to new space view crate
Wumpf May 29, 2023
2299782
wip
Wumpf May 30, 2023
19e2265
add space view type registry
Wumpf May 30, 2023
e98818a
space view type registry, move text box over
Wumpf May 30, 2023
15f29bd
move space view types & registry to viewer context
Wumpf May 30, 2023
36505a5
rename space view types to space view class
Wumpf May 30, 2023
3191b7a
put the space view class registry on the viewer context
Wumpf May 30, 2023
0a7781b
traitify text space view
Wumpf May 30, 2023
3a5868d
move text box space view to its own crate again
Wumpf May 30, 2023
9de1cf0
Merge remote-tracking branch 'origin/main' into andreas/space-view-trait
Wumpf May 30, 2023
046e3f2
fix creating wrong space view state
Wumpf May 30, 2023
7ca3e80
use icon and name from space view classes
Wumpf May 30, 2023
13a7b12
doc improvements
Wumpf May 30, 2023
602ba29
easier SceneElement implementation
Wumpf May 30, 2023
7f0cf61
more powerful space view trait impl helper
Wumpf May 30, 2023
66203de
doc string fix
Wumpf May 30, 2023
5ae6c24
update publish script
Wumpf May 30, 2023
519ecd2
comment out error for failed space view state creation for the time b…
Wumpf May 30, 2023
cc6d978
fix incorrect typenames on text space views
Wumpf May 30, 2023
9720945
Merge remote-tracking branch 'origin/main' into andreas/space-view-trait
Wumpf May 30, 2023
c1929b4
remove unnecessary dependencies
Wumpf May 30, 2023
f9e36dc
remove accidentally added experimentation file
Wumpf May 30, 2023
a5cd7af
whitespace fix
Wumpf May 30, 2023
b397658
fix re_space_view_text description
Wumpf May 31, 2023
e26d3a9
Merge remote-tracking branch 'origin/main' into andreas/space-view-trait
Wumpf May 31, 2023
a2a0455
fix incorrect helptext for text view
Wumpf May 31, 2023
c99570c
remove unnecessary puffin dependency
Wumpf May 31, 2023
6140abf
use vec1 for archetype definition, rename class_name_from_category, f…
Wumpf May 31, 2023
8502ae2
comment on the why of of scene_element_list
Wumpf May 31, 2023
c8e0d67
better profiling scope labels
Wumpf May 31, 2023
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
36 changes: 35 additions & 1 deletion 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 @@ -44,6 +44,8 @@ re_renderer = { path = "crates/re_renderer", version = "0.7.0-alpha.0", default-
re_sdk = { path = "crates/re_sdk", version = "0.7.0-alpha.0", default-features = false }
re_sdk_comms = { path = "crates/re_sdk_comms", version = "0.7.0-alpha.0", default-features = false }
re_smart_channel = { path = "crates/re_smart_channel", version = "0.7.0-alpha.0", default-features = false }
re_space_view_text = { path = "crates/re_space_view_text", version = "0.7.0-alpha.0", default-features = false }
re_space_view_text_box = { path = "crates/re_space_view_text_box", version = "0.7.0-alpha.0", default-features = false }
re_string_interner = { path = "crates/re_string_interner", version = "0.7.0-alpha.0", default-features = false }
re_tensor_ops = { path = "crates/re_tensor_ops", version = "0.7.0-alpha.0", default-features = false }
re_time_panel = { path = "crates/re_time_panel", version = "=0.7.0-alpha.0", default-features = false }
Expand Down
33 changes: 33 additions & 0 deletions crates/re_space_view_text/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
authors.workspace = true
description = "Provides Rerun Space Views that display text only."
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
edition.workspace = true
homepage.workspace = true
license.workspace = true
name = "re_space_view_text"
publish = true
readme = "README.md"
repository.workspace = true
rust-version.workspace = true
version.workspace = true
include = ["../../LICENSE-APACHE", "../../LICENSE-MIT", "**/*.rs", "Cargo.toml"]

[package.metadata.docs.rs]
all-features = true

[dependencies]
re_arrow_store.workspace = true
re_components.workspace = true
re_data_store.workspace = true
re_data_ui.workspace = true
re_log_types.workspace = true
re_log.workspace = true
re_query.workspace = true
re_ui.workspace = true
re_viewer_context.workspace = true

egui.workspace = true
egui_extras.workspace = true

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
puffin.workspace = true
10 changes: 10 additions & 0 deletions crates/re_space_view_text/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# re_space_view_text

Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates.

[![Latest version](https://img.shields.io/crates/v/re_space_view_text.svg)](https://crates.io/crates/re_space_view_text)
[![Documentation](https://docs.rs/re_space_view_text/badge.svg)](https://docs.rs/re_space_view_text)
![MIT](https://img.shields.io/badge/license-MIT-blue.svg)
![Apache](https://img.shields.io/badge/license-Apache-blue.svg)

Provides Rerun Space Views that display text only.
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
30 changes: 30 additions & 0 deletions crates/re_space_view_text/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//! Rerun Text Space Views
//!
//! Provides Rerun Space Views that deal with text only.
Wumpf marked this conversation as resolved.
Show resolved Hide resolved

mod scene_element;
mod space_view_class;

pub use space_view_class::TextSpaceView;

// ---------------------------------------------------------------------------

/// Profiling macro for feature "puffin"
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
#[doc(hidden)]
#[macro_export]
macro_rules! profile_function {
($($arg: tt)*) => {
#[cfg(not(target_arch = "wasm32"))]
puffin::profile_function!($($arg)*);
};
}

/// Profiling macro for feature "puffin"
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
#[doc(hidden)]
#[macro_export]
macro_rules! profile_scope {
($($arg: tt)*) => {
#[cfg(not(target_arch = "wasm32"))]
puffin::profile_scope!($($arg)*);
};
}
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ use re_arrow_store::TimeRange;
use re_data_store::EntityPath;
use re_log_types::{Component as _, InstanceKey, RowId};
use re_query::{range_entity_with_primary, QueryError};
use re_viewer_context::{SceneQuery, ViewerContext};
use re_viewer_context::{ArchetypeDefinition, SceneElementImpl, SceneQuery, ViewerContext};

use super::ui::ViewTextFilters;

// ---
use super::space_view_class::TextSpaceViewState;

#[derive(Debug, Clone)]
pub struct TextEntry {
Expand All @@ -31,24 +29,27 @@ pub struct SceneText {
pub text_entries: Vec<TextEntry>,
}

impl SceneText {
/// Loads all text components into the scene according to the given query.
pub(crate) fn load(
impl SceneElementImpl for SceneText {
type State = TextSpaceViewState;

fn archetype(&self) -> ArchetypeDefinition {
vec![re_components::TextEntry::name()]
}

fn populate(
&mut self,
ctx: &ViewerContext<'_>,
ctx: &mut ViewerContext<'_>,
query: &SceneQuery<'_>,
filters: &ViewTextFilters,
state: &TextSpaceViewState,
) {
crate::profile_function!();

let store = &ctx.log_db.entity_db.data_store;

for entity_path in query.entity_paths {
let ent_path = entity_path;

// Early filtering: if we're not showing it the view, there isn't much point
// in querying it to begin with... at least for now.
if !filters.is_entity_path_visible(ent_path) {
if !state.filters.is_entity_path_visible(ent_path) {
return;
}

Expand Down Expand Up @@ -76,7 +77,7 @@ impl SceneText {
// Early filtering once more, see above.
let is_visible = level
.as_ref()
.map_or(true, |lvl| filters.is_log_level_visible(lvl));
.map_or(true, |lvl| state.filters.is_log_level_visible(lvl));

if is_visible {
self.text_entries.push(TextEntry {
Expand All @@ -98,4 +99,8 @@ impl SceneText {
}
}
}

fn as_any(&self) -> &dyn std::any::Any {
self
}
}
Loading