Skip to content

Commit

Permalink
Merge branch 'main' into grtlr/8437-double-click
Browse files Browse the repository at this point in the history
  • Loading branch information
grtlr committed Dec 16, 2024
2 parents f8e6d80 + dd77aba commit 10e7910
Show file tree
Hide file tree
Showing 12 changed files with 328 additions and 102 deletions.
37 changes: 18 additions & 19 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
[[package]]
name = "ecolor"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"
dependencies = [
"bytemuck",
"color-hex",
Expand All @@ -1951,7 +1951,7 @@ checksum = "18aade80d5e09429040243ce1143ddc08a92d7a22820ac512610410a4dd5214f"
[[package]]
name = "eframe"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"
dependencies = [
"ahash",
"bytemuck",
Expand All @@ -1972,7 +1972,7 @@ dependencies = [
"parking_lot",
"percent-encoding",
"pollster 0.4.0",
"puffin",
"profiling",
"raw-window-handle",
"ron",
"serde",
Expand All @@ -1990,7 +1990,7 @@ dependencies = [
[[package]]
name = "egui"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"
dependencies = [
"accesskit",
"ahash",
Expand All @@ -1999,23 +1999,23 @@ dependencies = [
"epaint",
"log",
"nohash-hasher",
"puffin",
"profiling",
"ron",
"serde",
]

[[package]]
name = "egui-wgpu"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"
dependencies = [
"ahash",
"bytemuck",
"document-features",
"egui",
"epaint",
"log",
"puffin",
"profiling",
"thiserror",
"type-map",
"web-time",
Expand All @@ -2026,14 +2026,14 @@ dependencies = [
[[package]]
name = "egui-winit"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"
dependencies = [
"accesskit_winit",
"ahash",
"arboard",
"egui",
"log",
"puffin",
"profiling",
"raw-window-handle",
"serde",
"smithay-clipboard",
Expand Down Expand Up @@ -2068,7 +2068,7 @@ dependencies = [
[[package]]
name = "egui_extras"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"
dependencies = [
"ahash",
"egui",
Expand All @@ -2077,24 +2077,23 @@ dependencies = [
"image",
"log",
"mime_guess2",
"puffin",
"profiling",
"resvg",
"serde",
]

[[package]]
name = "egui_glow"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"
dependencies = [
"ahash",
"bytemuck",
"egui",
"egui-winit",
"glow 0.16.0",
"log",
"memoffset",
"puffin",
"profiling",
"wasm-bindgen",
"web-sys",
"winit",
Expand All @@ -2103,7 +2102,7 @@ dependencies = [
[[package]]
name = "egui_kittest"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"
dependencies = [
"dify",
"egui",
Expand Down Expand Up @@ -2172,7 +2171,7 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
name = "emath"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"
dependencies = [
"bytemuck",
"serde",
Expand Down Expand Up @@ -2288,7 +2287,7 @@ dependencies = [
[[package]]
name = "epaint"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"
dependencies = [
"ab_glyph",
"ahash",
Expand All @@ -2299,15 +2298,15 @@ dependencies = [
"log",
"nohash-hasher",
"parking_lot",
"puffin",
"profiling",
"rayon",
"serde",
]

[[package]]
name = "epaint_default_fonts"
version = "0.29.1"
source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040"
source = "git+https://github.com/emilk/egui.git?rev=f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b#f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b"

[[package]]
name = "equivalent"
Expand Down
23 changes: 8 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,17 @@ ecolor = "0.29.1"
eframe = { version = "0.29.1", default-features = false, features = [
"accesskit",
"default_fonts",
"puffin",
"wayland",
"x11",
] }
egui = { version = "0.29.1", features = [
"callstack",
"color-hex",
"log",
"puffin",
"rayon",
] }
egui_commonmark = { version = "0.18", default-features = false }
egui_extras = { version = "0.29.1", features = [
"http",
"image",
"puffin",
"serde",
] }
egui_extras = { version = "0.29.1", features = ["http", "image", "serde"] }
egui_kittest = { version = "0.29.1", features = ["wgpu", "snapshot"] }
egui_plot = "0.29.0" # https://github.com/emilk/egui_plot
egui_table = "0.1.0" # https://github.com/rerun-io/egui_table
Expand Down Expand Up @@ -560,13 +553,13 @@ significant_drop_tightening = "allow" # An update of parking_lot made this trigg
# 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.

ecolor = { git = "https://github.com/emilk/egui.git", rev = "13352d606496d7b1c5fd6fcfbe3c85baae39c040" } # egui master 2024-12-09
eframe = { git = "https://github.com/emilk/egui.git", rev = "13352d606496d7b1c5fd6fcfbe3c85baae39c040" } # egui master 2024-12-09
egui = { git = "https://github.com/emilk/egui.git", rev = "13352d606496d7b1c5fd6fcfbe3c85baae39c040" } # egui master 2024-12-09
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "13352d606496d7b1c5fd6fcfbe3c85baae39c040" } # egui master 2024-12-09
egui_kittest = { git = "https://github.com/emilk/egui.git", rev = "13352d606496d7b1c5fd6fcfbe3c85baae39c040" } # egui master 2024-12-09
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "13352d606496d7b1c5fd6fcfbe3c85baae39c040" } # egui master 2024-12-09
emath = { git = "https://github.com/emilk/egui.git", rev = "13352d606496d7b1c5fd6fcfbe3c85baae39c040" } # egui master 2024-12-09
ecolor = { git = "https://github.com/emilk/egui.git", rev = "f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b" } # egui master 2024-12-16
eframe = { git = "https://github.com/emilk/egui.git", rev = "f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b" } # egui master 2024-12-16
egui = { git = "https://github.com/emilk/egui.git", rev = "f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b" } # egui master 2024-12-16
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b" } # egui master 2024-12-16
egui_kittest = { git = "https://github.com/emilk/egui.git", rev = "f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b" } # egui master 2024-12-16
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b" } # egui master 2024-12-16
emath = { git = "https://github.com/emilk/egui.git", rev = "f7efb2186d529ddc9e69f7173c6ae3ae5f403d0b" } # egui master 2024-12-16

# Useful while developing:
# ecolor = { path = "../../egui/crates/ecolor" }
Expand Down
137 changes: 130 additions & 7 deletions crates/store/re_grpc_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ mod address;
pub use address::{InvalidRedapAddress, RedapAddress};
use re_chunk::external::arrow2;
use re_log_types::external::re_types_core::ComponentDescriptor;
use re_types::blueprint::archetypes::{ContainerBlueprint, ViewportBlueprint};
use re_types::blueprint::archetypes::{ViewBlueprint, ViewContents};
use re_types::blueprint::components::{ContainerKind, RootContainer};
use re_types::components::RecordingUri;
use re_types::Component;
use re_types::external::uuid;
use re_types::{Archetype, Component};
use url::Url;

// ----------------------------------------------------------------------------
Expand All @@ -15,10 +19,13 @@ use std::error::Error;

use arrow2::array::Utf8Array as Arrow2Utf8Array;
use arrow2::datatypes::Field as Arrow2Field;
use re_chunk::{Arrow2Array, Chunk, ChunkId, TransportChunk};
use re_chunk::{
Arrow2Array, Chunk, ChunkBuilder, ChunkId, EntityPath, RowId, Timeline, TransportChunk,
};
use re_log_encoding::codec::{wire::decode, CodecError};
use re_log_types::{
ApplicationId, LogMsg, SetStoreInfo, StoreId, StoreInfo, StoreKind, StoreSource, Time,
ApplicationId, BlueprintActivationCommand, EntityPathFilter, LogMsg, SetStoreInfo, StoreId,
StoreInfo, StoreKind, StoreSource, Time,
};
use re_protos::common::v0::RecordingId;
use re_protos::remote_store::v0::{
Expand Down Expand Up @@ -77,6 +84,10 @@ enum StreamError {

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

const CATALOG_BP_STORE_ID: &str = "catalog_blueprint";
const CATALOG_REC_STORE_ID: &str = "catalog";
const CATALOG_APPLICATION_ID: &str = "redap_catalog";

/// Stream an rrd file or metadsasta catalog over gRPC from a Rerun Data Platform server.
///
/// `on_msg` can be used to wake up the UI thread on Wasm.
Expand Down Expand Up @@ -276,11 +287,16 @@ async fn stream_catalog_async(

drop(client);

// We need a whole StoreInfo here.
let store_id = StoreId::from_string(StoreKind::Recording, "catalog".to_owned());
if activate_catalog_blueprint(&tx).is_err() {
re_log::debug!("Failed to activate catalog blueprint");
return Ok(());
}

// Craft the StoreInfo for the actual catalog data
let store_id = StoreId::from_string(StoreKind::Recording, CATALOG_REC_STORE_ID.to_owned());

let store_info = StoreInfo {
application_id: ApplicationId::from("redap_catalog"),
application_id: ApplicationId::from(CATALOG_APPLICATION_ID),
store_id: store_id.clone(),
cloned_from: None,
is_official_example: false,
Expand Down Expand Up @@ -309,7 +325,6 @@ async fn stream_catalog_async(
TransportChunk::CHUNK_METADATA_KEY_ID.to_owned(),
ChunkId::new().to_string(),
);

let mut chunk = Chunk::from_transport(&tc)?;

// enrich catalog data with RecordingUri that's based on the ReDap endpoint (that we know)
Expand Down Expand Up @@ -376,3 +391,111 @@ async fn stream_catalog_async(

Ok(())
}

// Craft a blueprint from relevant chunks and activate it
// TODO(zehiko) - manual crafting of the blueprint as we have below will go away and be replaced
// by either a blueprint crafted using rust Blueprint API or a blueprint fetched from ReDap (#8470)
fn activate_catalog_blueprint(
tx: &re_smart_channel::Sender<LogMsg>,
) -> Result<(), Box<dyn std::error::Error>> {
let blueprint_store_id =
StoreId::from_string(StoreKind::Blueprint, CATALOG_BP_STORE_ID.to_owned());
let blueprint_store_info = StoreInfo {
application_id: ApplicationId::from(CATALOG_APPLICATION_ID),
store_id: blueprint_store_id.clone(),
cloned_from: None,
is_official_example: false,
started: Time::now(),
store_source: StoreSource::Unknown,
store_version: None,
};

if tx
.send(LogMsg::SetStoreInfo(SetStoreInfo {
row_id: *re_chunk::RowId::new(),
info: blueprint_store_info,
}))
.is_err()
{
re_log::debug!("Receiver disconnected");
return Ok(());
}

let timepoint = [(Timeline::new_sequence("blueprint"), 1)];

let vb = ViewBlueprint::new("Dataframe")
.with_visible(true)
.with_space_origin("/");

// TODO(zehiko) we shouldn't really be creating all these ids and entity paths manually... (#8470)
let view_uuid = uuid::Uuid::new_v4();
let view_entity_path = format!("/view/{view_uuid}");
let view_chunk = ChunkBuilder::new(ChunkId::new(), view_entity_path.clone().into())
.with_archetype(RowId::new(), timepoint, &vb)
.build()?;

let epf = EntityPathFilter::parse_forgiving("/**", &Default::default());
let vc = ViewContents::new(epf.iter_expressions());
let view_contents_chunk = ChunkBuilder::new(
ChunkId::new(),
format!(
"{}/{}",
view_entity_path.clone(),
ViewContents::name().short_name()
)
.into(),
)
.with_archetype(RowId::new(), timepoint, &vc)
.build()?;

let rc = ContainerBlueprint::new(ContainerKind::Grid)
.with_contents(&[EntityPath::from(view_entity_path)])
.with_visible(true);

let container_uuid = uuid::Uuid::new_v4();
let container_chunk = ChunkBuilder::new(
ChunkId::new(),
format!("/container/{container_uuid}").into(),
)
.with_archetype(RowId::new(), timepoint, &rc)
.build()?;

let vp = ViewportBlueprint::new().with_root_container(RootContainer(container_uuid.into()));
let viewport_chunk = ChunkBuilder::new(ChunkId::new(), "/viewport".into())
.with_archetype(RowId::new(), timepoint, &vp)
.build()?;

for chunk in &[
view_chunk,
view_contents_chunk,
container_chunk,
viewport_chunk,
] {
if tx
.send(LogMsg::ArrowMsg(
blueprint_store_id.clone(),
chunk.to_arrow_msg()?,
))
.is_err()
{
re_log::debug!("Receiver disconnected");
return Ok(());
}
}

let blueprint_activation = BlueprintActivationCommand {
blueprint_id: blueprint_store_id.clone(),
make_active: true,
make_default: true,
};

if tx
.send(LogMsg::BlueprintActivationCommand(blueprint_activation))
.is_err()
{
re_log::debug!("Receiver disconnected");
return Ok(());
}

Ok(())
}
Loading

0 comments on commit 10e7910

Please sign in to comment.