From 1aa3427539f7cdc69ac36258031489eb1a9f67d0 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Mon, 9 Dec 2024 16:27:05 +0100 Subject: [PATCH 01/71] Fix various doc links in SDKs (#8331) PR title is an accompanying changelog entry, but the real thing here is all about codegen fixes: * use `reporter` for doc issues * make `reporter` output colored * support field & enum links - this is a bit limited depending on the language. Experimented a bit, but deemed this now good enough. We don't use those often anyways * fix links * disable warnings for python autogen serialization being available when a custom one is present - in all cases we have the custom serialization there for a good reason or aren't entirely sure if it would break something --- Cargo.lock | 1 + Cargo.toml | 1 + crates/build/re_types_builder/Cargo.toml | 1 + .../src/codegen/cpp/method.rs | 10 +- .../re_types_builder/src/codegen/cpp/mod.rs | 58 ++-- .../re_types_builder/src/codegen/docs/mod.rs | 24 +- .../src/codegen/python/mod.rs | 35 ++- .../src/codegen/python/views.rs | 2 +- .../re_types_builder/src/codegen/rust/api.rs | 2 +- .../re_types_builder/src/codegen/rust/util.rs | 2 +- crates/build/re_types_builder/src/docs.rs | 286 +++++++++++++++--- crates/build/re_types_builder/src/objects.rs | 8 +- crates/build/re_types_builder/src/report.rs | 36 ++- .../rerun/archetypes/graph_edges.fbs | 2 +- .../rerun/blueprint/archetypes/background.fbs | 3 +- .../archetypes/container_blueprint.fbs | 10 +- .../components/visualizer_overrides.fbs | 23 -- .../rerun/components/fill_mode.fbs | 4 +- .../rerun/datatypes/pixel_format.fbs | 2 +- .../re_types/src/archetypes/graph_edges.rs | 4 +- .../src/blueprint/archetypes/background.rs | 4 +- .../re_types/src/components/fill_mode.rs | 8 +- .../src/components/transform_relation.rs | 4 +- .../re_types/src/datatypes/pixel_format.rs | 8 +- .../archetypes/container_blueprint.rs | 20 +- .../components/visualizer_overrides.rs | 23 -- crates/viewer/re_viewer/src/reflection/mod.rs | 12 +- .../reference/types/components/fill_mode.md | 4 +- .../reference/types/datatypes/pixel_format.md | 2 +- .../reference/types/views/spatial2d_view.md | 2 +- .../reference/types/views/spatial3d_view.md | 2 +- .../src/rerun/archetypes/graph_edges.hpp | 4 +- .../rerun/blueprint/archetypes/background.hpp | 4 +- .../archetypes/container_blueprint.hpp | 20 +- .../components/visualizer_overrides.hpp | 23 -- rerun_cpp/src/rerun/components/fill_mode.hpp | 4 +- .../src/rerun/datatypes/pixel_format.hpp | 2 +- .../rerun_sdk/rerun/archetypes/graph_edges.py | 4 +- .../rerun/blueprint/archetypes/background.py | 2 +- .../archetypes/container_blueprint.py | 20 +- .../rerun_sdk/rerun/components/fill_mode.py | 4 +- .../rerun_sdk/rerun/datatypes/pixel_format.py | 2 +- 42 files changed, 443 insertions(+), 249 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43fd11e10b84..cba234963c38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6679,6 +6679,7 @@ dependencies = [ "arrow", "camino", "clang-format", + "colored", "flatbuffers", "indent", "itertools 0.13.0", diff --git a/Cargo.toml b/Cargo.toml index 3a0ad88ae8cd..ab7e374f6c69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -176,6 +176,7 @@ cfg-if = "1.0" clang-format = "0.3" clap = "4.0" clean-path = "0.2" +colored = "2.1" comfy-table = { version = "7.0", default-features = false } console_error_panic_hook = "0.1.6" convert_case = "0.6" diff --git a/crates/build/re_types_builder/Cargo.toml b/crates/build/re_types_builder/Cargo.toml index 088c7ba16473..c14049d90f1e 100644 --- a/crates/build/re_types_builder/Cargo.toml +++ b/crates/build/re_types_builder/Cargo.toml @@ -38,6 +38,7 @@ arrow.workspace = true arrow2 = { workspace = true, features = ["arrow"] } camino.workspace = true clang-format.workspace = true +colored.workspace = true flatbuffers.workspace = true indent.workspace = true itertools.workspace = true diff --git a/crates/build/re_types_builder/src/codegen/cpp/method.rs b/crates/build/re_types_builder/src/codegen/cpp/method.rs index 3994f52de4ab..b54beb419654 100644 --- a/crates/build/re_types_builder/src/codegen/cpp/method.rs +++ b/crates/build/re_types_builder/src/codegen/cpp/method.rs @@ -1,7 +1,7 @@ use proc_macro2::TokenStream; use quote::quote; -use crate::{Docs, Objects}; +use crate::{Docs, Objects, Reporter}; use super::{lines_from_docs, quote_doc_comment, quote_doc_lines, NEWLINE_TOKEN}; @@ -78,14 +78,14 @@ impl From<&str> for MethodDocumentation { } impl MethodDocumentation { - fn quoted(&self, objects: &Objects) -> TokenStream { + fn quoted(&self, reporter: &Reporter, objects: &Objects) -> TokenStream { match self { Self::None => { quote!() } Self::String(s) => quote_doc_comment(s), Self::Docs(docs) => { - let lines = lines_from_docs(objects, docs); + let lines = lines_from_docs(reporter, objects, docs); quote_doc_lines(&lines) } } @@ -112,7 +112,7 @@ impl Default for Method { } impl Method { - pub fn to_hpp_tokens(&self, objects: &Objects) -> TokenStream { + pub fn to_hpp_tokens(&self, reporter: &Reporter, objects: &Objects) -> TokenStream { let Self { docs, declaration, @@ -120,7 +120,7 @@ impl Method { inline: is_inline, } = self; - let docs = docs.quoted(objects); + let docs = docs.quoted(reporter, objects); let declaration = declaration.to_hpp_tokens(); if *is_inline { quote! { diff --git a/crates/build/re_types_builder/src/codegen/cpp/mod.rs b/crates/build/re_types_builder/src/codegen/cpp/mod.rs index a1c3a0d98935..dd41590729a6 100644 --- a/crates/build/re_types_builder/src/codegen/cpp/mod.rs +++ b/crates/build/re_types_builder/src/codegen/cpp/mod.rs @@ -409,12 +409,14 @@ impl QuotedObject { match obj.class { ObjectClass::Struct => match obj.kind { ObjectKind::Datatype | ObjectKind::Component => Ok(Self::from_struct( + reporter, objects, obj, hpp_includes, hpp_type_extensions, )), ObjectKind::Archetype => Ok(Self::from_archetype( + reporter, objects, obj, hpp_includes, @@ -429,9 +431,10 @@ impl QuotedObject { if !hpp_type_extensions.is_empty() { reporter.error(&obj.virtpath, &obj.fqname, "C++ enums cannot have type extensions, because C++ enums doesn't support member functions"); } - Ok(Self::from_enum(objects, obj, hpp_includes)) + Ok(Self::from_enum(reporter, objects, obj, hpp_includes)) } ObjectClass::Union => Ok(Self::from_union( + reporter, objects, obj, hpp_includes, @@ -441,13 +444,14 @@ impl QuotedObject { } fn from_archetype( + reporter: &Reporter, objects: &Objects, obj: &Object, mut hpp_includes: Includes, hpp_type_extensions: &TokenStream, ) -> Self { let type_ident = obj.ident(); - let quoted_docs = quote_obj_docs(objects, obj); + let quoted_docs = quote_obj_docs(reporter, objects, obj); let mut cpp_includes = Includes::new(obj.fqname.clone(), obj.scope()); cpp_includes.insert_rerun("collection_adapter_builtins.hpp"); @@ -458,7 +462,7 @@ impl QuotedObject { .fields .iter() .map(|obj_field| { - let docstring = quote_field_docs(objects, obj_field); + let docstring = quote_field_docs(reporter, objects, obj_field); let field_name = field_name_identifier(obj_field); let field_type = quote_archetype_field_type(&mut hpp_includes, obj_field); let field_type = if obj_field.is_nullable { @@ -549,11 +553,11 @@ impl QuotedObject { }; let serialize_method = archetype_serialize(&type_ident, obj, &mut hpp_includes); - let serialize_hpp = serialize_method.to_hpp_tokens(objects); + let serialize_hpp = serialize_method.to_hpp_tokens(reporter, objects); let serialize_cpp = serialize_method.to_cpp_tokens("e!(AsComponents<#quoted_namespace::#type_ident>)); - let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens(objects)); + let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens(reporter, objects)); let methods_cpp = methods .iter() .map(|m| m.to_cpp_tokens("e!(#type_ident))); @@ -648,6 +652,7 @@ impl QuotedObject { } fn from_struct( + reporter: &Reporter, objects: &Objects, obj: &Object, mut hpp_includes: Includes, @@ -663,7 +668,7 @@ impl QuotedObject { }; let type_ident = obj.ident(); - let quoted_docs = quote_obj_docs(objects, obj); + let quoted_docs = quote_obj_docs(reporter, objects, obj); let deprecation_notice = quote_deprecation_notice(obj); let mut cpp_includes = Includes::new(obj.fqname.clone(), obj.scope()); @@ -674,6 +679,7 @@ impl QuotedObject { .iter() .map(|obj_field| { let declaration = quote_variable_with_docstring( + reporter, objects, &mut hpp_includes, obj_field, @@ -721,9 +727,10 @@ impl QuotedObject { } } - let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens(objects)); + let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens(reporter, objects)); let (hpp_loggable, cpp_loggable) = quote_loggable_hpp_and_cpp( + reporter, obj, objects, &mut hpp_includes, @@ -776,6 +783,7 @@ impl QuotedObject { } fn from_union( + reporter: &Reporter, objects: &Objects, obj: &Object, mut hpp_includes: Includes, @@ -815,7 +823,7 @@ impl QuotedObject { let pascal_case_name = &obj.name; let pascal_case_ident = obj.ident(); - let quoted_docs = quote_obj_docs(objects, obj); + let quoted_docs = quote_obj_docs(reporter, objects, obj); let deprecation_notice = quote_deprecation_notice(obj); let tag_typename = format_ident!("{pascal_case_name}Tag"); @@ -853,6 +861,7 @@ impl QuotedObject { .filter(|obj_field| obj_field.typ != Type::Unit) .map(|obj_field| { let declaration = quote_variable_with_docstring( + reporter, objects, &mut hpp_includes, obj_field, @@ -1092,6 +1101,7 @@ impl QuotedObject { let hide_from_docs_comment = quote_hide_from_docs(); let (hpp_loggable, cpp_loggable) = quote_loggable_hpp_and_cpp( + reporter, obj, objects, &mut hpp_includes, @@ -1099,7 +1109,7 @@ impl QuotedObject { &mut hpp_declarations, ); - let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens(objects)); + let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens(reporter, objects)); let hpp = quote! { #hpp_includes @@ -1211,7 +1221,12 @@ impl QuotedObject { } // C-style enum - fn from_enum(objects: &Objects, obj: &Object, mut hpp_includes: Includes) -> Self { + fn from_enum( + reporter: &Reporter, + objects: &Objects, + obj: &Object, + mut hpp_includes: Includes, + ) -> Self { // We use a simple `enum class`, which is a type-safe enum. // They don't support methods, but we don't need them, // since `Loggable` is implemented outside the type. @@ -1226,7 +1241,7 @@ impl QuotedObject { }; let type_ident = obj.ident(); - let quoted_docs = quote_obj_docs(objects, obj); + let quoted_docs = quote_obj_docs(reporter, objects, obj); let deprecation_notice = quote_deprecation_notice(obj); let mut cpp_includes = Includes::new(obj.fqname.clone(), obj.scope()); @@ -1237,7 +1252,7 @@ impl QuotedObject { .iter() .map(|obj_field| { let enum_value = obj_field.enum_value.unwrap(); - let docstring = quote_field_docs(objects, obj_field); + let docstring = quote_field_docs(reporter, objects, obj_field); let field_name = field_name_identifier(obj_field); // We assign the arrow type index to the enum fields to make encoding simpler and faster: @@ -1252,6 +1267,7 @@ impl QuotedObject { .collect_vec(); let (hpp_loggable, cpp_loggable) = quote_loggable_hpp_and_cpp( + reporter, obj, objects, &mut hpp_includes, @@ -2201,6 +2217,7 @@ fn quote_archetype_field_type(hpp_includes: &mut Includes, obj_field: &ObjectFie } fn quote_variable_with_docstring( + reporter: &Reporter, objects: &Objects, includes: &mut Includes, obj_field: &ObjectField, @@ -2208,7 +2225,7 @@ fn quote_variable_with_docstring( ) -> TokenStream { let quoted = quote_variable(includes, obj_field, name); - let docstring = quote_field_docs(objects, obj_field); + let docstring = quote_field_docs(reporter, objects, obj_field); let quoted = quote! { #docstring @@ -2318,8 +2335,8 @@ fn quote_fqname_as_type_path(includes: &mut Includes, fqname: &str) -> TokenStre quote!(#expr) } -fn quote_obj_docs(objects: &Objects, obj: &Object) -> TokenStream { - let mut lines = lines_from_docs(objects, &obj.docs); +fn quote_obj_docs(reporter: &Reporter, objects: &Objects, obj: &Object) -> TokenStream { + let mut lines = lines_from_docs(reporter, objects, &obj.docs); if let Some(first_line) = lines.first_mut() { // Prefix with object kind: @@ -2336,13 +2353,13 @@ fn quote_obj_docs(objects: &Objects, obj: &Object) -> TokenStream { quote_doc_lines(&lines) } -fn quote_field_docs(objects: &Objects, field: &ObjectField) -> TokenStream { - let lines = lines_from_docs(objects, &field.docs); +fn quote_field_docs(reporter: &Reporter, objects: &Objects, field: &ObjectField) -> TokenStream { + let lines = lines_from_docs(reporter, objects, &field.docs); quote_doc_lines(&lines) } -fn lines_from_docs(objects: &Objects, docs: &Docs) -> Vec { - let mut lines = docs.lines_for(objects, Target::Cpp); +fn lines_from_docs(reporter: &Reporter, objects: &Objects, docs: &Docs) -> Vec { + let mut lines = docs.lines_for(reporter, objects, Target::Cpp); let required = true; let examples = collect_snippets_for_api_docs(docs, "cpp", required).unwrap_or_default(); @@ -2515,6 +2532,7 @@ fn quote_arrow_elem_type( } fn quote_loggable_hpp_and_cpp( + reporter: &Reporter, obj: &Object, objects: &Objects, hpp_includes: &mut Includes, @@ -2567,7 +2585,7 @@ fn quote_loggable_hpp_and_cpp( } }; - let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens(objects)); + let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens(reporter, objects)); let methods_cpp = methods.iter().map(|m| m.to_cpp_tokens(&loggable_type_name)); let hide_from_docs_comment = quote_hide_from_docs(); diff --git a/crates/build/re_types_builder/src/codegen/docs/mod.rs b/crates/build/re_types_builder/src/codegen/docs/mod.rs index 2deb26b120d6..b2ca29c0174f 100644 --- a/crates/build/re_types_builder/src/codegen/docs/mod.rs +++ b/crates/build/re_types_builder/src/codegen/docs/mod.rs @@ -123,7 +123,7 @@ on [Entities and Components](../../concepts/entity-component.md).", &views, ), ] { - let page = index_page(objects, kind, order, prelude, kind_objects); + let page = index_page(reporter, objects, kind, order, prelude, kind_objects); let path = self .docs_dir .join(format!("{}.md", kind.plural_snake_case())); @@ -146,6 +146,7 @@ fn collect_view_types_per_archetype(objects: &Objects) -> ViewsPerArchetype { } fn index_page( + reporter: &Reporter, all_objects: &Objects, kind: ObjectKind, order: u64, @@ -203,7 +204,7 @@ fn index_page( object.snake_case_name(), object .docs - .first_line(all_objects, Target::WebDocsMarkdown) + .first_line(reporter, all_objects, Target::WebDocsMarkdown) .unwrap_or_default(), ); } @@ -223,7 +224,9 @@ fn object_page( let is_unreleased = object.is_attr_set(crate::ATTR_DOCS_UNRELEASED); let is_experimental = object.is_experimental(); - let top_level_docs = object.docs.lines_for(objects, Target::WebDocsMarkdown); + let top_level_docs = object + .docs + .lines_for(reporter, objects, Target::WebDocsMarkdown); if top_level_docs.is_empty() { reporter.error(&object.virtpath, &object.fqname, "Undocumented object"); @@ -271,7 +274,7 @@ fn object_page( match object.kind { ObjectKind::Datatype | ObjectKind::Component => { - write_fields(objects, &mut page, object); + write_fields(reporter, objects, &mut page, object); } ObjectKind::Archetype => { write_archetype_fields(objects, &mut page, object, views_per_archetype); @@ -402,7 +405,7 @@ fn write_frontmatter(o: &mut String, title: &str, order: Option) { putln!(o, "", autogen_warning!()); } -fn write_fields(objects: &Objects, o: &mut String, object: &Object) { +fn write_fields(reporter: &Reporter, objects: &Objects, o: &mut String, object: &Object) { if object.fields.is_empty() { return; } @@ -491,7 +494,10 @@ fn write_fields(objects: &Objects, o: &mut String, object: &Object) { field_string.push('\n'); } - for line in field.docs.lines_for(objects, Target::WebDocsMarkdown) { + for line in field + .docs + .lines_for(reporter, objects, Target::WebDocsMarkdown) + { field_string.push_str(&line); field_string.push('\n'); } @@ -705,7 +711,9 @@ fn write_view_property( ) { putln!(o, "### `{}`", field.name); - let top_level_docs = field.docs.lines_for(objects, Target::WebDocsMarkdown); + let top_level_docs = field + .docs + .lines_for(reporter, objects, Target::WebDocsMarkdown); if top_level_docs.is_empty() { reporter.error(&field.virtpath, &field.fqname, "Undocumented view property"); @@ -728,7 +736,7 @@ fn write_view_property( field.name, field .docs - .first_line(objects, Target::WebDocsMarkdown) + .first_line(reporter, objects, Target::WebDocsMarkdown) .unwrap_or_default() )); } diff --git a/crates/build/re_types_builder/src/codegen/python/mod.rs b/crates/build/re_types_builder/src/codegen/python/mod.rs index 6688257bc230..1b0eeb135435 100644 --- a/crates/build/re_types_builder/src/codegen/python/mod.rs +++ b/crates/build/re_types_builder/src/codegen/python/mod.rs @@ -1110,7 +1110,7 @@ fn code_for_union( format!("inner: {inner_type} = field({converter} {type_ignore}\n)"), 1, ); - code.push_indented(1, quote_doc_from_fields(objects, fields), 0); + code.push_indented(1, quote_doc_from_fields(reporter, objects, fields), 0); // if there are duplicate types, we need to add a `kind` field to disambiguate the union if has_duplicate_types { @@ -1126,7 +1126,11 @@ fn code_for_union( 1, ); - code.push_indented(1, quote_union_kind_from_fields(objects, fields), 0); + code.push_indented( + 1, + quote_union_kind_from_fields(reporter, objects, fields), + 0, + ); } code.push_unindented(quote_union_aliases_from_object(obj, field_types.iter()), 1); @@ -1241,7 +1245,7 @@ fn lines_from_docs( docs: &Docs, is_experimental: bool, ) -> Vec { - let mut lines = docs.lines_for(objects, Target::Python); + let mut lines = docs.lines_for(reporter, objects, Target::Python); if is_experimental { lines.push(String::new()); @@ -1299,11 +1303,15 @@ fn quote_doc_lines(lines: Vec) -> String { } } -fn quote_doc_from_fields(objects: &Objects, fields: &Vec) -> String { +fn quote_doc_from_fields( + reporter: &Reporter, + objects: &Objects, + fields: &Vec, +) -> String { let mut lines = vec!["Must be one of:".to_owned(), String::new()]; for field in fields { - let mut content = field.docs.lines_for(objects, Target::Python); + let mut content = field.docs.lines_for(reporter, objects, Target::Python); for line in &mut content { if line.starts_with(char::is_whitespace) { line.remove(0); @@ -1341,11 +1349,15 @@ fn quote_doc_from_fields(objects: &Objects, fields: &Vec) -> String format!("\"\"\"\n{doc}\n\"\"\"\n\n") } -fn quote_union_kind_from_fields(objects: &Objects, fields: &Vec) -> String { +fn quote_union_kind_from_fields( + reporter: &Reporter, + objects: &Objects, + fields: &Vec, +) -> String { let mut lines = vec!["Possible values:".to_owned(), String::new()]; for field in fields { - let mut content = field.docs.lines_for(objects, Target::Python); + let mut content = field.docs.lines_for(reporter, objects, Target::Python); for line in &mut content { if line.starts_with(char::is_whitespace) { line.remove(0); @@ -1878,7 +1890,12 @@ fn quote_arrow_support_from_obj( ) { Ok(automatic_arrow_serialization) => { if ext_class.has_native_to_pa_array { - reporter.warn(&obj.virtpath, &obj.fqname, format!("No need to manually implement {NATIVE_TO_PA_ARRAY_METHOD} in {} - we can autogenerate the code for this", ext_class.file_name)); + // There's usually a good reason why serialization is manually implemented, + // so warning about it is just spam. + // We could introduce an opt-in flag, but by having a custom method in the first place someone already made the choice. + if false { + reporter.warn(&obj.virtpath, &obj.fqname, format!("No need to manually implement {NATIVE_TO_PA_ARRAY_METHOD} in {} - we can autogenerate the code for this", ext_class.file_name)); + } format!( "return {}.{NATIVE_TO_PA_ARRAY_METHOD}(data, data_type)", ext_class.name @@ -2378,7 +2395,7 @@ fn quote_init_method( obj.fields .iter() .filter_map(|field| { - let doc_content = field.docs.lines_for(objects, Target::Python); + let doc_content = field.docs.lines_for(reporter, objects, Target::Python); if doc_content.is_empty() { if !field.is_testing() && obj.fields.len() > 1 { reporter.error( diff --git a/crates/build/re_types_builder/src/codegen/python/views.rs b/crates/build/re_types_builder/src/codegen/python/views.rs index cc06d29ea9e2..1f464d99cc3c 100644 --- a/crates/build/re_types_builder/src/codegen/python/views.rs +++ b/crates/build/re_types_builder/src/codegen/python/views.rs @@ -144,7 +144,7 @@ do not yet support `$origin` relative paths or glob expressions. This will be addressed in .".to_owned(),) ]; for field in &obj.fields { - let doc_content = field.docs.lines_for(objects, Target::Python); + let doc_content = field.docs.lines_for(reporter, objects, Target::Python); if doc_content.is_empty() { reporter.error( &field.virtpath, diff --git a/crates/build/re_types_builder/src/codegen/rust/api.rs b/crates/build/re_types_builder/src/codegen/rust/api.rs index 24bf5d4188a2..3125197d0889 100644 --- a/crates/build/re_types_builder/src/codegen/rust/api.rs +++ b/crates/build/re_types_builder/src/codegen/rust/api.rs @@ -580,7 +580,7 @@ fn quote_enum( &field.virtpath, &field.fqname, &field.docs, - Target::Rust, + Target::WebDocsMarkdown, false, ) .join("\n"); diff --git a/crates/build/re_types_builder/src/codegen/rust/util.rs b/crates/build/re_types_builder/src/codegen/rust/util.rs index eb3e41a2661a..671b3a31b161 100644 --- a/crates/build/re_types_builder/src/codegen/rust/util.rs +++ b/crates/build/re_types_builder/src/codegen/rust/util.rs @@ -300,7 +300,7 @@ pub fn doc_as_lines( target: Target, is_experimental: bool, ) -> Vec { - let mut lines = docs.lines_for(objects, target); + let mut lines = docs.lines_for(reporter, objects, target); if is_experimental { lines.push(String::new()); diff --git a/crates/build/re_types_builder/src/docs.rs b/crates/build/re_types_builder/src/docs.rs index 3f9084d09a5a..52d8a3c20166 100644 --- a/crates/build/re_types_builder/src/docs.rs +++ b/crates/build/re_types_builder/src/docs.rs @@ -1,7 +1,7 @@ -use crate::{codegen::Target, Objects}; +use crate::{codegen::Target, Objects, Reporter}; /// A high-level representation of the contents of a flatbuffer docstring. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub struct Docs { /// All docmentation lines, including the leading tag, if any. /// @@ -15,19 +15,32 @@ pub struct Docs { impl Docs { pub fn from_raw_docs( + reporter: &Reporter, + virtpath: &str, + fqname: &str, docs: Option>>, ) -> Self { - Self::from_lines(docs.into_iter().flat_map(|doc| doc.into_iter())) + Self::from_lines( + reporter, + virtpath, + fqname, + docs.into_iter().flat_map(|doc| doc.into_iter()), + ) } - pub fn from_lines<'a>(lines: impl Iterator) -> Self { + pub fn from_lines<'a>( + reporter: &Reporter, + virtpath: &str, + fqname: &str, + lines: impl Iterator, + ) -> Self { let lines: Vec<(String, String)> = lines.map(parse_line).collect(); for (tag, comment) in &lines { assert!(is_known_tag(tag), "Unknown tag: '\\{tag} {comment}'"); if tag.is_empty() { - find_and_recommend_doclinks(comment); + find_and_recommend_doclinks(reporter, virtpath, fqname, comment); } } @@ -35,13 +48,18 @@ impl Docs { } /// Get the first line of the documentation untagged. - pub fn first_line(&self, objects: &Objects, target: Target) -> Option { + pub fn first_line( + &self, + reporter: &Reporter, + objects: &Objects, + target: Target, + ) -> Option { let (tag, line) = self.lines.first()?; assert!( tag.is_empty(), "Expected no tag on first line of docstring. Found: /// \\{tag} {line}" ); - Some(translate_doc_line(objects, line, target)) + Some(translate_doc_line(reporter, objects, line, target)) } /// Get all doc lines that start with the given tag. @@ -68,7 +86,12 @@ impl Docs { /// For instance, pass [`Target::Python`] to get all lines that are untagged or starts with `"\py"`. /// /// The tagged lines (`\py`) are left as is, but untagged lines will have Rerun doclinks translated to the target language. - pub(super) fn lines_for(&self, objects: &Objects, target: Target) -> Vec { + pub(super) fn lines_for( + &self, + reporter: &Reporter, + objects: &Objects, + target: Target, + ) -> Vec { let target_tag = match target { Target::Cpp => "cpp", Target::Python => "py", @@ -82,7 +105,7 @@ impl Docs { remove_extra_newlines(self.lines.iter().filter_map(|(tag, line)| { if tag.is_empty() { - Some(translate_doc_line(objects, line, target)) + Some(translate_doc_line(reporter, objects, line, target)) } else if tag == target_tag { // We don't expect doclinks in tagged lines, because tagged lines are usually // language-specific, and thus should have the correct format already. @@ -144,7 +167,12 @@ fn parse_line(line: &str) -> (String, String) { } /// Look for things that look like doclinks to other types, but aren't in brackets. -fn find_and_recommend_doclinks(full_comment: &str) { +fn find_and_recommend_doclinks( + reporter: &Reporter, + virtpath: &str, + fqname: &str, + full_comment: &str, +) { let mut comment = full_comment; while let Some(start) = comment.find('`') { comment = &comment[start + 1..]; @@ -161,11 +189,11 @@ fn find_and_recommend_doclinks(full_comment: &str) { // In some blueprint code we refer to stuff in Rerun. && !matches!(content, "ChunkStore" | "ContainerId" | "EntityPathFilter" | "Spatial2DView" | "SpaceViewId" | "SpaceView") - // TODO(emilk): allow doclinks to enum variants. - && !matches!(content, "Horizontal" | "Vertical" | "SolidColor"); + // Doc links to OpenStreetMap may show up + && !matches!(content, "OpenStreetMap"); if looks_like_type_name { - re_log::warn!("`{content}` can be written as a doclink, e.g. [archetypes.{content}] in comment: /// {full_comment}"); + reporter.warn(virtpath, fqname, format!("`{content}` can be written as a doclink, e.g. [archetypes.{content}] in comment: /// {full_comment}")); } comment = &comment[end + 1..]; } else { @@ -188,12 +216,17 @@ use doclink_translation::translate_doc_line; /// /// The code is not very efficient, but it is simple and works. mod doclink_translation { - use crate::Objects; + use crate::{ObjectKind, Objects, Reporter}; use super::Target; /// Convert Rerun-style doclinks to the target language. - pub fn translate_doc_line(objects: &Objects, input: &str, target: Target) -> String { + pub fn translate_doc_line( + reporter: &Reporter, + objects: &Objects, + input: &str, + target: Target, + ) -> String { let mut out_tokens: Vec = vec![]; let mut within_backticks = false; @@ -230,7 +263,12 @@ mod doclink_translation { continue; } - out_tokens.push(translate_doclink(objects, &doclink_tokens, target)); + out_tokens.push(translate_doclink( + reporter, + objects, + &doclink_tokens, + target, + )); continue; } @@ -241,7 +279,12 @@ mod doclink_translation { out_tokens.into_iter().collect() } - fn translate_doclink(objects: &Objects, doclink_tokens: &[&str], target: Target) -> String { + fn translate_doclink( + reporter: &Reporter, + objects: &Objects, + doclink_tokens: &[&str], + target: Target, + ) -> String { try_translate_doclink(objects, doclink_tokens, target).unwrap_or_else(|err| { let original_doclink: String = doclink_tokens.join(""); @@ -250,9 +293,9 @@ mod doclink_translation { !original_doclink.contains(' ') && original_doclink.len() > 6; if looks_like_rerun_doclink { - re_log::warn_once!( + reporter.warn_no_context(format!( "Looks like a Rerun doclink, but fails to parse: {original_doclink} - {err}" - ); + )); } original_doclink @@ -263,29 +306,53 @@ mod doclink_translation { objects: &Objects, doclink_tokens: &[&str], target: Target, - ) -> Result { + ) -> Result { + let has_type_or_enum = doclink_tokens.iter().filter(|t| t == &&".").count() == 2; + let mut tokens = doclink_tokens.iter(); if tokens.next() != Some(&"[") { - return Err("Missing opening bracket"); + return Err("Missing opening bracket".to_owned()); } let kind = *tokens.next().ok_or("Missing kind")?; if kind == "`" { - return Err("Do not use backticks inside doclinks"); + return Err("Do not use backticks inside doclinks".to_owned()); } if tokens.next() != Some(&".") { - return Err("Missing dot"); + return Err("Missing dot".to_owned()); } let type_name = *tokens.next().ok_or("Missing type name")?; + + let field_or_enum_name = if has_type_or_enum { + if tokens.next() != Some(&".") { + return Err("Missing dot".to_owned()); + } + tokens.next() + } else { + None + }; + if tokens.next() != Some(&"]") { - return Err("Missing closing bracket"); + return Err("Missing closing bracket".to_owned()); } if tokens.next().is_some() { - return Err("Trailing tokens"); + return Err("Trailing tokens".to_owned()); } - // TODO(emilk): support links to fields and enum variants + // Validate kind: + if ObjectKind::ALL + .iter() + .all(|object_kind| object_kind.plural_snake_case() != kind) + { + return Err(format!( + "Invalid kind {kind:?}. Valid are: {}", + ObjectKind::ALL + .map(|object_kind| object_kind.plural_snake_case()) + .join(", ") + )); + } - let mut is_unreleased = false; + let is_unreleased; + let scope; { // Find the target object: let mut candidates = vec![]; @@ -294,30 +361,61 @@ mod doclink_translation { candidates.push(obj); } } - if candidates.is_empty() { - // NOTE: we don't error if the target doesn't exists. - // Instead we rely on the documentation tools for the different targets, - // e.g. `cargo doc` and our url link checker. - // Maybe we could change that though to catch errors earlier. - re_log::warn_once!("No object found for doclink: [{kind}.{type_name}]"); - } else if candidates.len() > 2 { + + let Some(object) = candidates.first() else { + return Err("No object found for doclink".to_owned()); + }; + + if candidates.len() > 2 { use itertools::Itertools as _; - re_log::warn_once!( - "Multiple objects found for doclink: [{kind}.{type_name}]: {}", + return Err(format!( + "Multiple objects found for doclink: {}", candidates.iter().map(|obj| &obj.fqname).format(", ") - ); - } else if let Some(object) = candidates.first() { - is_unreleased = object.is_attr_set(crate::ATTR_DOCS_UNRELEASED); + )); } + + scope = object.scope().unwrap_or_default(); + is_unreleased = object.is_attr_set(crate::ATTR_DOCS_UNRELEASED); } Ok(match target { - Target::Cpp => format!("`{kind}::{type_name}`"), + Target::Cpp => { + if let Some(field_or_enum_name) = field_or_enum_name { + format!("`{kind}::{type_name}::{field_or_enum_name}`") + } else { + format!("`{kind}::{type_name}`") + } + } Target::Rust => { // https://doc.rust-lang.org/rustdoc/write-documentation/linking-to-items-by-name.html - format!("[`{kind}::{type_name}`][crate::{kind}::{type_name}]") + let kind_and_type = format!("{kind}::{type_name}"); + let object_path = if scope.is_empty() { + kind_and_type.clone() + } else { + format!("{scope}::{kind_and_type}") + }; + + if let Some(field_or_enum_name) = field_or_enum_name { + format!( + "[`{kind_and_type}::{field_or_enum_name}`][crate::{object_path}::{field_or_enum_name}]" + ) + } else { + format!("[`{kind_and_type}`][crate::{object_path}]") + } + } + Target::Python => { + let kind_and_type = format!("{kind}.{type_name}"); + let object_path = if scope.is_empty() { + format!("rerun.{kind_and_type}") + } else { + format!("rerun.{scope}.{kind_and_type}") + }; + if let Some(field_or_enum_name) = field_or_enum_name { + format!("[`{kind_and_type}.{field_or_enum_name}`][{object_path}.{field_or_enum_name}]") + } else { + format!("[`{kind_and_type}`][{object_path}]") + } } - Target::Python => format!("[`{kind}.{type_name}`][rerun.{kind}.{type_name}]"), Target::WebDocsMarkdown => { // For instance, https://rerun.io/docs/reference/types/views/spatial2d_view // TODO(emilk): relative links would be nicer for the local markdown files @@ -327,7 +425,15 @@ mod doclink_translation { } else { "" }; - format!("[`{kind}.{type_name}`](https://rerun.io/docs/reference/types/{kind}/{type_name_snake_case}{query})") + + let url = format!( + "https://rerun.io/docs/reference/types/{kind}/{type_name_snake_case}{query}" + ); + if let Some(field_or_enum_name) = field_or_enum_name { + format!("[`{kind}.{type_name}#{field_or_enum_name}`]({url})") + } else { + format!("[`{kind}.{type_name}`]({url})") + } } }) } @@ -355,8 +461,32 @@ mod doclink_translation { #[cfg(test)] mod tests { + use crate::{Attributes, Docs, Object, Objects}; + use super::*; + fn test_objects() -> Objects { + Objects { + objects: std::iter::once(( + "rerun.views.Spatial2DView".to_owned(), + Object { + virtpath: "path".to_owned(), + filepath: "path".into(), + fqname: "rerun.views.Spatial2DView".to_owned(), + pkg_name: "test".to_owned(), + name: "Spatial2DView".to_owned(), + docs: Docs::default(), + kind: ObjectKind::View, + attrs: Attributes::default(), + fields: Vec::new(), + class: crate::ObjectClass::Struct, + datatype: None, + }, + )) + .collect(), + } + } + #[test] fn test_tokenize() { assert_eq!(tokenize("This is a comment"), vec!["This is a comment"]); @@ -382,13 +512,15 @@ mod doclink_translation { #[test] fn test_translate_doclinks() { - let objects = Objects::default(); + let objects = test_objects(); + let (_report, reporter) = crate::report::init(); let input = "A vector `[1, 2, 3]` and a doclink [views.Spatial2DView] and a [url](www.rerun.io)."; assert_eq!( translate_doc_line( + &reporter, &objects, input, Target::Cpp @@ -398,24 +530,27 @@ mod doclink_translation { assert_eq!( translate_doc_line( + &reporter, &objects, input, Target::Python ), - "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView`][rerun.views.Spatial2DView] and a [url](www.rerun.io)." + "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView`][rerun.blueprint.views.Spatial2DView] and a [url](www.rerun.io)." ); assert_eq!( translate_doc_line( + &reporter, &objects, input, Target::Rust ), - "A vector `[1, 2, 3]` and a doclink [`views::Spatial2DView`][crate::views::Spatial2DView] and a [url](www.rerun.io)." + "A vector `[1, 2, 3]` and a doclink [`views::Spatial2DView`][crate::blueprint::views::Spatial2DView] and a [url](www.rerun.io)." ); assert_eq!( translate_doc_line( + &reporter, &objects, input, Target::WebDocsMarkdown @@ -423,6 +558,55 @@ mod doclink_translation { "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view) and a [url](www.rerun.io)." ); } + + #[test] + fn test_translate_doclinks_with_field() { + let objects = test_objects(); + let (_report, reporter) = crate::report::init(); + + let input = + "A vector `[1, 2, 3]` and a doclink [views.Spatial2DView.position] and a [url](www.rerun.io)."; + + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::Cpp + ), + "A vector `[1, 2, 3]` and a doclink `views::Spatial2DView::position` and a [url](www.rerun.io)." + ); + + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::Python + ), + "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView.position`][rerun.blueprint.views.Spatial2DView.position] and a [url](www.rerun.io)." + ); + + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::Rust + ), + "A vector `[1, 2, 3]` and a doclink [`views::Spatial2DView::position`][crate::blueprint::views::Spatial2DView::position] and a [url](www.rerun.io)." + ); + + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::WebDocsMarkdown + ), + "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView#position`](https://rerun.io/docs/reference/types/views/spatial2d_view) and a [url](www.rerun.io)." + ); + } } } @@ -434,8 +618,12 @@ mod tests { #[test] fn test_docs() { let objects = Objects::default(); + let (_report, reporter) = crate::report::init(); let docs = Docs::from_lines( + &reporter, + "testpath", + "testfqname", [ r" Doclink to [views.Spatial2DView].", r" ", @@ -455,7 +643,7 @@ mod tests { assert_eq!(docs.only_lines_tagged("cpp"), vec!["Only for C++.",]); assert_eq!( - docs.lines_for(&objects, Target::Python), + docs.lines_for(&reporter, &objects, Target::Python), vec![ "Doclink to [`views.Spatial2DView`][rerun.views.Spatial2DView].", "", @@ -468,7 +656,7 @@ mod tests { ); assert_eq!( - docs.lines_for(&objects, Target::Cpp), + docs.lines_for(&reporter, &objects, Target::Cpp), vec![ "Doclink to `views::Spatial2DView`.", "", @@ -481,7 +669,7 @@ mod tests { ); assert_eq!( - docs.first_line(&objects, Target::Rust), + docs.first_line(&reporter, &objects, Target::Rust), Some("Doclink to [`views::Spatial2DView`][crate::views::Spatial2DView].".to_owned()) ); } diff --git a/crates/build/re_types_builder/src/objects.rs b/crates/build/re_types_builder/src/objects.rs index 8a71b0d0cfb1..d311ba9b1100 100644 --- a/crates/build/re_types_builder/src/objects.rs +++ b/crates/build/re_types_builder/src/objects.rs @@ -391,7 +391,7 @@ impl Object { "Bad filepath: {filepath:?}" ); - let docs = Docs::from_raw_docs(obj.documentation()); + let docs = Docs::from_raw_docs(reporter, &virtpath, obj.name(), obj.documentation()); let attrs = Attributes::from_raw_attrs(obj.attributes()); let kind = ObjectKind::from_pkg_name(&pkg_name, &attrs); @@ -478,7 +478,7 @@ impl Object { .unwrap(); let filepath = filepath_from_declaration_file(include_dir_path, &virtpath); - let docs = Docs::from_raw_docs(enm.documentation()); + let docs = Docs::from_raw_docs(reporter, &virtpath, enm.name(), enm.documentation()); let attrs = Attributes::from_raw_attrs(enm.attributes()); let kind = ObjectKind::from_pkg_name(&pkg_name, &attrs); @@ -772,7 +772,7 @@ impl ObjectField { .unwrap(); let filepath = filepath_from_declaration_file(include_dir_path, &virtpath); - let docs = Docs::from_raw_docs(field.documentation()); + let docs = Docs::from_raw_docs(reporter, &virtpath, field.name(), field.documentation()); let attrs = Attributes::from_raw_attrs(field.attributes()); @@ -832,7 +832,7 @@ impl ObjectField { .unwrap(); let filepath = filepath_from_declaration_file(include_dir_path, &virtpath); - let docs = Docs::from_raw_docs(val.documentation()); + let docs = Docs::from_raw_docs(reporter, &virtpath, val.name(), val.documentation()); let attrs = Attributes::from_raw_attrs(val.attributes()); diff --git a/crates/build/re_types_builder/src/report.rs b/crates/build/re_types_builder/src/report.rs index 4f794ec4c71a..06fee4945eea 100644 --- a/crates/build/re_types_builder/src/report.rs +++ b/crates/build/re_types_builder/src/report.rs @@ -41,14 +41,27 @@ impl Reporter { #[allow(clippy::needless_pass_by_value)] // `&impl ToString` has worse usability pub fn error(&self, virtpath: &str, fqname: &str, text: impl ToString) { self.errors - .send(format!("{virtpath} {fqname}: {}", text.to_string())) + .send(format!( + "{} {fqname}: {}", + Self::format_virtpath(virtpath), + text.to_string() + )) .ok(); } + #[allow(clippy::needless_pass_by_value)] // `&impl ToString` has worse usability + pub fn warn_no_context(&self, text: impl ToString) { + self.warnings.send(text.to_string()).ok(); + } + #[allow(clippy::needless_pass_by_value)] // `&impl ToString` has worse usability pub fn warn(&self, virtpath: &str, fqname: &str, text: impl ToString) { self.warnings - .send(format!("{virtpath} {fqname}: {}", text.to_string())) + .send(format!( + "{} {fqname}: {}", + Self::format_virtpath(virtpath), + text.to_string() + )) .ok(); } @@ -56,6 +69,19 @@ impl Reporter { pub fn error_any(&self, text: impl ToString) { self.errors.send(text.to_string()).ok(); } + + // Tries to format a virtual fbs path such that it can be clicked in the CLI. + fn format_virtpath(virtpath: &str) -> String { + if let Ok(path) = Utf8Path::new(virtpath).canonicalize() { + path.display().to_string() + } else if let Ok(path) = + Utf8Path::new(&format!("crates/store/re_types/definitions/{virtpath}")).canonicalize() + { + path.display().to_string() + } else { + virtpath.to_owned() + } + } } /// Report which holds accumulated errors and warnings. @@ -78,15 +104,17 @@ impl Report { /// This outputs all errors and warnings to stderr and panics if there were any errors. pub fn finalize(&self) { + use colored::Colorize; + let mut errored = false; while let Ok(warn) = self.warnings.try_recv() { - eprintln!("Warning: {warn}"); + eprintln!("{} {}", "Warning: ".yellow().bold(), warn); } while let Ok(err) = self.errors.try_recv() { errored = true; - eprintln!("Error: {err}"); + eprintln!("{} {}", "Error: ".red().bold(), err); } if errored { diff --git a/crates/store/re_types/definitions/rerun/archetypes/graph_edges.fbs b/crates/store/re_types/definitions/rerun/archetypes/graph_edges.fbs index 0d18836848b4..f4e6a7a5988d 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/graph_edges.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/graph_edges.fbs @@ -27,7 +27,7 @@ table GraphEdges ( /// Specifies if the graph is directed or undirected. /// - /// If no `GraphType` is provided, the graph is assumed to be undirected. + /// If no [components.GraphType] is provided, the graph is assumed to be undirected. graph_type: rerun.components.GraphType ("attr.rerun.component_recommended", nullable, order: 2000); } diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/background.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/background.fbs index adfc5bcfa015..4216f2f8fe6b 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/background.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/background.fbs @@ -14,6 +14,7 @@ table Background ( // --- Optional --- - /// Color used for the `SolidColor` background type. + /// Color used for the solid background type. + // TODO(andreas): Can't link to [components.BackgroundKind.SolidColor] since blueprint components aren't part of the doc page yet. color: rerun.components.Color ("attr.rerun.component_optional", nullable, order: 2000); } diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs index ad5e504b66a4..e2d5afad0bb5 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs @@ -22,16 +22,16 @@ table ContainerBlueprint ( /// The layout shares of each column in the container. /// - /// For `Horizontal` containers, the length of this list should always match the number of contents. + /// For [components.ContainerKind.Horizontal] containers, the length of this list should always match the number of contents. /// - /// Ignored for `Vertical` containers. + /// Ignored for [components.ContainerKind.Vertical] containers. col_shares: [rerun.blueprint.components.ColumnShare] ("attr.rerun.component_optional", nullable, order: 400); /// The layout shares of each row of the container. /// - /// For `Vertical` containers, the length of this list should always match the number of contents. + /// For [components.ContainerKind.Vertical] containers, the length of this list should always match the number of contents. /// - /// Ignored for `Horizontal` containers. + /// Ignored for [components.ContainerKind.Horizontal] containers. row_shares: [rerun.blueprint.components.RowShare] ("attr.rerun.component_optional", nullable, order: 500); /// Which tab is active. @@ -48,6 +48,6 @@ table ContainerBlueprint ( /// /// If unset, the grid layout will be auto. /// - /// Ignored for `Horizontal`/`Vertical` containers. + /// Ignored for [components.ContainerKind.Horizontal]/[components.ContainerKind.Vertical] containers. grid_columns: rerun.blueprint.components.GridColumns ("attr.rerun.component_optional", nullable, order: 800); } diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/visualizer_overrides.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/visualizer_overrides.fbs index 4043917c61f0..fedd2980d452 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/visualizer_overrides.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/visualizer_overrides.fbs @@ -21,28 +21,5 @@ table VisualizerOverrides ( "attr.rust.override_crate": "re_types_blueprint" ) { /// Names of the visualizers that should be active. - /// - /// The built-in visualizers are: - /// - `BarChart` - /// - `Arrows2D` - /// - `Arrows3D` - /// - `Asset3D` - /// - `Boxes2D` - /// - `Boxes3D` - /// - `Cameras` - /// - `DepthImage` - /// - `Image` - /// - `Lines2D` - /// - `Lines3D` - /// - `Mesh3D` - /// - `Points2D` - /// - `Points3D` - /// - `Transform3DArrows` - /// - `Tensor` - /// - `TextDocument` - /// - `TextLog` - /// - `SegmentationImage` - /// - `SeriesLine` - /// - `SeriesPoint` visualizers: rerun.blueprint.datatypes.Utf8List (order: 100); } diff --git a/crates/store/re_types/definitions/rerun/components/fill_mode.fbs b/crates/store/re_types/definitions/rerun/components/fill_mode.fbs index 1d9ebcbb3ff2..caf9ec087ac8 100644 --- a/crates/store/re_types/definitions/rerun/components/fill_mode.fbs +++ b/crates/store/re_types/definitions/rerun/components/fill_mode.fbs @@ -18,7 +18,7 @@ enum FillMode: ubyte{ /// /// * An [archetypes.Ellipsoids3D] will draw three axis-aligned ellipses that are cross-sections /// of each ellipsoid, each of which displays two out of three of the sizes of the ellipsoid. - /// * For [archetypes.Boxes3D], it is the edges of the box, identical to `DenseWireframe`. + /// * For [archetypes.Boxes3D], it is the edges of the box, identical to [components.FillMode.DenseWireframe]. MajorWireframe (default), /// Many lines are drawn to represent the surface of the shape in a see-through fashion. @@ -27,7 +27,7 @@ enum FillMode: ubyte{ /// /// * An [archetypes.Ellipsoids3D] will draw a wireframe triangle mesh that approximates each /// ellipsoid. - /// * For [archetypes.Boxes3D], it is the edges of the box, identical to `MajorWireframe`. + /// * For [archetypes.Boxes3D], it is the edges of the box, identical to [components.FillMode.MajorWireframe]. DenseWireframe, /// The surface of the shape is filled in with a solid color. No lines are drawn. diff --git a/crates/store/re_types/definitions/rerun/datatypes/pixel_format.fbs b/crates/store/re_types/definitions/rerun/datatypes/pixel_format.fbs index 91c641c72183..8569f9c4ead9 100644 --- a/crates/store/re_types/definitions/rerun/datatypes/pixel_format.fbs +++ b/crates/store/re_types/definitions/rerun/datatypes/pixel_format.fbs @@ -102,7 +102,7 @@ enum PixelFormat: ubyte { /// followed by a plane with interleaved lines ordered as U0, V0, U1, V1, etc. NV12 = 26 (default), // _something_ has to be the default 🤷‍♀️ - /// `YUY2` (aka `YUYV`, `YUYV16` or `NV21`), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel. + /// `YUY2` (aka 'YUYV', 'YUYV16' or 'NV21'), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel. /// /// This uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240]. /// diff --git a/crates/store/re_types/src/archetypes/graph_edges.rs b/crates/store/re_types/src/archetypes/graph_edges.rs index d8ecb7df7421..f93d9081c749 100644 --- a/crates/store/re_types/src/archetypes/graph_edges.rs +++ b/crates/store/re_types/src/archetypes/graph_edges.rs @@ -30,7 +30,7 @@ pub struct GraphEdges { /// Specifies if the graph is directed or undirected. /// - /// If no `GraphType` is provided, the graph is assumed to be undirected. + /// If no [`components::GraphType`][crate::components::GraphType] is provided, the graph is assumed to be undirected. pub graph_type: Option, } @@ -214,7 +214,7 @@ impl GraphEdges { /// Specifies if the graph is directed or undirected. /// - /// If no `GraphType` is provided, the graph is assumed to be undirected. + /// If no [`components::GraphType`][crate::components::GraphType] is provided, the graph is assumed to be undirected. #[inline] pub fn with_graph_type(mut self, graph_type: impl Into) -> Self { self.graph_type = Some(graph_type.into()); diff --git a/crates/store/re_types/src/blueprint/archetypes/background.rs b/crates/store/re_types/src/blueprint/archetypes/background.rs index c6889b89dfe7..40f46eaf3dd2 100644 --- a/crates/store/re_types/src/blueprint/archetypes/background.rs +++ b/crates/store/re_types/src/blueprint/archetypes/background.rs @@ -24,7 +24,7 @@ pub struct Background { /// The type of the background. pub kind: crate::blueprint::components::BackgroundKind, - /// Color used for the `SolidColor` background type. + /// Color used for the solid background type. pub color: Option, } @@ -206,7 +206,7 @@ impl Background { } } - /// Color used for the `SolidColor` background type. + /// Color used for the solid background type. #[inline] pub fn with_color(mut self, color: impl Into) -> Self { self.color = Some(color.into()); diff --git a/crates/store/re_types/src/components/fill_mode.rs b/crates/store/re_types/src/components/fill_mode.rs index 0873b950a7f1..62626d83d9ed 100644 --- a/crates/store/re_types/src/components/fill_mode.rs +++ b/crates/store/re_types/src/components/fill_mode.rs @@ -29,7 +29,7 @@ pub enum FillMode { /// /// * An [`archetypes::Ellipsoids3D`][crate::archetypes::Ellipsoids3D] will draw three axis-aligned ellipses that are cross-sections /// of each ellipsoid, each of which displays two out of three of the sizes of the ellipsoid. - /// * For [`archetypes::Boxes3D`][crate::archetypes::Boxes3D], it is the edges of the box, identical to `DenseWireframe`. + /// * For [`archetypes::Boxes3D`][crate::archetypes::Boxes3D], it is the edges of the box, identical to [`components::FillMode::DenseWireframe`][crate::components::FillMode::DenseWireframe]. #[default] MajorWireframe = 1, @@ -39,7 +39,7 @@ pub enum FillMode { /// /// * An [`archetypes::Ellipsoids3D`][crate::archetypes::Ellipsoids3D] will draw a wireframe triangle mesh that approximates each /// ellipsoid. - /// * For [`archetypes::Boxes3D`][crate::archetypes::Boxes3D], it is the edges of the box, identical to `MajorWireframe`. + /// * For [`archetypes::Boxes3D`][crate::archetypes::Boxes3D], it is the edges of the box, identical to [`components::FillMode::MajorWireframe`][crate::components::FillMode::MajorWireframe]. DenseWireframe = 2, /// The surface of the shape is filled in with a solid color. No lines are drawn. @@ -155,10 +155,10 @@ impl ::re_types_core::reflection::Enum for FillMode { fn docstring_md(self) -> &'static str { match self { Self::MajorWireframe => { - "Lines are drawn around the parts of the shape which directly correspond to the logged data.\n\nExamples of what this means:\n\n* An [`archetypes::Ellipsoids3D`][crate::archetypes::Ellipsoids3D] will draw three axis-aligned ellipses that are cross-sections\n of each ellipsoid, each of which displays two out of three of the sizes of the ellipsoid.\n* For [`archetypes::Boxes3D`][crate::archetypes::Boxes3D], it is the edges of the box, identical to `DenseWireframe`." + "Lines are drawn around the parts of the shape which directly correspond to the logged data.\n\nExamples of what this means:\n\n* An [`archetypes.Ellipsoids3D`](https://rerun.io/docs/reference/types/archetypes/ellipsoids3d) will draw three axis-aligned ellipses that are cross-sections\n of each ellipsoid, each of which displays two out of three of the sizes of the ellipsoid.\n* For [`archetypes.Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d), it is the edges of the box, identical to [`components.FillMode#DenseWireframe`](https://rerun.io/docs/reference/types/components/fill_mode)." } Self::DenseWireframe => { - "Many lines are drawn to represent the surface of the shape in a see-through fashion.\n\nExamples of what this means:\n\n* An [`archetypes::Ellipsoids3D`][crate::archetypes::Ellipsoids3D] will draw a wireframe triangle mesh that approximates each\n ellipsoid.\n* For [`archetypes::Boxes3D`][crate::archetypes::Boxes3D], it is the edges of the box, identical to `MajorWireframe`." + "Many lines are drawn to represent the surface of the shape in a see-through fashion.\n\nExamples of what this means:\n\n* An [`archetypes.Ellipsoids3D`](https://rerun.io/docs/reference/types/archetypes/ellipsoids3d) will draw a wireframe triangle mesh that approximates each\n ellipsoid.\n* For [`archetypes.Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d), it is the edges of the box, identical to [`components.FillMode#MajorWireframe`](https://rerun.io/docs/reference/types/components/fill_mode)." } Self::Solid => { "The surface of the shape is filled in with a solid color. No lines are drawn." diff --git a/crates/store/re_types/src/components/transform_relation.rs b/crates/store/re_types/src/components/transform_relation.rs index 95848e877db6..4fcd383ef19d 100644 --- a/crates/store/re_types/src/components/transform_relation.rs +++ b/crates/store/re_types/src/components/transform_relation.rs @@ -146,10 +146,10 @@ impl ::re_types_core::reflection::Enum for TransformRelation { fn docstring_md(self) -> &'static str { match self { Self::ParentFromChild => { - "The transform describes how to transform into the parent entity's space.\n\nE.g. a translation of (0, 1, 0) with this [`components::TransformRelation`][crate::components::TransformRelation] logged at `parent/child` means\nthat from the point of view of `parent`, `parent/child` is translated 1 unit along `parent`'s Y axis.\nFrom perspective of `parent/child`, the `parent` entity is translated -1 unit along `parent/child`'s Y axis." + "The transform describes how to transform into the parent entity's space.\n\nE.g. a translation of (0, 1, 0) with this [`components.TransformRelation`](https://rerun.io/docs/reference/types/components/transform_relation) logged at `parent/child` means\nthat from the point of view of `parent`, `parent/child` is translated 1 unit along `parent`'s Y axis.\nFrom perspective of `parent/child`, the `parent` entity is translated -1 unit along `parent/child`'s Y axis." } Self::ChildFromParent => { - "The transform describes how to transform into the child entity's space.\n\nE.g. a translation of (0, 1, 0) with this [`components::TransformRelation`][crate::components::TransformRelation] logged at `parent/child` means\nthat from the point of view of `parent`, `parent/child` is translated -1 unit along `parent`'s Y axis.\nFrom perspective of `parent/child`, the `parent` entity is translated 1 unit along `parent/child`'s Y axis." + "The transform describes how to transform into the child entity's space.\n\nE.g. a translation of (0, 1, 0) with this [`components.TransformRelation`](https://rerun.io/docs/reference/types/components/transform_relation) logged at `parent/child` means\nthat from the point of view of `parent`, `parent/child` is translated -1 unit along `parent`'s Y axis.\nFrom perspective of `parent/child`, the `parent` entity is translated 1 unit along `parent/child`'s Y axis." } } } diff --git a/crates/store/re_types/src/datatypes/pixel_format.rs b/crates/store/re_types/src/datatypes/pixel_format.rs index 28d99abf8131..0b7c9aa8301e 100644 --- a/crates/store/re_types/src/datatypes/pixel_format.rs +++ b/crates/store/re_types/src/datatypes/pixel_format.rs @@ -52,7 +52,7 @@ pub enum PixelFormat { #[allow(clippy::upper_case_acronyms)] NV12 = 26, - /// `YUY2` (aka `YUYV`, `YUYV16` or `NV21`), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel. + /// `YUY2` (aka 'YUYV', 'YUYV16' or 'NV21'), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel. /// /// This uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240]. /// @@ -258,10 +258,10 @@ impl ::re_types_core::reflection::Enum for PixelFormat { "`NV12` (aka `Y_UV12`) is a YUV 4:2:0 chroma downsampled form at with 12 bits per pixel and 8 bits per channel.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nFirst comes entire image in Y in one plane,\nfollowed by a plane with interleaved lines ordered as U0, V0, U1, V1, etc." } Self::YUY2 => { - "`YUY2` (aka `YUYV`, `YUYV16` or `NV21`), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nThe order of the channels is Y0, U0, Y1, V0, all in the same plane." + "`YUY2` (aka 'YUYV', 'YUYV16' or 'NV21'), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nThe order of the channels is Y0, U0, Y1, V0, all in the same plane." } Self::Y8_FullRange => { - "Monochrome Y plane only, essentially a YUV 4:0:0 planar format.\n\nAlso known as just \"gray\". This is virtually identical to a 8bit luminance/grayscale (see [`datatypes::ColorModel`][crate::datatypes::ColorModel]).\n\nThis uses entire range YUV, i.e. Y is expected to be within [0, 255].\n(as opposed to \"limited range\" YUV as used e.g. in NV12)." + "Monochrome Y plane only, essentially a YUV 4:0:0 planar format.\n\nAlso known as just \"gray\". This is virtually identical to a 8bit luminance/grayscale (see [`datatypes.ColorModel`](https://rerun.io/docs/reference/types/datatypes/color_model)).\n\nThis uses entire range YUV, i.e. Y is expected to be within [0, 255].\n(as opposed to \"limited range\" YUV as used e.g. in NV12)." } Self::Y_U_V24_LimitedRange => { "`Y_U_V24` is a YUV 4:4:4 fully planar YUV format without chroma downsampling, also known as `I444`.\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240].\n\nFirst comes entire image in Y in one plane, followed by the U and V planes." @@ -270,7 +270,7 @@ impl ::re_types_core::reflection::Enum for PixelFormat { "`Y_U_V24` is a YUV 4:4:4 fully planar YUV format without chroma downsampling, also known as `I444`.\n\nThis uses full range YUV with all components ranging from 0 to 255\n(as opposed to \"limited range\" YUV as used e.g. in NV12).\n\nFirst comes entire image in Y in one plane, followed by the U and V planes." } Self::Y8_LimitedRange => { - "Monochrome Y plane only, essentially a YUV 4:0:0 planar format.\n\nAlso known as just \"gray\".\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235].\nIf not for this range limitation/remapping, this is almost identical to 8bit luminace/grayscale (see [`datatypes::ColorModel`][crate::datatypes::ColorModel])." + "Monochrome Y plane only, essentially a YUV 4:0:0 planar format.\n\nAlso known as just \"gray\".\n\nThis uses limited range YUV, i.e. Y is expected to be within [16, 235].\nIf not for this range limitation/remapping, this is almost identical to 8bit luminace/grayscale (see [`datatypes.ColorModel`](https://rerun.io/docs/reference/types/datatypes/color_model))." } Self::Y_U_V12_FullRange => { "`Y_U_V12` is a YUV 4:2:0 fully planar YUV format without chroma downsampling, also known as `I420`.\n\nThis uses full range YUV with all components ranging from 0 to 255\n(as opposed to \"limited range\" YUV as used e.g. in NV12).\n\nFirst comes entire image in Y in one plane, followed by the U and V planes, which each only have half\nthe resolution of the Y plane." diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs b/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs index 3138dd3a9254..95e2991da168 100644 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs +++ b/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs @@ -32,16 +32,16 @@ pub struct ContainerBlueprint { /// The layout shares of each column in the container. /// - /// For `Horizontal` containers, the length of this list should always match the number of contents. + /// For [`components::ContainerKind::Horizontal`][crate::blueprint::components::ContainerKind::Horizontal] containers, the length of this list should always match the number of contents. /// - /// Ignored for `Vertical` containers. + /// Ignored for [`components::ContainerKind::Vertical`][crate::blueprint::components::ContainerKind::Vertical] containers. pub col_shares: Option>, /// The layout shares of each row of the container. /// - /// For `Vertical` containers, the length of this list should always match the number of contents. + /// For [`components::ContainerKind::Vertical`][crate::blueprint::components::ContainerKind::Vertical] containers, the length of this list should always match the number of contents. /// - /// Ignored for `Horizontal` containers. + /// Ignored for [`components::ContainerKind::Horizontal`][crate::blueprint::components::ContainerKind::Horizontal] containers. pub row_shares: Option>, /// Which tab is active. @@ -58,7 +58,7 @@ pub struct ContainerBlueprint { /// /// If unset, the grid layout will be auto. /// - /// Ignored for `Horizontal`/`Vertical` containers. + /// Ignored for [`components::ContainerKind::Horizontal`][crate::blueprint::components::ContainerKind::Horizontal]/[`components::ContainerKind::Vertical`][crate::blueprint::components::ContainerKind::Vertical] containers. pub grid_columns: Option, } @@ -480,9 +480,9 @@ impl ContainerBlueprint { /// The layout shares of each column in the container. /// - /// For `Horizontal` containers, the length of this list should always match the number of contents. + /// For [`components::ContainerKind::Horizontal`][crate::blueprint::components::ContainerKind::Horizontal] containers, the length of this list should always match the number of contents. /// - /// Ignored for `Vertical` containers. + /// Ignored for [`components::ContainerKind::Vertical`][crate::blueprint::components::ContainerKind::Vertical] containers. #[inline] pub fn with_col_shares( mut self, @@ -494,9 +494,9 @@ impl ContainerBlueprint { /// The layout shares of each row of the container. /// - /// For `Vertical` containers, the length of this list should always match the number of contents. + /// For [`components::ContainerKind::Vertical`][crate::blueprint::components::ContainerKind::Vertical] containers, the length of this list should always match the number of contents. /// - /// Ignored for `Horizontal` containers. + /// Ignored for [`components::ContainerKind::Horizontal`][crate::blueprint::components::ContainerKind::Horizontal] containers. #[inline] pub fn with_row_shares( mut self, @@ -534,7 +534,7 @@ impl ContainerBlueprint { /// /// If unset, the grid layout will be auto. /// - /// Ignored for `Horizontal`/`Vertical` containers. + /// Ignored for [`components::ContainerKind::Horizontal`][crate::blueprint::components::ContainerKind::Horizontal]/[`components::ContainerKind::Vertical`][crate::blueprint::components::ContainerKind::Vertical] containers. #[inline] pub fn with_grid_columns( mut self, diff --git a/crates/store/re_types_blueprint/src/blueprint/components/visualizer_overrides.rs b/crates/store/re_types_blueprint/src/blueprint/components/visualizer_overrides.rs index 7bc5a0d63998..99b03d0960a2 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/visualizer_overrides.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/visualizer_overrides.rs @@ -32,29 +32,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[repr(transparent)] pub struct VisualizerOverrides( /// Names of the visualizers that should be active. - /// - /// The built-in visualizers are: - /// - `BarChart` - /// - `Arrows2D` - /// - `Arrows3D` - /// - `Asset3D` - /// - `Boxes2D` - /// - `Boxes3D` - /// - `Cameras` - /// - `DepthImage` - /// - `Image` - /// - `Lines2D` - /// - `Lines3D` - /// - `Mesh3D` - /// - `Points2D` - /// - `Points3D` - /// - `Transform3DArrows` - /// - `Tensor` - /// - `TextDocument` - /// - `TextLog` - /// - `SegmentationImage` - /// - `SeriesLine` - /// - `SeriesPoint` pub crate::blueprint::datatypes::Utf8List, ); diff --git a/crates/viewer/re_viewer/src/reflection/mod.rs b/crates/viewer/re_viewer/src/reflection/mod.rs index ed5806fd9f5b..a32288da7a61 100644 --- a/crates/viewer/re_viewer/src/reflection/mod.rs +++ b/crates/viewer/re_viewer/src/reflection/mod.rs @@ -1358,7 +1358,7 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { is_required : true, }, ArchetypeFieldReflection { component_name : "rerun.components.GraphType".into(), display_name : "Graph type", docstring_md : - "Specifies if the graph is directed or undirected.\n\nIf no `GraphType` is provided, the graph is assumed to be undirected.\n\n⚠\u{fe0f} **This type is experimental and may be removed in future versions**", + "Specifies if the graph is directed or undirected.\n\nIf no [`components.GraphType`](https://rerun.io/docs/reference/types/components/graph_type?speculative-link) is provided, the graph is assumed to be undirected.\n\n⚠\u{fe0f} **This type is experimental and may be removed in future versions**", is_required : false, }, ], }, @@ -1871,8 +1871,8 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { "Kind", docstring_md : "The type of the background.", is_required : true, }, ArchetypeFieldReflection { component_name : "rerun.components.Color".into(), display_name : "Color", docstring_md - : "Color used for the `SolidColor` background type.", is_required : - false, }, + : "Color used for the solid background type.", is_required : false, + }, ], }, ), @@ -1895,11 +1895,11 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { is_required : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.ColumnShare".into(), display_name : "Col shares", docstring_md : - "The layout shares of each column in the container.\n\nFor `Horizontal` containers, the length of this list should always match the number of contents.\n\nIgnored for `Vertical` containers.", + "The layout shares of each column in the container.\n\nFor [`components.ContainerKind#Horizontal`](https://rerun.io/docs/reference/types/components/container_kind) containers, the length of this list should always match the number of contents.\n\nIgnored for [`components.ContainerKind#Vertical`](https://rerun.io/docs/reference/types/components/container_kind) containers.", is_required : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.RowShare".into(), display_name : "Row shares", docstring_md : - "The layout shares of each row of the container.\n\nFor `Vertical` containers, the length of this list should always match the number of contents.\n\nIgnored for `Horizontal` containers.", + "The layout shares of each row of the container.\n\nFor [`components.ContainerKind#Vertical`](https://rerun.io/docs/reference/types/components/container_kind) containers, the length of this list should always match the number of contents.\n\nIgnored for [`components.ContainerKind#Horizontal`](https://rerun.io/docs/reference/types/components/container_kind) containers.", is_required : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.ActiveTab".into(), display_name : "Active tab", docstring_md : @@ -1911,7 +1911,7 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { is_required : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.GridColumns".into(), display_name : "Grid columns", docstring_md : - "How many columns this grid should have.\n\nIf unset, the grid layout will be auto.\n\nIgnored for `Horizontal`/`Vertical` containers.", + "How many columns this grid should have.\n\nIf unset, the grid layout will be auto.\n\nIgnored for [`components.ContainerKind#Horizontal`](https://rerun.io/docs/reference/types/components/container_kind)/[`components.ContainerKind#Vertical`](https://rerun.io/docs/reference/types/components/container_kind) containers.", is_required : false, }, ], }, diff --git a/docs/content/reference/types/components/fill_mode.md b/docs/content/reference/types/components/fill_mode.md index f95ed3ac01a6..a939e3eee30d 100644 --- a/docs/content/reference/types/components/fill_mode.md +++ b/docs/content/reference/types/components/fill_mode.md @@ -13,7 +13,7 @@ Examples of what this means: * An [`archetypes.Ellipsoids3D`](https://rerun.io/docs/reference/types/archetypes/ellipsoids3d) will draw three axis-aligned ellipses that are cross-sections of each ellipsoid, each of which displays two out of three of the sizes of the ellipsoid. -* For [`archetypes.Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d), it is the edges of the box, identical to `DenseWireframe`. +* For [`archetypes.Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d), it is the edges of the box, identical to [`components.FillMode#DenseWireframe`](https://rerun.io/docs/reference/types/components/fill_mode). #### `DenseWireframe` = 2 Many lines are drawn to represent the surface of the shape in a see-through fashion. @@ -22,7 +22,7 @@ Examples of what this means: * An [`archetypes.Ellipsoids3D`](https://rerun.io/docs/reference/types/archetypes/ellipsoids3d) will draw a wireframe triangle mesh that approximates each ellipsoid. -* For [`archetypes.Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d), it is the edges of the box, identical to `MajorWireframe`. +* For [`archetypes.Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d), it is the edges of the box, identical to [`components.FillMode#MajorWireframe`](https://rerun.io/docs/reference/types/components/fill_mode). #### `Solid` = 3 The surface of the shape is filled in with a solid color. No lines are drawn. diff --git a/docs/content/reference/types/datatypes/pixel_format.md b/docs/content/reference/types/datatypes/pixel_format.md index 187b03583fe0..9b44012f59bd 100644 --- a/docs/content/reference/types/datatypes/pixel_format.md +++ b/docs/content/reference/types/datatypes/pixel_format.md @@ -33,7 +33,7 @@ First comes entire image in Y in one plane, followed by a plane with interleaved lines ordered as U0, V0, U1, V1, etc. #### `YUY2` = 27 -`YUY2` (aka `YUYV`, `YUYV16` or `NV21`), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel. +`YUY2` (aka 'YUYV', 'YUYV16' or 'NV21'), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel. This uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240]. diff --git a/docs/content/reference/types/views/spatial2d_view.md b/docs/content/reference/types/views/spatial2d_view.md index 958e931f5efd..d7a752d0212a 100644 --- a/docs/content/reference/types/views/spatial2d_view.md +++ b/docs/content/reference/types/views/spatial2d_view.md @@ -11,7 +11,7 @@ For viewing spatial 2D data. Configuration for the background of the view. * `kind`: The type of the background. -* `color`: Color used for the `SolidColor` background type. +* `color`: Color used for the solid background type. ### `visual_bounds` The visible parts of the scene, in the coordinate space of the scene. diff --git a/docs/content/reference/types/views/spatial3d_view.md b/docs/content/reference/types/views/spatial3d_view.md index a6efe92e9ac1..47d2adab291b 100644 --- a/docs/content/reference/types/views/spatial3d_view.md +++ b/docs/content/reference/types/views/spatial3d_view.md @@ -11,7 +11,7 @@ For viewing spatial 3D data. Configuration for the background of the view. * `kind`: The type of the background. -* `color`: Color used for the `SolidColor` background type. +* `color`: Color used for the solid background type. ### `line_grid` Configuration for the 3D line grid. diff --git a/rerun_cpp/src/rerun/archetypes/graph_edges.hpp b/rerun_cpp/src/rerun/archetypes/graph_edges.hpp index 65863e21c154..4e60d8e23d82 100644 --- a/rerun_cpp/src/rerun/archetypes/graph_edges.hpp +++ b/rerun_cpp/src/rerun/archetypes/graph_edges.hpp @@ -28,7 +28,7 @@ namespace rerun::archetypes { /// Specifies if the graph is directed or undirected. /// - /// If no `GraphType` is provided, the graph is assumed to be undirected. + /// If no `components::GraphType` is provided, the graph is assumed to be undirected. std::optional graph_type; public: @@ -47,7 +47,7 @@ namespace rerun::archetypes { /// Specifies if the graph is directed or undirected. /// - /// If no `GraphType` is provided, the graph is assumed to be undirected. + /// If no `components::GraphType` is provided, the graph is assumed to be undirected. GraphEdges with_graph_type(rerun::components::GraphType _graph_type) && { graph_type = std::move(_graph_type); // See: https://github.com/rerun-io/rerun/issues/4027 diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/background.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/background.hpp index 044b3b3cff1e..4f66607a5cb4 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/background.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/background.hpp @@ -22,7 +22,7 @@ namespace rerun::blueprint::archetypes { /// The type of the background. rerun::blueprint::components::BackgroundKind kind; - /// Color used for the `SolidColor` background type. + /// Color used for the solid background type. std::optional color; public: @@ -39,7 +39,7 @@ namespace rerun::blueprint::archetypes { explicit Background(rerun::blueprint::components::BackgroundKind _kind) : kind(std::move(_kind)) {} - /// Color used for the `SolidColor` background type. + /// Color used for the solid background type. Background with_color(rerun::components::Color _color) && { color = std::move(_color); // See: https://github.com/rerun-io/rerun/issues/4027 diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp index 9e7d8ae594ce..19377b7ab6f7 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp @@ -36,16 +36,16 @@ namespace rerun::blueprint::archetypes { /// The layout shares of each column in the container. /// - /// For `Horizontal` containers, the length of this list should always match the number of contents. + /// For `components::ContainerKind::Horizontal` containers, the length of this list should always match the number of contents. /// - /// Ignored for `Vertical` containers. + /// Ignored for `components::ContainerKind::Vertical` containers. std::optional> col_shares; /// The layout shares of each row of the container. /// - /// For `Vertical` containers, the length of this list should always match the number of contents. + /// For `components::ContainerKind::Vertical` containers, the length of this list should always match the number of contents. /// - /// Ignored for `Horizontal` containers. + /// Ignored for `components::ContainerKind::Horizontal` containers. std::optional> row_shares; /// Which tab is active. @@ -62,7 +62,7 @@ namespace rerun::blueprint::archetypes { /// /// If unset, the grid layout will be auto. /// - /// Ignored for `Horizontal`/`Vertical` containers. + /// Ignored for `components::ContainerKind::Horizontal`/`components::ContainerKind::Vertical` containers. std::optional grid_columns; public: @@ -97,9 +97,9 @@ namespace rerun::blueprint::archetypes { /// The layout shares of each column in the container. /// - /// For `Horizontal` containers, the length of this list should always match the number of contents. + /// For `components::ContainerKind::Horizontal` containers, the length of this list should always match the number of contents. /// - /// Ignored for `Vertical` containers. + /// Ignored for `components::ContainerKind::Vertical` containers. ContainerBlueprint with_col_shares( Collection _col_shares ) && { @@ -110,9 +110,9 @@ namespace rerun::blueprint::archetypes { /// The layout shares of each row of the container. /// - /// For `Vertical` containers, the length of this list should always match the number of contents. + /// For `components::ContainerKind::Vertical` containers, the length of this list should always match the number of contents. /// - /// Ignored for `Horizontal` containers. + /// Ignored for `components::ContainerKind::Horizontal` containers. ContainerBlueprint with_row_shares( Collection _row_shares ) && { @@ -143,7 +143,7 @@ namespace rerun::blueprint::archetypes { /// /// If unset, the grid layout will be auto. /// - /// Ignored for `Horizontal`/`Vertical` containers. + /// Ignored for `components::ContainerKind::Horizontal`/`components::ContainerKind::Vertical` containers. ContainerBlueprint with_grid_columns(rerun::blueprint::components::GridColumns _grid_columns ) && { grid_columns = std::move(_grid_columns); diff --git a/rerun_cpp/src/rerun/blueprint/components/visualizer_overrides.hpp b/rerun_cpp/src/rerun/blueprint/components/visualizer_overrides.hpp index 4445c860f934..62b251c8253b 100644 --- a/rerun_cpp/src/rerun/blueprint/components/visualizer_overrides.hpp +++ b/rerun_cpp/src/rerun/blueprint/components/visualizer_overrides.hpp @@ -26,29 +26,6 @@ namespace rerun::blueprint::components { /// in a regular entity. struct VisualizerOverrides { /// Names of the visualizers that should be active. - /// - /// The built-in visualizers are: - /// - `BarChart` - /// - `Arrows2D` - /// - `Arrows3D` - /// - `Asset3D` - /// - `Boxes2D` - /// - `Boxes3D` - /// - `Cameras` - /// - `DepthImage` - /// - `Image` - /// - `Lines2D` - /// - `Lines3D` - /// - `Mesh3D` - /// - `Points2D` - /// - `Points3D` - /// - `Transform3DArrows` - /// - `Tensor` - /// - `TextDocument` - /// - `TextLog` - /// - `SegmentationImage` - /// - `SeriesLine` - /// - `SeriesPoint` rerun::blueprint::datatypes::Utf8List visualizers; public: diff --git a/rerun_cpp/src/rerun/components/fill_mode.hpp b/rerun_cpp/src/rerun/components/fill_mode.hpp index 69ddbcc8844d..34ade53cd3da 100644 --- a/rerun_cpp/src/rerun/components/fill_mode.hpp +++ b/rerun_cpp/src/rerun/components/fill_mode.hpp @@ -30,7 +30,7 @@ namespace rerun::components { /// /// * An `archetypes::Ellipsoids3D` will draw three axis-aligned ellipses that are cross-sections /// of each ellipsoid, each of which displays two out of three of the sizes of the ellipsoid. - /// * For `archetypes::Boxes3D`, it is the edges of the box, identical to `DenseWireframe`. + /// * For `archetypes::Boxes3D`, it is the edges of the box, identical to `components::FillMode::DenseWireframe`. MajorWireframe = 1, /// Many lines are drawn to represent the surface of the shape in a see-through fashion. @@ -39,7 +39,7 @@ namespace rerun::components { /// /// * An `archetypes::Ellipsoids3D` will draw a wireframe triangle mesh that approximates each /// ellipsoid. - /// * For `archetypes::Boxes3D`, it is the edges of the box, identical to `MajorWireframe`. + /// * For `archetypes::Boxes3D`, it is the edges of the box, identical to `components::FillMode::MajorWireframe`. DenseWireframe = 2, /// The surface of the shape is filled in with a solid color. No lines are drawn. diff --git a/rerun_cpp/src/rerun/datatypes/pixel_format.hpp b/rerun_cpp/src/rerun/datatypes/pixel_format.hpp index d4123bdebe2c..8130cec4f77b 100644 --- a/rerun_cpp/src/rerun/datatypes/pixel_format.hpp +++ b/rerun_cpp/src/rerun/datatypes/pixel_format.hpp @@ -50,7 +50,7 @@ namespace rerun::datatypes { /// followed by a plane with interleaved lines ordered as U0, V0, U1, V1, etc. NV12 = 26, - /// `YUY2` (aka `YUYV`, `YUYV16` or `NV21`), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel. + /// `YUY2` (aka 'YUYV', 'YUYV16' or 'NV21'), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel. /// /// This uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240]. /// diff --git a/rerun_py/rerun_sdk/rerun/archetypes/graph_edges.py b/rerun_py/rerun_sdk/rerun/archetypes/graph_edges.py index efd87dbb8f19..4fa4c6017d9b 100644 --- a/rerun_py/rerun_sdk/rerun/archetypes/graph_edges.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/graph_edges.py @@ -39,7 +39,7 @@ def __init__(self: Any, edges: datatypes.Utf8PairArrayLike, *, graph_type: compo graph_type: Specifies if the graph is directed or undirected. - If no `GraphType` is provided, the graph is assumed to be undirected. + If no [`components.GraphType`][rerun.components.GraphType] is provided, the graph is assumed to be undirected. """ @@ -78,7 +78,7 @@ def _clear(cls) -> GraphEdges: ) # Specifies if the graph is directed or undirected. # - # If no `GraphType` is provided, the graph is assumed to be undirected. + # If no [`components.GraphType`][rerun.components.GraphType] is provided, the graph is assumed to be undirected. # # (Docstring intentionally commented out to hide this field from the docs) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/background.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/background.py index 96d90e5ae39e..cbe9178d7911 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/background.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/background.py @@ -50,7 +50,7 @@ def _clear(cls) -> Background: default=None, converter=components.ColorBatch._optional, # type: ignore[misc] ) - # Color used for the `SolidColor` background type. + # Color used for the solid background type. # # (Docstring intentionally commented out to hide this field from the docs) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/container_blueprint.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/container_blueprint.py index dc23b161a5a7..967fab8cb43c 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/container_blueprint.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/container_blueprint.py @@ -49,15 +49,15 @@ def __init__( col_shares: The layout shares of each column in the container. - For `Horizontal` containers, the length of this list should always match the number of contents. + For [`components.ContainerKind.Horizontal`][rerun.blueprint.components.ContainerKind.Horizontal] containers, the length of this list should always match the number of contents. - Ignored for `Vertical` containers. + Ignored for [`components.ContainerKind.Vertical`][rerun.blueprint.components.ContainerKind.Vertical] containers. row_shares: The layout shares of each row of the container. - For `Vertical` containers, the length of this list should always match the number of contents. + For [`components.ContainerKind.Vertical`][rerun.blueprint.components.ContainerKind.Vertical] containers, the length of this list should always match the number of contents. - Ignored for `Horizontal` containers. + Ignored for [`components.ContainerKind.Horizontal`][rerun.blueprint.components.ContainerKind.Horizontal] containers. active_tab: Which tab is active. @@ -71,7 +71,7 @@ def __init__( If unset, the grid layout will be auto. - Ignored for `Horizontal`/`Vertical` containers. + Ignored for [`components.ContainerKind.Horizontal`][rerun.blueprint.components.ContainerKind.Horizontal]/[`components.ContainerKind.Vertical`][rerun.blueprint.components.ContainerKind.Vertical] containers. """ @@ -143,9 +143,9 @@ def _clear(cls) -> ContainerBlueprint: ) # The layout shares of each column in the container. # - # For `Horizontal` containers, the length of this list should always match the number of contents. + # For [`components.ContainerKind.Horizontal`][rerun.blueprint.components.ContainerKind.Horizontal] containers, the length of this list should always match the number of contents. # - # Ignored for `Vertical` containers. + # Ignored for [`components.ContainerKind.Vertical`][rerun.blueprint.components.ContainerKind.Vertical] containers. # # (Docstring intentionally commented out to hide this field from the docs) @@ -156,9 +156,9 @@ def _clear(cls) -> ContainerBlueprint: ) # The layout shares of each row of the container. # - # For `Vertical` containers, the length of this list should always match the number of contents. + # For [`components.ContainerKind.Vertical`][rerun.blueprint.components.ContainerKind.Vertical] containers, the length of this list should always match the number of contents. # - # Ignored for `Horizontal` containers. + # Ignored for [`components.ContainerKind.Horizontal`][rerun.blueprint.components.ContainerKind.Horizontal] containers. # # (Docstring intentionally commented out to hide this field from the docs) @@ -193,7 +193,7 @@ def _clear(cls) -> ContainerBlueprint: # # If unset, the grid layout will be auto. # - # Ignored for `Horizontal`/`Vertical` containers. + # Ignored for [`components.ContainerKind.Horizontal`][rerun.blueprint.components.ContainerKind.Horizontal]/[`components.ContainerKind.Vertical`][rerun.blueprint.components.ContainerKind.Vertical] containers. # # (Docstring intentionally commented out to hide this field from the docs) diff --git a/rerun_py/rerun_sdk/rerun/components/fill_mode.py b/rerun_py/rerun_sdk/rerun/components/fill_mode.py index 02ede1978d32..8b4d664a6ec4 100644 --- a/rerun_py/rerun_sdk/rerun/components/fill_mode.py +++ b/rerun_py/rerun_sdk/rerun/components/fill_mode.py @@ -32,7 +32,7 @@ class FillMode(Enum): * An [`archetypes.Ellipsoids3D`][rerun.archetypes.Ellipsoids3D] will draw three axis-aligned ellipses that are cross-sections of each ellipsoid, each of which displays two out of three of the sizes of the ellipsoid. - * For [`archetypes.Boxes3D`][rerun.archetypes.Boxes3D], it is the edges of the box, identical to `DenseWireframe`. + * For [`archetypes.Boxes3D`][rerun.archetypes.Boxes3D], it is the edges of the box, identical to [`components.FillMode.DenseWireframe`][rerun.components.FillMode.DenseWireframe]. """ DenseWireframe = 2 @@ -43,7 +43,7 @@ class FillMode(Enum): * An [`archetypes.Ellipsoids3D`][rerun.archetypes.Ellipsoids3D] will draw a wireframe triangle mesh that approximates each ellipsoid. - * For [`archetypes.Boxes3D`][rerun.archetypes.Boxes3D], it is the edges of the box, identical to `MajorWireframe`. + * For [`archetypes.Boxes3D`][rerun.archetypes.Boxes3D], it is the edges of the box, identical to [`components.FillMode.MajorWireframe`][rerun.components.FillMode.MajorWireframe]. """ Solid = 3 diff --git a/rerun_py/rerun_sdk/rerun/datatypes/pixel_format.py b/rerun_py/rerun_sdk/rerun/datatypes/pixel_format.py index e7505a40720c..5728c69895c0 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/pixel_format.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/pixel_format.py @@ -56,7 +56,7 @@ class PixelFormat(Enum): YUY2 = 27 """ - `YUY2` (aka `YUYV`, `YUYV16` or `NV21`), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel. + `YUY2` (aka 'YUYV', 'YUYV16' or 'NV21'), is a YUV 4:2:2 chroma downsampled format with 16 bits per pixel and 8 bits per channel. This uses limited range YUV, i.e. Y is expected to be within [16, 235] and U/V within [16, 240]. From 067c63711ec86fa4724566d6b57627215f68f124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Mon, 9 Dec 2024 16:54:23 +0100 Subject: [PATCH 02/71] Make Position2D components editable in selection panel (#8357) ### Related * Part of #8299 ### What This adds a simple single line edit for position 2D. There is no `speed_fn` because I think in most applications UI coordinates are probably good unit (for example in graphs). https://github.com/user-attachments/assets/2fad00c4-8e68-40fe-a474-32fa5806814e --------- Co-authored-by: Andreas Reich --- .../re_component_ui/src/datatype_uis/mod.rs | 2 +- .../re_component_ui/src/datatype_uis/vec.rs | 109 ++++++++++++------ crates/viewer/re_component_ui/src/lib.rs | 13 ++- 3 files changed, 85 insertions(+), 39 deletions(-) diff --git a/crates/viewer/re_component_ui/src/datatype_uis/mod.rs b/crates/viewer/re_component_ui/src/datatype_uis/mod.rs index 9a8db3c714f9..5147a63dac32 100644 --- a/crates/viewer/re_component_ui/src/datatype_uis/mod.rs +++ b/crates/viewer/re_component_ui/src/datatype_uis/mod.rs @@ -20,6 +20,6 @@ pub use range1d::edit_view_range1d; pub use singleline_string::{ display_name_ui, display_text_ui, edit_multiline_string, edit_singleline_string, }; -pub use vec::{edit_or_view_vec3d, edit_or_view_vec3d_raw}; +pub use vec::{edit_or_view_vec2d, edit_or_view_vec3d, edit_or_view_vec3d_raw}; pub use view_id::view_view_id; pub use view_uuid::view_uuid; diff --git a/crates/viewer/re_component_ui/src/datatype_uis/vec.rs b/crates/viewer/re_component_ui/src/datatype_uis/vec.rs index 2c06dd16c505..799c110bf008 100644 --- a/crates/viewer/re_component_ui/src/datatype_uis/vec.rs +++ b/crates/viewer/re_component_ui/src/datatype_uis/vec.rs @@ -1,7 +1,20 @@ +use std::ops::RangeInclusive; + +use egui::NumExt as _; use re_types::datatypes; use re_viewer_context::MaybeMutRef; -use super::float_drag::edit_f32_float_raw; +pub fn edit_or_view_vec2d( + _ctx: &re_viewer_context::ViewerContext<'_>, + ui: &mut egui::Ui, + value: &mut MaybeMutRef<'_, impl std::ops::DerefMut>, +) -> egui::Response { + let mut value: MaybeMutRef<'_, datatypes::Vec2D> = match value { + MaybeMutRef::Ref(value) => MaybeMutRef::Ref(value), + MaybeMutRef::MutRef(value) => MaybeMutRef::MutRef(value), + }; + edit_or_view_vec2d_raw(ui, &mut value) +} pub fn edit_or_view_vec3d( _ctx: &re_viewer_context::ViewerContext<'_>, @@ -12,50 +25,80 @@ pub fn edit_or_view_vec3d( MaybeMutRef::Ref(value) => MaybeMutRef::Ref(value), MaybeMutRef::MutRef(value) => MaybeMutRef::MutRef(value), }; - edit_or_view_vec3d_raw_immutable(ui, &mut value) + edit_or_view_vec3d_raw(ui, &mut value) } -// TODO(#6743): Since overrides are not yet taken into account, editing this value has no effect. -//MaybeMutRef::MutRef(value) => MaybeMutRef::MutRef(&mut value[i]), -fn edit_or_view_vec3d_raw_immutable( - ui: &mut egui::Ui, - value: &mut MaybeMutRef<'_, datatypes::Vec3D>, -) -> egui::Response { - edit_or_view_vector_component_immutable(ui, value, 0) - | edit_or_view_vector_component_immutable(ui, value, 1) - | edit_or_view_vector_component_immutable(ui, value, 2) +fn drag<'a>(value: &'a mut f32, range: RangeInclusive, suffix: &str) -> egui::DragValue<'a> { + let speed = (value.abs() * 0.01).at_least(0.001); + egui::DragValue::new(value) + .clamp_existing_to_range(false) + .range(range) + .speed(speed) + .suffix(suffix) } -fn edit_or_view_vector_component_immutable( +// TODO(#6743): Since overrides are not yet taken into account, editing this value has no effect. +pub fn edit_or_view_vec2d_raw( ui: &mut egui::Ui, - value: &mut MaybeMutRef<'_, datatypes::Vec3D>, - i: usize, + value: &mut MaybeMutRef<'_, datatypes::Vec2D>, ) -> egui::Response { - let mut value: MaybeMutRef<'_, f32> = match value { - MaybeMutRef::Ref(value) => MaybeMutRef::Ref(&value[i]), + let x = value.0[0]; + let y = value.0[1]; - MaybeMutRef::MutRef(value) => MaybeMutRef::Ref(&value[i]), - }; - edit_f32_float_raw(ui, &mut value, f32::MIN..=f32::MAX, "") + if let Some(value) = value.as_mut() { + let mut x_edit = x; + let mut y_edit = y; + + let response_x = ui.add(drag(&mut x_edit, f32::MIN..=f32::MAX, "")); + let response_y = ui.add(drag(&mut y_edit, f32::MIN..=f32::MAX, "")); + + let response = response_y | response_x; + + if response.changed() { + *value = datatypes::Vec2D([x_edit, y_edit]); + } + + response + } else { + ui.label(format!( + "[ {} , {} ]", + re_format::format_f32(x), + re_format::format_f32(y), + )) + } } +// TODO(#6743): Since overrides are not yet taken into account, editing this value has no effect. pub fn edit_or_view_vec3d_raw( ui: &mut egui::Ui, value: &mut MaybeMutRef<'_, datatypes::Vec3D>, ) -> egui::Response { - edit_or_view_vector_component(ui, value, 0) - | edit_or_view_vector_component(ui, value, 1) - | edit_or_view_vector_component(ui, value, 2) -} + let x = value.0[0]; + let y = value.0[1]; + let z = value.0[2]; -fn edit_or_view_vector_component( - ui: &mut egui::Ui, - value: &mut MaybeMutRef<'_, datatypes::Vec3D>, - i: usize, -) -> egui::Response { - let mut value: MaybeMutRef<'_, f32> = match value { - MaybeMutRef::Ref(value) => MaybeMutRef::Ref(&value[i]), - MaybeMutRef::MutRef(value) => MaybeMutRef::MutRef(&mut value[i]), - }; - edit_f32_float_raw(ui, &mut value, f32::MIN..=f32::MAX, "") + if let Some(value) = value.as_mut() { + let mut x_edit = x; + let mut y_edit = y; + let mut z_edit = z; + + let response_x = ui.add(drag(&mut x_edit, f32::MIN..=f32::MAX, "")); + let response_y = ui.add(drag(&mut y_edit, f32::MIN..=f32::MAX, "")); + let response_z = ui.add(drag(&mut z_edit, f32::MIN..=f32::MAX, "")); + + let response = response_y | response_x | response_z; + + if response.changed() { + *value = datatypes::Vec3D([x_edit, y_edit, z_edit]); + } + + response + } else { + ui.label(format!( + "[ {} , {} , {} ]", + re_format::format_f32(x), + re_format::format_f32(y), + re_format::format_f32(z), + )) + } } diff --git a/crates/viewer/re_component_ui/src/lib.rs b/crates/viewer/re_component_ui/src/lib.rs index 55b7da2d4730..7460795c9fc5 100644 --- a/crates/viewer/re_component_ui/src/lib.rs +++ b/crates/viewer/re_component_ui/src/lib.rs @@ -28,9 +28,9 @@ mod zoom_level; use datatype_uis::{ display_name_ui, display_text_ui, edit_bool, edit_f32_min_to_max_float, edit_f32_zero_to_max, - edit_f32_zero_to_one, edit_multiline_string, edit_or_view_vec3d, edit_singleline_string, - edit_ui_points, edit_view_enum, edit_view_enum_with_variant_available, edit_view_range1d, - view_uuid, view_view_id, + edit_f32_zero_to_one, edit_multiline_string, edit_or_view_vec2d, edit_or_view_vec3d, + edit_singleline_string, edit_ui_points, edit_view_enum, edit_view_enum_with_variant_available, + edit_view_range1d, view_uuid, view_view_id, }; use re_types::{ @@ -40,8 +40,8 @@ use re_types::{ components::{ AggregationPolicy, AlbedoFactor, AxisLength, Color, DepthMeter, DrawOrder, FillMode, FillRatio, GammaCorrection, GraphType, ImagePlaneDistance, MagnificationFilter, MarkerSize, - Name, Opacity, Range1D, Scale3D, ShowLabels, StrokeWidth, Text, TransformRelation, - Translation3D, ValueRange, + Name, Opacity, Position2D, Range1D, Scale3D, ShowLabels, StrokeWidth, Text, + TransformRelation, Translation3D, ValueRange, }, Component as _, }; @@ -114,6 +114,9 @@ pub fn create_component_ui_registry() -> re_viewer_context::ComponentUiRegistry registry.add_singleline_edit_or_view::(edit_view_enum); registry.add_singleline_edit_or_view::(edit_view_enum); + // Vec2 components: + registry.add_singleline_edit_or_view::(edit_or_view_vec2d); + // Vec3 components: registry.add_singleline_edit_or_view::(edit_or_view_vec3d); registry.add_singleline_edit_or_view::(edit_or_view_vec3d); From 30298c67f7b6b2d8693ab602219a29eed43060eb Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Mon, 9 Dec 2024 17:44:13 +0100 Subject: [PATCH 03/71] Fix `re_types_builder` tests for doc generation (#8370) Follow-up to * https://github.com/rerun-io/rerun/pull/8331 --- crates/build/re_types_builder/src/docs.rs | 298 +++++++++++----------- 1 file changed, 146 insertions(+), 152 deletions(-) diff --git a/crates/build/re_types_builder/src/docs.rs b/crates/build/re_types_builder/src/docs.rs index 52d8a3c20166..e22558450a02 100644 --- a/crates/build/re_types_builder/src/docs.rs +++ b/crates/build/re_types_builder/src/docs.rs @@ -438,7 +438,7 @@ mod doclink_translation { }) } - fn tokenize(input: &str) -> Vec<&str> { + pub(super) fn tokenize(input: &str) -> Vec<&str> { tokenize_with(input, &['[', ']', '`', '.']) } @@ -458,166 +458,157 @@ mod doclink_translation { } tokens } +} - #[cfg(test)] - mod tests { - use crate::{Attributes, Docs, Object, Objects}; - - use super::*; - - fn test_objects() -> Objects { - Objects { - objects: std::iter::once(( - "rerun.views.Spatial2DView".to_owned(), - Object { - virtpath: "path".to_owned(), - filepath: "path".into(), - fqname: "rerun.views.Spatial2DView".to_owned(), - pkg_name: "test".to_owned(), - name: "Spatial2DView".to_owned(), - docs: Docs::default(), - kind: ObjectKind::View, - attrs: Attributes::default(), - fields: Vec::new(), - class: crate::ObjectClass::Struct, - datatype: None, - }, - )) - .collect(), - } +#[cfg(test)] +mod tests { + use crate::{ + codegen::Target, + docs::doclink_translation::{tokenize, translate_doc_line}, + Attributes, Docs, Object, ObjectKind, Objects, + }; + + fn test_objects() -> Objects { + Objects { + objects: std::iter::once(( + "rerun.views.Spatial2DView".to_owned(), + Object { + virtpath: "path".to_owned(), + filepath: "path".into(), + fqname: "rerun.views.Spatial2DView".to_owned(), + pkg_name: "test".to_owned(), + name: "Spatial2DView".to_owned(), + docs: Docs::default(), + kind: ObjectKind::View, + attrs: Attributes::default(), + fields: Vec::new(), + class: crate::ObjectClass::Struct, + datatype: None, + }, + )) + .collect(), } + } - #[test] - fn test_tokenize() { - assert_eq!(tokenize("This is a comment"), vec!["This is a comment"]); - assert_eq!( - tokenize("A vector `[1, 2, 3]` and a doclink [archetype.Image]."), - vec![ - "A vector ", - "`", - "[", - "1, 2, 3", - "]", - "`", - " and a doclink ", - "[", - "archetype", - ".", - "Image", - "]", - "." - ] - ); - } + #[test] + fn test_tokenize() { + assert_eq!(tokenize("This is a comment"), vec!["This is a comment"]); + assert_eq!( + tokenize("A vector `[1, 2, 3]` and a doclink [archetype.Image]."), + vec![ + "A vector ", + "`", + "[", + "1, 2, 3", + "]", + "`", + " and a doclink ", + "[", + "archetype", + ".", + "Image", + "]", + "." + ] + ); + } - #[test] - fn test_translate_doclinks() { - let objects = test_objects(); - let (_report, reporter) = crate::report::init(); - - let input = - "A vector `[1, 2, 3]` and a doclink [views.Spatial2DView] and a [url](www.rerun.io)."; - - assert_eq!( - translate_doc_line( - &reporter, - &objects, - input, - Target::Cpp - ), - "A vector `[1, 2, 3]` and a doclink `views::Spatial2DView` and a [url](www.rerun.io)." - ); - - assert_eq!( - translate_doc_line( - &reporter, - &objects, - input, - Target::Python - ), - "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView`][rerun.blueprint.views.Spatial2DView] and a [url](www.rerun.io)." - ); - - assert_eq!( - translate_doc_line( - &reporter, - &objects, - input, - Target::Rust - ), - "A vector `[1, 2, 3]` and a doclink [`views::Spatial2DView`][crate::blueprint::views::Spatial2DView] and a [url](www.rerun.io)." - ); - - assert_eq!( - translate_doc_line( - &reporter, - &objects, - input, - Target::WebDocsMarkdown - ), - "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view) and a [url](www.rerun.io)." - ); - } + #[test] + fn test_translate_doclinks() { + let objects = test_objects(); + let (_report, reporter) = crate::report::init(); - #[test] - fn test_translate_doclinks_with_field() { - let objects = test_objects(); - let (_report, reporter) = crate::report::init(); - - let input = - "A vector `[1, 2, 3]` and a doclink [views.Spatial2DView.position] and a [url](www.rerun.io)."; - - assert_eq!( - translate_doc_line( - &reporter, - &objects, - input, - Target::Cpp - ), - "A vector `[1, 2, 3]` and a doclink `views::Spatial2DView::position` and a [url](www.rerun.io)." - ); - - assert_eq!( - translate_doc_line( - &reporter, - &objects, - input, - Target::Python - ), - "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView.position`][rerun.blueprint.views.Spatial2DView.position] and a [url](www.rerun.io)." - ); - - assert_eq!( - translate_doc_line( - &reporter, - &objects, - input, - Target::Rust - ), - "A vector `[1, 2, 3]` and a doclink [`views::Spatial2DView::position`][crate::blueprint::views::Spatial2DView::position] and a [url](www.rerun.io)." - ); - - assert_eq!( - translate_doc_line( - &reporter, - &objects, - input, - Target::WebDocsMarkdown - ), - "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView#position`](https://rerun.io/docs/reference/types/views/spatial2d_view) and a [url](www.rerun.io)." - ); - } + let input = + "A vector `[1, 2, 3]` and a doclink [views.Spatial2DView] and a [url](www.rerun.io)."; + + assert_eq!( + translate_doc_line(&reporter, &objects, input, Target::Cpp), + "A vector `[1, 2, 3]` and a doclink `views::Spatial2DView` and a [url](www.rerun.io)." + ); + + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::Python + ), + "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView`][rerun.blueprint.views.Spatial2DView] and a [url](www.rerun.io)." + ); + + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::Rust + ), + "A vector `[1, 2, 3]` and a doclink [`views::Spatial2DView`][crate::blueprint::views::Spatial2DView] and a [url](www.rerun.io)." + ); + + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::WebDocsMarkdown + ), + "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view) and a [url](www.rerun.io)." + ); } -} -#[cfg(test)] -mod tests { + #[test] + fn test_translate_doclinks_with_field() { + let objects = test_objects(); + let (_report, reporter) = crate::report::init(); + + let input = + "A vector `[1, 2, 3]` and a doclink [views.Spatial2DView.position] and a [url](www.rerun.io)."; + + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::Cpp + ), + "A vector `[1, 2, 3]` and a doclink `views::Spatial2DView::position` and a [url](www.rerun.io)." + ); + + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::Python + ), + "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView.position`][rerun.blueprint.views.Spatial2DView.position] and a [url](www.rerun.io)." + ); + + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::Rust + ), + "A vector `[1, 2, 3]` and a doclink [`views::Spatial2DView::position`][crate::blueprint::views::Spatial2DView::position] and a [url](www.rerun.io)." + ); - use super::*; + assert_eq!( + translate_doc_line( + &reporter, + &objects, + input, + Target::WebDocsMarkdown + ), + "A vector `[1, 2, 3]` and a doclink [`views.Spatial2DView#position`](https://rerun.io/docs/reference/types/views/spatial2d_view) and a [url](www.rerun.io)." + ); + } #[test] fn test_docs() { - let objects = Objects::default(); + let objects = test_objects(); let (_report, reporter) = crate::report::init(); let docs = Docs::from_lines( @@ -645,7 +636,7 @@ mod tests { assert_eq!( docs.lines_for(&reporter, &objects, Target::Python), vec![ - "Doclink to [`views.Spatial2DView`][rerun.views.Spatial2DView].", + "Doclink to [`views.Spatial2DView`][rerun.blueprint.views.Spatial2DView].", "", "The second line.", "", @@ -670,7 +661,10 @@ mod tests { assert_eq!( docs.first_line(&reporter, &objects, Target::Rust), - Some("Doclink to [`views::Spatial2DView`][crate::views::Spatial2DView].".to_owned()) + Some( + "Doclink to [`views::Spatial2DView`][crate::blueprint::views::Spatial2DView]." + .to_owned() + ) ); } } From 29c1f83b6be831b88bf3fafc2c2fdfea913437bc Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 9 Dec 2024 19:31:32 +0100 Subject: [PATCH 04/71] Make the near clipping plane editable in 2D views (#8348) ### What This adjusts the value to now be in physical scene units. I.e. for most 3d scenes in meters, the clip plane will be 10cm, which is a very reasonable default. Additionally, this gives users an escape hatch for scenes where the default clipping plane causes their data to not be visible. Test script: ```python import rerun as rr import rerun.blueprint as rrb import numpy as np rr.init("rerun_example_pinhole_perspective", spawn=True) img = np.zeros((300, 300, 3), dtype=np.uint8) cam_proj = [152.34006, 0, 175.5, 0, 152.34006, 175.5, 0, 0, 1] rr.log( "world/cam", rr.Pinhole( image_from_camera=cam_proj, width=300, height=300, image_plane_distance=0.1 ), ) rr.log("world/cam", rr.Image(img)) rr.log( "world/points", rr.Points3D([(0.0, 0.5, 0.1), (0.1, 0.1, 0.3), (-0.1, -0.1, 0.5)], radii=0.025), ) rr.log_file_from_path("examples/assets/example.gltf") rr.log("examples/assets", rr.Transform3D(translation=[0, 0, 0.4], scale=0.05)) rr.send_blueprint( rrb.Horizontal( rrb.Spatial3DView(), rrb.Spatial2DView( origin="world/cam", contents="/**", visual_bounds=rrb.VisualBounds2D( near_clip_plane=0.01, ), ), ) ) ``` ### New issues: - https://github.com/rerun-io/rerun/issues/8373 --- .../blueprint/archetypes/visual_bounds2d.fbs | 5 + .../rerun/blueprint/components.fbs | 1 + .../blueprint/components/near_clip_plane.fbs | 14 +++ .../blueprint/archetypes/visual_bounds2d.rs | 63 ++++++++-- .../src/blueprint/components/.gitattributes | 1 + .../re_types/src/blueprint/components/mod.rs | 3 + .../blueprint/components/near_clip_plane.rs | 116 ++++++++++++++++++ .../components/near_clip_plane_ext.rs | 11 ++ crates/viewer/re_component_ui/src/lib.rs | 4 +- .../viewer/re_space_view_spatial/src/ui_2d.rs | 36 ++++-- .../src/blueprint/validation_gen/mod.rs | 2 + crates/viewer/re_viewer/src/reflection/mod.rs | 14 ++- .../reference/migration/migration-0-21.md | 27 ++++ .../reference/types/views/graph_view.md | 3 + .../reference/types/views/spatial2d_view.md | 3 + .../blueprint/archetypes/visual_bounds2d.cpp | 14 ++- .../blueprint/archetypes/visual_bounds2d.hpp | 13 +- rerun_cpp/src/rerun/blueprint/components.hpp | 1 + .../rerun/blueprint/components/.gitattributes | 1 + .../blueprint/components/near_clip_plane.hpp | 79 ++++++++++++ .../blueprint/archetypes/visual_bounds2d.py | 11 ++ .../archetypes/visual_bounds2d_ext.py | 19 ++- .../rerun/blueprint/components/.gitattributes | 1 + .../rerun/blueprint/components/__init__.py | 3 + .../blueprint/components/near_clip_plane.py | 33 +++++ 25 files changed, 449 insertions(+), 29 deletions(-) create mode 100644 crates/store/re_types/definitions/rerun/blueprint/components/near_clip_plane.fbs create mode 100644 crates/store/re_types/src/blueprint/components/near_clip_plane.rs create mode 100644 crates/store/re_types/src/blueprint/components/near_clip_plane_ext.rs create mode 100644 docs/content/reference/migration/migration-0-21.md create mode 100644 rerun_cpp/src/rerun/blueprint/components/near_clip_plane.hpp create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/near_clip_plane.py diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/visual_bounds2d.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/visual_bounds2d.fbs index 0e9dc2719a57..21b8599e5383 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/visual_bounds2d.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/visual_bounds2d.fbs @@ -16,4 +16,9 @@ table VisualBounds2D ( /// /// Use this to control pan & zoom of the view. range: rerun.blueprint.components.VisualBounds2D ("attr.rerun.component_required", order: 1000); + + /// Controls the distance to the near clip plane in 3D scene units. + /// + /// Content closer than this distance will not be visible. + near_clip_plane: rerun.blueprint.components.NearClipPlane ("attr.rerun.component_optional", order: 2000); } diff --git a/crates/store/re_types/definitions/rerun/blueprint/components.fbs b/crates/store/re_types/definitions/rerun/blueprint/components.fbs index 1ee15c8acbe8..4f216593296d 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components.fbs @@ -17,6 +17,7 @@ include "./components/included_content.fbs"; include "./components/interactive.fbs"; include "./components/lock_range_during_zoom.fbs"; include "./components/map_provider.fbs"; +include "./components/near_clip_plane.fbs"; include "./components/panel_state.fbs"; include "./components/query_expression.fbs"; include "./components/root_container.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/near_clip_plane.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/near_clip_plane.fbs new file mode 100644 index 000000000000..200fc64ef33b --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/components/near_clip_plane.fbs @@ -0,0 +1,14 @@ +namespace rerun.blueprint.components; + +// --- + +/// Distance to the near clip plane used for `Spatial2DView`. +struct NearClipPlane ( + "attr.rerun.scope": "blueprint", + "attr.rust.derive": "Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable", + "attr.rust.repr": "transparent", + "attr.docs.unreleased" +) { + /// Distance to the near clip plane in 3D scene units. + near_clip_plane: rerun.datatypes.Float32 (order: 100); +} diff --git a/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs b/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs index 3de813191ef9..7cf84881ea80 100644 --- a/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs +++ b/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs @@ -31,6 +31,11 @@ pub struct VisualBounds2D { /// /// Use this to control pan & zoom of the view. pub range: crate::blueprint::components::VisualBounds2D, + + /// Controls the distance to the near clip plane in 3D scene units. + /// + /// Content closer than this distance will not be visible. + pub near_clip_plane: crate::blueprint::components::NearClipPlane, } static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = @@ -51,10 +56,16 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz }] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = - once_cell::sync::Lazy::new(|| []); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), + component_name: "rerun.blueprint.components.NearClipPlane".into(), + archetype_field_name: Some("near_clip_plane".into()), + }] + }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = once_cell::sync::Lazy::new(|| { [ ComponentDescriptor { @@ -67,12 +78,17 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = component_name: "VisualBounds2DIndicator".into(), archetype_field_name: None, }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), + component_name: "rerun.blueprint.components.NearClipPlane".into(), + archetype_field_name: Some("near_clip_plane".into()), + }, ] }); impl VisualBounds2D { - /// The total number of components in the archetype: 1 required, 1 recommended, 0 optional - pub const NUM_COMPONENTS: usize = 2usize; + /// The total number of components in the archetype: 1 required, 1 recommended, 1 optional + pub const NUM_COMPONENTS: usize = 3usize; } /// Indicator component for the [`VisualBounds2D`] [`::re_types_core::Archetype`] @@ -140,7 +156,23 @@ impl ::re_types_core::Archetype for VisualBounds2D { .ok_or_else(DeserializationError::missing_data) .with_context("rerun.blueprint.archetypes.VisualBounds2D#range")? }; - Ok(Self { range }) + let near_clip_plane = { + let array = arrays_by_name + .get("rerun.blueprint.components.NearClipPlane") + .ok_or_else(DeserializationError::missing_data) + .with_context("rerun.blueprint.archetypes.VisualBounds2D#near_clip_plane")?; + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.VisualBounds2D#near_clip_plane")? + .into_iter() + .next() + .flatten() + .ok_or_else(DeserializationError::missing_data) + .with_context("rerun.blueprint.archetypes.VisualBounds2D#near_clip_plane")? + }; + Ok(Self { + range, + near_clip_plane, + }) } } @@ -160,6 +192,16 @@ impl ::re_types_core::AsComponents for VisualBounds2D { }), } }), + (Some(&self.near_clip_plane as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), + archetype_field_name: Some(("near_clip_plane").into()), + component_name: ("rerun.blueprint.components.NearClipPlane").into(), + }), + } + }), ] .into_iter() .flatten() @@ -172,9 +214,13 @@ impl ::re_types_core::ArchetypeReflectionMarker for VisualBounds2D {} impl VisualBounds2D { /// Create a new `VisualBounds2D`. #[inline] - pub fn new(range: impl Into) -> Self { + pub fn new( + range: impl Into, + near_clip_plane: impl Into, + ) -> Self { Self { range: range.into(), + near_clip_plane: near_clip_plane.into(), } } } @@ -182,11 +228,12 @@ impl VisualBounds2D { impl ::re_types_core::SizeBytes for VisualBounds2D { #[inline] fn heap_size_bytes(&self) -> u64 { - self.range.heap_size_bytes() + self.range.heap_size_bytes() + self.near_clip_plane.heap_size_bytes() } #[inline] fn is_pod() -> bool { ::is_pod() + && ::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/components/.gitattributes b/crates/store/re_types/src/blueprint/components/.gitattributes index 238359328a19..65eeb1377804 100644 --- a/crates/store/re_types/src/blueprint/components/.gitattributes +++ b/crates/store/re_types/src/blueprint/components/.gitattributes @@ -15,6 +15,7 @@ interactive.rs linguist-generated=true lock_range_during_zoom.rs linguist-generated=true map_provider.rs linguist-generated=true mod.rs linguist-generated=true +near_clip_plane.rs linguist-generated=true panel_state.rs linguist-generated=true query_expression.rs linguist-generated=true row_share.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/components/mod.rs b/crates/store/re_types/src/blueprint/components/mod.rs index ca655d4e56b3..15647fbf1138 100644 --- a/crates/store/re_types/src/blueprint/components/mod.rs +++ b/crates/store/re_types/src/blueprint/components/mod.rs @@ -19,6 +19,8 @@ mod interactive; mod interactive_ext; mod lock_range_during_zoom; mod map_provider; +mod near_clip_plane; +mod near_clip_plane_ext; mod panel_state; mod panel_state_ext; mod query_expression; @@ -55,6 +57,7 @@ pub use self::included_content::IncludedContent; pub use self::interactive::Interactive; pub use self::lock_range_during_zoom::LockRangeDuringZoom; pub use self::map_provider::MapProvider; +pub use self::near_clip_plane::NearClipPlane; pub use self::panel_state::PanelState; pub use self::query_expression::QueryExpression; pub use self::row_share::RowShare; diff --git a/crates/store/re_types/src/blueprint/components/near_clip_plane.rs b/crates/store/re_types/src/blueprint/components/near_clip_plane.rs new file mode 100644 index 000000000000..b9caf19b944d --- /dev/null +++ b/crates/store/re_types/src/blueprint/components/near_clip_plane.rs @@ -0,0 +1,116 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/near_clip_plane.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: Distance to the near clip plane used for `Spatial2DView`. +#[derive(Clone, Debug, Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable)] +#[repr(transparent)] +pub struct NearClipPlane( + /// Distance to the near clip plane in 3D scene units. + pub crate::datatypes::Float32, +); + +impl ::re_types_core::Component for NearClipPlane { + #[inline] + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.NearClipPlane") + } +} + +::re_types_core::macros::impl_into_cow!(NearClipPlane); + +impl ::re_types_core::Loggable for NearClipPlane { + #[inline] + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Float32::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Float32::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Float32::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + } + + #[inline] + fn from_arrow2(arrow_data: &dyn arrow2::array::Array) -> DeserializationResult> + where + Self: Sized, + { + crate::datatypes::Float32::from_arrow2(arrow_data).map(bytemuck::cast_vec) + } +} + +impl> From for NearClipPlane { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for NearClipPlane { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::Deref for NearClipPlane { + type Target = crate::datatypes::Float32; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float32 { + &self.0 + } +} + +impl std::ops::DerefMut for NearClipPlane { + #[inline] + fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for NearClipPlane { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/components/near_clip_plane_ext.rs b/crates/store/re_types/src/blueprint/components/near_clip_plane_ext.rs new file mode 100644 index 000000000000..89f46e4246e6 --- /dev/null +++ b/crates/store/re_types/src/blueprint/components/near_clip_plane_ext.rs @@ -0,0 +1,11 @@ +use re_types_core::datatypes::Float32; + +use super::NearClipPlane; + +impl Default for NearClipPlane { + #[inline] + fn default() -> Self { + // Default near clip plane to reasonable distance for common cameras + Self(Float32(0.1)) + } +} diff --git a/crates/viewer/re_component_ui/src/lib.rs b/crates/viewer/re_component_ui/src/lib.rs index 7460795c9fc5..abe649c8b3a7 100644 --- a/crates/viewer/re_component_ui/src/lib.rs +++ b/crates/viewer/re_component_ui/src/lib.rs @@ -35,7 +35,8 @@ use datatype_uis::{ use re_types::{ blueprint::components::{ - BackgroundKind, Corner2D, GridSpacing, LockRangeDuringZoom, MapProvider, ViewFit, Visible, + BackgroundKind, Corner2D, GridSpacing, LockRangeDuringZoom, MapProvider, NearClipPlane, + ViewFit, Visible, }, components::{ AggregationPolicy, AlbedoFactor, AxisLength, Color, DepthMeter, DrawOrder, FillMode, @@ -76,6 +77,7 @@ pub fn create_component_ui_registry() -> re_viewer_context::ComponentUiRegistry registry.add_singleline_edit_or_view::(edit_f32_zero_to_max); registry.add_singleline_edit_or_view::(edit_ui_points); registry.add_singleline_edit_or_view::(edit_ui_points); + registry.add_singleline_edit_or_view::(edit_f32_zero_to_max); // float min-max components: registry.add_singleline_edit_or_view::(edit_f32_min_to_max_float); diff --git a/crates/viewer/re_space_view_spatial/src/ui_2d.rs b/crates/viewer/re_space_view_spatial/src/ui_2d.rs index 54d3a64c89b3..6f5ae55cfd15 100644 --- a/crates/viewer/re_space_view_spatial/src/ui_2d.rs +++ b/crates/viewer/re_space_view_spatial/src/ui_2d.rs @@ -15,8 +15,7 @@ use re_types::{ }; use re_ui::{ContextExt as _, ModifiersMarkdown, MouseButtonMarkdown}; use re_viewer_context::{ - gpu_bridge, ItemSpaceContext, SpaceViewId, SpaceViewSystemExecutionError, ViewQuery, - ViewerContext, + gpu_bridge, ItemSpaceContext, SpaceViewSystemExecutionError, ViewQuery, ViewerContext, }; use re_viewport_blueprint::ViewProperty; @@ -31,16 +30,11 @@ use crate::{ /// Pan and zoom, and return the current transform. fn ui_from_scene( ctx: &ViewerContext<'_>, - view_id: SpaceViewId, response: &egui::Response, view_class: &SpatialSpaceView2D, view_state: &mut SpatialSpaceViewState, + bounds_property: &ViewProperty, ) -> RectTransform { - let bounds_property = ViewProperty::from_archetype::( - ctx.blueprint_db(), - ctx.blueprint_query, - view_id, - ); let bounds: blueprint_components::VisualBounds2D = bounds_property .component_or_fallback(ctx, view_class, view_state) .ok_or_log_error() @@ -169,20 +163,35 @@ impl SpatialSpaceView2D { let (response, painter) = ui.allocate_painter(ui.available_size(), egui::Sense::click_and_drag()); + let bounds_property = ViewProperty::from_archetype::( + ctx.blueprint_db(), + ctx.blueprint_query, + query.space_view_id, + ); + // Convert ui coordinates to/from scene coordinates. - let ui_from_scene = ui_from_scene(ctx, query.space_view_id, &response, self, state); + let ui_from_scene = ui_from_scene(ctx, &response, self, state, &bounds_property); let scene_from_ui = ui_from_scene.inverse(); + let near_clip_plane: blueprint_components::NearClipPlane = bounds_property + .component_or_fallback(ctx, self, state) + .ok_or_log_error() + .unwrap_or_default(); + // TODO(andreas): Use the same eye & transformations as in `setup_target_config`. let eye = Eye { world_from_rub_view: IsoTransform::IDENTITY, fov_y: None, }; + // Don't let clipping plane become zero + let near_clip_plane = f32::max(f32::MIN_POSITIVE, *near_clip_plane.0); + let scene_bounds = *scene_from_ui.to(); let Ok(target_config) = setup_target_config( &painter, scene_bounds, + near_clip_plane, &query.space_origin.to_string(), query.highlights.any_outlines(), &state.pinhole_at_origin, @@ -287,6 +296,7 @@ impl SpatialSpaceView2D { fn setup_target_config( egui_painter: &egui::Painter, scene_bounds: Rect, + near_clip_plane: f32, space_name: &str, any_outlines: bool, scene_pinhole: &Option, @@ -348,17 +358,17 @@ fn setup_target_config( } let pinhole_rect = Rect::from_min_size(Pos2::ZERO, egui::vec2(resolution.x, resolution.y)); + let focal_length = pinhole.focal_length_in_pixels(); + let focal_length = 2.0 / (1.0 / focal_length.x() + 1.0 / focal_length.y()); // harmonic mean (lack of anamorphic support) + let projection_from_view = re_renderer::view_builder::Projection::Perspective { vertical_fov: pinhole.fov_y().unwrap_or(Eye::DEFAULT_FOV_Y), - near_plane_distance: 0.1, + near_plane_distance: near_clip_plane * focal_length / 500.0, // TODO(#8373): The need to scale this by 500 is quite hacky. aspect_ratio: pinhole .aspect_ratio() .unwrap_or(scene_bounds_size.x / scene_bounds_size.y), // only happens if the pinhole lacks resolution }; - let focal_length = pinhole.focal_length_in_pixels(); - let focal_length = 2.0 / (1.0 / focal_length.x() + 1.0 / focal_length.y()); // harmonic mean (lack of anamorphic support) - // Position the camera looking straight at the principal point: let view_from_world = re_math::IsoTransform::look_at_rh( pinhole.principal_point().extend(-focal_length), diff --git a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs index 85bc964e87a8..e2ffaf50eb40 100644 --- a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs +++ b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs @@ -14,6 +14,7 @@ pub use re_types::blueprint::components::IncludedContent; pub use re_types::blueprint::components::Interactive; pub use re_types::blueprint::components::LockRangeDuringZoom; pub use re_types::blueprint::components::MapProvider; +pub use re_types::blueprint::components::NearClipPlane; pub use re_types::blueprint::components::PanelState; pub use re_types::blueprint::components::QueryExpression; pub use re_types::blueprint::components::RowShare; @@ -57,6 +58,7 @@ pub fn is_valid_blueprint(blueprint: &EntityDb) -> bool { && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) + && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) diff --git a/crates/viewer/re_viewer/src/reflection/mod.rs b/crates/viewer/re_viewer/src/reflection/mod.rs index a32288da7a61..2a4902df555e 100644 --- a/crates/viewer/re_viewer/src/reflection/mod.rs +++ b/crates/viewer/re_viewer/src/reflection/mod.rs @@ -172,6 +172,14 @@ fn generate_component_reflection() -> Result::name(), + ComponentReflection { + docstring_md: "Distance to the near clip plane used for `Spatial2DView`.", + custom_placeholder: Some(NearClipPlane::default().to_arrow2()?), + datatype: NearClipPlane::arrow2_datatype(), + }, + ), ( ::name(), ComponentReflection { @@ -2202,7 +2210,11 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { "rerun.blueprint.components.VisualBounds2D".into(), display_name : "Range", docstring_md : "Controls the visible range of a 2D view.\n\nUse this to control pan & zoom of the view.", - is_required : true, }, + is_required : true, }, ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.NearClipPlane".into(), display_name : + "Near clip plane", docstring_md : + "Controls the distance to the near clip plane in 3D scene units.\n\nContent closer than this distance will not be visible.", + is_required : false, }, ], }, ), diff --git a/docs/content/reference/migration/migration-0-21.md b/docs/content/reference/migration/migration-0-21.md new file mode 100644 index 000000000000..e0b0a5d693a7 --- /dev/null +++ b/docs/content/reference/migration/migration-0-21.md @@ -0,0 +1,27 @@ +--- +title: Migrating from 0.20 to 0.21 +order: 989 +--- + +### Near clip plane for `Spatial2D` views now defaults to `0.1` in 3D scene units. + +Previously, the clip plane was set an arbitrary value that worked reasonably for +cameras with large focal lengths, but become problematic for cameras with smaller +focal length values. This value is now normalized based on the focal length of +the camera. + +If the default value of `0.1` is still too large for your use-case it can be configured +using the new `near_clip_plane` of the `VisualBounds2D` blueprint property, either +through the UI, or through the SDK in Python: +```python +rr.send_blueprint( + rrb.Spatial2DView( + origin="world/cam", + contents="/**", + visual_bounds=rrb.VisualBounds2D( + near_clip_plane=0.01, + ), + ) +) +``` + diff --git a/docs/content/reference/types/views/graph_view.md b/docs/content/reference/types/views/graph_view.md index f6830c618ed6..58432cb123b8 100644 --- a/docs/content/reference/types/views/graph_view.md +++ b/docs/content/reference/types/views/graph_view.md @@ -12,6 +12,9 @@ Everything within these bounds is guaranteed to be visible. Somethings outside of these bounds may also be visible due to letterboxing. +* `range`: Controls the visible range of a 2D view. +* `near_clip_plane`: Controls the distance to the near clip plane in 3D scene units. + ## API reference links * 🐍 [Python API docs for `GraphView`](https://ref.rerun.io/docs/python/stable/common/blueprint_views?speculative-link#rerun.blueprint.views.GraphView) diff --git a/docs/content/reference/types/views/spatial2d_view.md b/docs/content/reference/types/views/spatial2d_view.md index d7a752d0212a..7125701ab1b9 100644 --- a/docs/content/reference/types/views/spatial2d_view.md +++ b/docs/content/reference/types/views/spatial2d_view.md @@ -17,6 +17,9 @@ The visible parts of the scene, in the coordinate space of the scene. Everything within these bounds are guaranteed to be visible. Somethings outside of these bounds may also be visible due to letterboxing. + +* `range`: Controls the visible range of a 2D view. +* `near_clip_plane`: Controls the distance to the near clip plane in 3D scene units. ### `time_ranges` Configures which range on each timeline is shown by this view (unless specified differently per entity). diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.cpp index 9326c22b3548..d5756b46e0ef 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.cpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.cpp @@ -15,7 +15,7 @@ namespace rerun { ) { using namespace blueprint::archetypes; std::vector cells; - cells.reserve(2); + cells.reserve(3); { auto result = ComponentBatch::from_loggable( @@ -29,6 +29,18 @@ namespace rerun { RR_RETURN_NOT_OK(result.error); cells.push_back(std::move(result.value)); } + { + auto result = ComponentBatch::from_loggable( + archetype.near_clip_plane, + ComponentDescriptor( + "rerun.blueprint.archetypes.VisualBounds2D", + "near_clip_plane", + "rerun.blueprint.components.NearClipPlane" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } { auto indicator = VisualBounds2D::IndicatorComponent(); auto result = ComponentBatch::from_loggable(indicator); diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.hpp index fc0f11e560f1..0cf72032e464 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.hpp @@ -3,6 +3,7 @@ #pragma once +#include "../../blueprint/components/near_clip_plane.hpp" #include "../../blueprint/components/visual_bounds2d.hpp" #include "../../collection.hpp" #include "../../component_batch.hpp" @@ -27,6 +28,11 @@ namespace rerun::blueprint::archetypes { /// Use this to control pan & zoom of the view. rerun::blueprint::components::VisualBounds2D range; + /// Controls the distance to the near clip plane in 3D scene units. + /// + /// Content closer than this distance will not be visible. + rerun::blueprint::components::NearClipPlane near_clip_plane; + public: static constexpr const char IndicatorComponentName[] = "rerun.blueprint.components.VisualBounds2DIndicator"; @@ -38,8 +44,11 @@ namespace rerun::blueprint::archetypes { VisualBounds2D() = default; VisualBounds2D(VisualBounds2D&& other) = default; - explicit VisualBounds2D(rerun::blueprint::components::VisualBounds2D _range) - : range(std::move(_range)) {} + explicit VisualBounds2D( + rerun::blueprint::components::VisualBounds2D _range, + rerun::blueprint::components::NearClipPlane _near_clip_plane + ) + : range(std::move(_range)), near_clip_plane(std::move(_near_clip_plane)) {} }; } // namespace rerun::blueprint::archetypes diff --git a/rerun_cpp/src/rerun/blueprint/components.hpp b/rerun_cpp/src/rerun/blueprint/components.hpp index 6dfe128cab3c..e5ed33415971 100644 --- a/rerun_cpp/src/rerun/blueprint/components.hpp +++ b/rerun_cpp/src/rerun/blueprint/components.hpp @@ -19,6 +19,7 @@ #include "blueprint/components/interactive.hpp" #include "blueprint/components/lock_range_during_zoom.hpp" #include "blueprint/components/map_provider.hpp" +#include "blueprint/components/near_clip_plane.hpp" #include "blueprint/components/panel_state.hpp" #include "blueprint/components/query_expression.hpp" #include "blueprint/components/root_container.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/components/.gitattributes b/rerun_cpp/src/rerun/blueprint/components/.gitattributes index 50a1a60a3463..01c332e58b9c 100644 --- a/rerun_cpp/src/rerun/blueprint/components/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/components/.gitattributes @@ -22,6 +22,7 @@ interactive.hpp linguist-generated=true lock_range_during_zoom.hpp linguist-generated=true map_provider.cpp linguist-generated=true map_provider.hpp linguist-generated=true +near_clip_plane.hpp linguist-generated=true panel_state.cpp linguist-generated=true panel_state.hpp linguist-generated=true query_expression.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/components/near_clip_plane.hpp b/rerun_cpp/src/rerun/blueprint/components/near_clip_plane.hpp new file mode 100644 index 000000000000..b400a9c9c22f --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/near_clip_plane.hpp @@ -0,0 +1,79 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/near_clip_plane.fbs". + +#pragma once + +#include "../../component_descriptor.hpp" +#include "../../datatypes/float32.hpp" +#include "../../result.hpp" + +#include +#include + +namespace rerun::blueprint::components { + /// **Component**: Distance to the near clip plane used for `Spatial2DView`. + struct NearClipPlane { + /// Distance to the near clip plane in 3D scene units. + rerun::datatypes::Float32 near_clip_plane; + + public: + NearClipPlane() = default; + + NearClipPlane(rerun::datatypes::Float32 near_clip_plane_) + : near_clip_plane(near_clip_plane_) {} + + NearClipPlane& operator=(rerun::datatypes::Float32 near_clip_plane_) { + near_clip_plane = near_clip_plane_; + return *this; + } + + NearClipPlane(float value_) : near_clip_plane(value_) {} + + NearClipPlane& operator=(float value_) { + near_clip_plane = value_; + return *this; + } + + /// Cast to the underlying Float32 datatype + operator rerun::datatypes::Float32() const { + return near_clip_plane; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + static_assert( + sizeof(rerun::datatypes::Float32) == sizeof(blueprint::components::NearClipPlane) + ); + + /// \private + template <> + struct Loggable { + static constexpr ComponentDescriptor Descriptor = + "rerun.blueprint.components.NearClipPlane"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype() { + return Loggable::arrow_datatype(); + } + + /// Serializes an array of `rerun::blueprint:: components::NearClipPlane` into an arrow array. + static Result> to_arrow( + const blueprint::components::NearClipPlane* instances, size_t num_instances + ) { + if (num_instances == 0) { + return Loggable::to_arrow(nullptr, 0); + } else if (instances == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Passed array instances is null when num_elements> 0." + ); + } else { + return Loggable::to_arrow( + &instances->near_clip_plane, + num_instances + ); + } + } + }; +} // namespace rerun diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d.py index 7a6a5159dc0b..110ebd5c2d69 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d.py @@ -34,6 +34,7 @@ def __attrs_clear__(self) -> None: """Convenience method for calling `__attrs_init__` with all `None`s.""" self.__attrs_init__( range=None, # type: ignore[arg-type] + near_clip_plane=None, # type: ignore[arg-type] ) @classmethod @@ -53,5 +54,15 @@ def _clear(cls) -> VisualBounds2D: # # (Docstring intentionally commented out to hide this field from the docs) + near_clip_plane: blueprint_components.NearClipPlaneBatch = field( + metadata={"component": "required"}, + converter=blueprint_components.NearClipPlaneBatch._required, # type: ignore[misc] + ) + # Controls the distance to the near clip plane in 3D scene units. + # + # Content closer than this distance will not be visible. + # + # (Docstring intentionally commented out to hide this field from the docs) + __str__ = Archetype.__str__ __repr__ = Archetype.__repr__ # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d_ext.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d_ext.py index 78cc1158bbfc..f28c2ae1f359 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d_ext.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d_ext.py @@ -13,8 +13,9 @@ class VisualBounds2DExt: def __init__( self: Any, *, - x_range: datatypes.Range1DLike, - y_range: datatypes.Range1DLike, + x_range: datatypes.Range1DLike | None = None, + y_range: datatypes.Range1DLike | None = None, + near_clip_plane: datatypes.Float32Like | None = None, ): """ Create a new instance of the VisualBounds2D archetype. @@ -25,10 +26,22 @@ def __init__( The minimum visible range of the X-axis (usually left and right bounds). y_range: The minimum visible range of the Y-axis (usually left and right bounds). + near_clip_plane: + The distance to the near clipping plane. """ + if x_range is not None and y_range is not None: + range = blueprint_components.VisualBounds2D(x_range=x_range, y_range=y_range) + elif x_range is not None or y_range is not None: + raise ValueError("Both x_range and y_range must be specified.") + else: + range = None + with catch_and_log_exceptions(context=self.__class__.__name__): - self.__attrs_init__(range=blueprint_components.VisualBounds2D(x_range=x_range, y_range=y_range)) + self.__attrs_init__( + range=range, + near_clip_plane=near_clip_plane, + ) return self.__attrs_clear__() diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes index 320328225835..4fdcc51e8c50 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes @@ -19,6 +19,7 @@ included_content.py linguist-generated=true interactive.py linguist-generated=true lock_range_during_zoom.py linguist-generated=true map_provider.py linguist-generated=true +near_clip_plane.py linguist-generated=true panel_state.py linguist-generated=true query_expression.py linguist-generated=true root_container.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py index 8f7f6182b390..18d213e617d7 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py @@ -19,6 +19,7 @@ from .interactive import Interactive, InteractiveBatch from .lock_range_during_zoom import LockRangeDuringZoom, LockRangeDuringZoomBatch from .map_provider import MapProvider, MapProviderArrayLike, MapProviderBatch, MapProviderLike +from .near_clip_plane import NearClipPlane, NearClipPlaneBatch from .panel_state import PanelState, PanelStateArrayLike, PanelStateBatch, PanelStateLike from .query_expression import QueryExpression, QueryExpressionBatch from .root_container import RootContainer, RootContainerBatch @@ -80,6 +81,8 @@ "MapProviderArrayLike", "MapProviderBatch", "MapProviderLike", + "NearClipPlane", + "NearClipPlaneBatch", "PanelState", "PanelStateArrayLike", "PanelStateBatch", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/near_clip_plane.py b/rerun_py/rerun_sdk/rerun/blueprint/components/near_clip_plane.py new file mode 100644 index 000000000000..c2693d691431 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/near_clip_plane.py @@ -0,0 +1,33 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/components/near_clip_plane.fbs". + +# You can extend this class by creating a "NearClipPlaneExt" class in "near_clip_plane_ext.py". + +from __future__ import annotations + +from ... import datatypes +from ..._baseclasses import ( + ComponentBatchMixin, + ComponentDescriptor, + ComponentMixin, +) + +__all__ = ["NearClipPlane", "NearClipPlaneBatch"] + + +class NearClipPlane(datatypes.Float32, ComponentMixin): + """**Component**: Distance to the near clip plane used for `Spatial2DView`.""" + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of NearClipPlaneExt in near_clip_plane_ext.py + + # Note: there are no fields here because NearClipPlane delegates to datatypes.Float32 + pass + + +class NearClipPlaneBatch(datatypes.Float32Batch, ComponentBatchMixin): + _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.NearClipPlane") + + +# This is patched in late to avoid circular dependencies. +NearClipPlane._BATCH_TYPE = NearClipPlaneBatch # type: ignore[assignment] From 59a8440090044d19e7ad38c4dc7ba075869194e5 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 9 Dec 2024 19:39:30 +0100 Subject: [PATCH 05/71] Prepare to port codegen deserialization from arrow2 (#8372) ### Related * Part of https://github.com/rerun-io/rerun/issues/3741 ### What Some preparatory work for migrating the codegen deserializer from `re_arrow2` --- .../src/codegen/rust/deserializer.rs | 42 ++--- .../datatypes/component_column_selector.rs | 22 +-- .../blueprint/datatypes/selected_columns.rs | 31 ++-- .../src/components/annotation_context.rs | 10 +- .../src/components/geo_line_string.rs | 10 +- .../re_types/src/components/line_strip2d.rs | 10 +- .../re_types/src/components/line_strip3d.rs | 10 +- .../re_types/src/datatypes/annotation_info.rs | 11 +- crates/store/re_types/src/datatypes/blob.rs | 10 +- .../src/datatypes/class_description.rs | 20 +-- .../re_types/src/datatypes/tensor_buffer.rs | 154 +++++++++--------- .../re_types/src/datatypes/tensor_data.rs | 10 +- .../src/datatypes/tensor_dimension.rs | 11 +- .../store/re_types/src/datatypes/utf8pair.rs | 22 +-- .../src/testing/components/affix_fuzzer10.rs | 11 +- .../src/testing/components/affix_fuzzer11.rs | 10 +- .../src/testing/components/affix_fuzzer12.rs | 21 +-- .../src/testing/components/affix_fuzzer13.rs | 21 +-- .../src/testing/components/affix_fuzzer16.rs | 10 +- .../src/testing/components/affix_fuzzer17.rs | 10 +- .../src/testing/components/affix_fuzzer18.rs | 10 +- .../src/testing/components/affix_fuzzer7.rs | 10 +- .../src/testing/components/affix_fuzzer9.rs | 11 +- .../src/testing/datatypes/affix_fuzzer1.rs | 74 +++++---- .../src/testing/datatypes/affix_fuzzer20.rs | 11 +- .../src/testing/datatypes/affix_fuzzer21.rs | 10 +- .../src/testing/datatypes/affix_fuzzer3.rs | 22 +-- .../src/testing/datatypes/affix_fuzzer4.rs | 18 +- .../src/testing/datatypes/string_component.rs | 11 +- crates/store/re_types/tests/types/validity.rs | 9 +- .../src/blueprint/datatypes/utf8list.rs | 21 +-- crates/store/re_types_core/src/archetype.rs | 39 ++++- .../store/re_types_core/src/arrow_string.rs | 12 ++ .../src/datatypes/entity_path.rs | 11 +- .../src/datatypes/time_range_boundary.rs | 8 +- .../store/re_types_core/src/datatypes/utf8.rs | 11 +- .../src/datatypes/visible_time_range.rs | 11 +- crates/store/re_types_core/src/lib.rs | 1 + crates/store/re_types_core/src/loggable.rs | 7 +- tests/python/release_checklist/main.py | 4 +- 40 files changed, 418 insertions(+), 349 deletions(-) diff --git a/crates/build/re_types_builder/src/codegen/rust/deserializer.rs b/crates/build/re_types_builder/src/codegen/rust/deserializer.rs index 2b942ca13f19..25880acd6fd0 100644 --- a/crates/build/re_types_builder/src/codegen/rust/deserializer.rs +++ b/crates/build/re_types_builder/src/codegen/rust/deserializer.rs @@ -326,11 +326,12 @@ pub fn quote_arrow_deserializer( let quoted_field_deserializers = obj .fields .iter() - .filter(|obj_field| - // For unit fields we don't have to collect any data. - obj_field.typ != crate::Type::Unit) .enumerate() - .map(|(i, obj_field)| { + .filter(|(_, obj_field)| { + // For unit fields we don't have to collect any data. + obj_field.typ != crate::Type::Unit + }) + .map(|(type_id, obj_field)| { let data_dst = format_ident!("{}", obj_field.snake_case_name()); let field_datatype = &arrow_registry.get(&obj_field.fqname); @@ -344,15 +345,15 @@ pub fn quote_arrow_deserializer( InnerRepr::NativeIterable, ); - let i = i + 1; // NOTE: +1 to account for `_null_markers` virtual arm + let type_id = Literal::usize_unsuffixed(type_id + 1); // NOTE: +1 to account for `_null_markers` virtual arm quote! { let #data_dst = { // NOTE: `data_src_arrays` is a runtime collection of all of the - // input's payload's union arms, while `#i` is our comptime union + // input's payload's union arms, while `#type_id` is our comptime union // arm counter… there's no guarantee it's actually there at // runtime! - if #i >= #data_src_arrays.len() { + if #data_src_arrays.len() <= #type_id { // By not returning an error but rather defaulting to an empty // vector, we introduce some kind of light forwards compatibility: // old clients that don't yet know about the new arms can still @@ -360,13 +361,13 @@ pub fn quote_arrow_deserializer( return Ok(Vec::new()); // return Err(DeserializationError::missing_union_arm( - // #quoted_datatype, #obj_field_fqname, #i, + // #quoted_datatype, #obj_field_fqname, #type_id, // )).with_context(#obj_fqname); } // NOTE: The array indexing is safe: checked above. - let #data_src = &*#data_src_arrays[#i]; - #quoted_deserializer.collect::>() + let #data_src = &*#data_src_arrays[#type_id]; + #quoted_deserializer.collect::>() } } }); @@ -583,19 +584,20 @@ fn quote_arrow_field_deserializer( let offsets = #data_src.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), #data_src.validity(), ) - .map(|elem| elem.map(|(start, len)| { + .map(|elem| elem.map(|window| { // NOTE: Do _not_ use `Buffer::sliced`, it panics on malformed inputs. - let start = *start as usize; - let end = start + len; + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; // NOTE: It is absolutely crucial we explicitly handle the // boundchecks manually first, otherwise rustc completely chokes // when slicing the data (as in: a 100x perf drop)! - if end > #data_src_buf.len() { + if #data_src_buf.len() < end { // error context is appended below during final collection return Err(DeserializationError::offset_slice_oob( (start, end), #data_src_buf.len(), @@ -812,19 +814,19 @@ fn quote_arrow_field_deserializer( let offsets = #data_src.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), #data_src.validity(), ) - .map(|elem| elem.map(|(start, len)| { + .map(|elem| elem.map(|window| { // NOTE: Do _not_ use `Buffer::sliced`, it panics on malformed inputs. - let start = *start as usize; - let end = start + len; + let start = window[0] as usize; + let end = window[1] as usize; // NOTE: It is absolutely crucial we explicitly handle the // boundchecks manually first, otherwise rustc completely chokes // when slicing the data (as in: a 100x perf drop)! - if end > #data_src_inner.len() { + if #data_src_inner.len() < end { // error context is appended below during final collection return Err(DeserializationError::offset_slice_oob( (start, end), #data_src_inner.len(), diff --git a/crates/store/re_types/src/blueprint/datatypes/component_column_selector.rs b/crates/store/re_types/src/blueprint/datatypes/component_column_selector.rs index 300720dffec5..dd0694d2ab66 100644 --- a/crates/store/re_types/src/blueprint/datatypes/component_column_selector.rs +++ b/crates/store/re_types/src/blueprint/datatypes/component_column_selector.rs @@ -209,14 +209,15 @@ impl ::re_types_core::Loggable for ComponentColumnSelector { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), @@ -270,14 +271,15 @@ impl ::re_types_core::Loggable for ComponentColumnSelector { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types/src/blueprint/datatypes/selected_columns.rs b/crates/store/re_types/src/blueprint/datatypes/selected_columns.rs index 02bead6bfb67..4bb0cec1fea9 100644 --- a/crates/store/re_types/src/blueprint/datatypes/selected_columns.rs +++ b/crates/store/re_types/src/blueprint/datatypes/selected_columns.rs @@ -265,15 +265,16 @@ impl ::re_types_core::Loggable for SelectedColumns { let arrow_data_inner_buf = arrow_data_inner.values(); let offsets = arrow_data_inner.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data_inner.validity(), ) .map(|elem| { elem - .map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner_buf.len() { + .map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_inner_buf.len() < end { return Err( DeserializationError::offset_slice_oob( (start, end), @@ -309,15 +310,15 @@ impl ::re_types_core::Loggable for SelectedColumns { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { elem - .map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + .map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err( DeserializationError::offset_slice_oob( (start, end), @@ -389,15 +390,15 @@ impl ::re_types_core::Loggable for SelectedColumns { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { elem - .map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + .map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err( DeserializationError::offset_slice_oob( (start, end), diff --git a/crates/store/re_types/src/components/annotation_context.rs b/crates/store/re_types/src/components/annotation_context.rs index 09c12c378f25..c24f64f2d2fd 100644 --- a/crates/store/re_types/src/components/annotation_context.rs +++ b/crates/store/re_types/src/components/annotation_context.rs @@ -134,14 +134,14 @@ impl ::re_types_core::Loggable for AnnotationContext { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/components/geo_line_string.rs b/crates/store/re_types/src/components/geo_line_string.rs index 5188e4c88bf7..09348a64d66f 100644 --- a/crates/store/re_types/src/components/geo_line_string.rs +++ b/crates/store/re_types/src/components/geo_line_string.rs @@ -208,14 +208,14 @@ impl ::re_types_core::Loggable for GeoLineString { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/components/line_strip2d.rs b/crates/store/re_types/src/components/line_strip2d.rs index 71ecbe3149db..fcac594ffd8e 100644 --- a/crates/store/re_types/src/components/line_strip2d.rs +++ b/crates/store/re_types/src/components/line_strip2d.rs @@ -217,14 +217,14 @@ impl ::re_types_core::Loggable for LineStrip2D { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/components/line_strip3d.rs b/crates/store/re_types/src/components/line_strip3d.rs index eff94b820b1a..97e579575bc7 100644 --- a/crates/store/re_types/src/components/line_strip3d.rs +++ b/crates/store/re_types/src/components/line_strip3d.rs @@ -217,14 +217,14 @@ impl ::re_types_core::Loggable for LineStrip3D { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/datatypes/annotation_info.rs b/crates/store/re_types/src/datatypes/annotation_info.rs index 4c8e1d32667e..2c40d6bf2938 100644 --- a/crates/store/re_types/src/datatypes/annotation_info.rs +++ b/crates/store/re_types/src/datatypes/annotation_info.rs @@ -231,14 +231,15 @@ impl ::re_types_core::Loggable for AnnotationInfo { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types/src/datatypes/blob.rs b/crates/store/re_types/src/datatypes/blob.rs index 0159c543fc9e..06e08627da94 100644 --- a/crates/store/re_types/src/datatypes/blob.rs +++ b/crates/store/re_types/src/datatypes/blob.rs @@ -127,14 +127,14 @@ impl ::re_types_core::Loggable for Blob { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/datatypes/class_description.rs b/crates/store/re_types/src/datatypes/class_description.rs index dddfad4eeb7b..b6827410d9b8 100644 --- a/crates/store/re_types/src/datatypes/class_description.rs +++ b/crates/store/re_types/src/datatypes/class_description.rs @@ -323,14 +323,14 @@ impl ::re_types_core::Loggable for ClassDescription { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -393,14 +393,14 @@ impl ::re_types_core::Loggable for ClassDescription { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/datatypes/tensor_buffer.rs b/crates/store/re_types/src/datatypes/tensor_buffer.rs index 5ab47f74b755..cf2df863a568 100644 --- a/crates/store/re_types/src/datatypes/tensor_buffer.rs +++ b/crates/store/re_types/src/datatypes/tensor_buffer.rs @@ -787,10 +787,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .with_context("rerun.datatypes.TensorBuffer"); } let u8 = { - if 1usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 1 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[1usize]; + let arrow_data = &*arrow_data_arrays[1]; { let arrow_data = arrow_data .as_any() @@ -823,14 +823,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -855,10 +855,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .collect::>() }; let u16 = { - if 2usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 2 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[2usize]; + let arrow_data = &*arrow_data_arrays[2]; { let arrow_data = arrow_data .as_any() @@ -891,14 +891,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -923,10 +923,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .collect::>() }; let u32 = { - if 3usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 3 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[3usize]; + let arrow_data = &*arrow_data_arrays[3]; { let arrow_data = arrow_data .as_any() @@ -959,14 +959,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -991,10 +991,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .collect::>() }; let u64 = { - if 4usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 4 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[4usize]; + let arrow_data = &*arrow_data_arrays[4]; { let arrow_data = arrow_data .as_any() @@ -1027,14 +1027,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -1059,10 +1059,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .collect::>() }; let i8 = { - if 5usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 5 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[5usize]; + let arrow_data = &*arrow_data_arrays[5]; { let arrow_data = arrow_data .as_any() @@ -1095,14 +1095,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -1127,10 +1127,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .collect::>() }; let i16 = { - if 6usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 6 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[6usize]; + let arrow_data = &*arrow_data_arrays[6]; { let arrow_data = arrow_data .as_any() @@ -1163,14 +1163,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -1195,10 +1195,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .collect::>() }; let i32 = { - if 7usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 7 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[7usize]; + let arrow_data = &*arrow_data_arrays[7]; { let arrow_data = arrow_data .as_any() @@ -1231,14 +1231,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -1263,10 +1263,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .collect::>() }; let i64 = { - if 8usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 8 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[8usize]; + let arrow_data = &*arrow_data_arrays[8]; { let arrow_data = arrow_data .as_any() @@ -1299,14 +1299,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -1331,10 +1331,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .collect::>() }; let f16 = { - if 9usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 9 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[9usize]; + let arrow_data = &*arrow_data_arrays[9]; { let arrow_data = arrow_data .as_any() @@ -1367,14 +1367,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -1399,10 +1399,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .collect::>() }; let f32 = { - if 10usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 10 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[10usize]; + let arrow_data = &*arrow_data_arrays[10]; { let arrow_data = arrow_data .as_any() @@ -1435,14 +1435,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -1467,10 +1467,10 @@ impl ::re_types_core::Loggable for TensorBuffer { .collect::>() }; let f64 = { - if 11usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 11 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[11usize]; + let arrow_data = &*arrow_data_arrays[11]; { let arrow_data = arrow_data .as_any() @@ -1503,14 +1503,14 @@ impl ::re_types_core::Loggable for TensorBuffer { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/datatypes/tensor_data.rs b/crates/store/re_types/src/datatypes/tensor_data.rs index 6e10fad1c17d..0d19cb6190a6 100644 --- a/crates/store/re_types/src/datatypes/tensor_data.rs +++ b/crates/store/re_types/src/datatypes/tensor_data.rs @@ -227,14 +227,14 @@ impl ::re_types_core::Loggable for TensorData { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/datatypes/tensor_dimension.rs b/crates/store/re_types/src/datatypes/tensor_dimension.rs index 4fce89954ca5..619c954eea2f 100644 --- a/crates/store/re_types/src/datatypes/tensor_dimension.rs +++ b/crates/store/re_types/src/datatypes/tensor_dimension.rs @@ -199,14 +199,15 @@ impl ::re_types_core::Loggable for TensorDimension { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types/src/datatypes/utf8pair.rs b/crates/store/re_types/src/datatypes/utf8pair.rs index 99739ab10aa1..2eec236d7687 100644 --- a/crates/store/re_types/src/datatypes/utf8pair.rs +++ b/crates/store/re_types/src/datatypes/utf8pair.rs @@ -186,14 +186,15 @@ impl ::re_types_core::Loggable for Utf8Pair { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), @@ -241,14 +242,15 @@ impl ::re_types_core::Loggable for Utf8Pair { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer10.rs b/crates/store/re_types/src/testing/components/affix_fuzzer10.rs index c7a341da3438..739d7de755cc 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer10.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer10.rs @@ -104,14 +104,15 @@ impl ::re_types_core::Loggable for AffixFuzzer10 { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer11.rs b/crates/store/re_types/src/testing/components/affix_fuzzer11.rs index 4a2e04a06eca..142b2b88218f 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer11.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer11.rs @@ -132,14 +132,14 @@ impl ::re_types_core::Loggable for AffixFuzzer11 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer12.rs b/crates/store/re_types/src/testing/components/affix_fuzzer12.rs index fe8e4847fe44..e3f13d3a9d4b 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer12.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer12.rs @@ -136,14 +136,15 @@ impl ::re_types_core::Loggable for AffixFuzzer12 { let arrow_data_inner_buf = arrow_data_inner.values(); let offsets = arrow_data_inner.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data_inner.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_inner_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner_buf.len(), @@ -173,14 +174,14 @@ impl ::re_types_core::Loggable for AffixFuzzer12 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer13.rs b/crates/store/re_types/src/testing/components/affix_fuzzer13.rs index a38e831ac11e..9118de31e42a 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer13.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer13.rs @@ -136,14 +136,15 @@ impl ::re_types_core::Loggable for AffixFuzzer13 { let arrow_data_inner_buf = arrow_data_inner.values(); let offsets = arrow_data_inner.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data_inner.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_inner_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner_buf.len(), @@ -173,14 +174,14 @@ impl ::re_types_core::Loggable for AffixFuzzer13 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer16.rs b/crates/store/re_types/src/testing/components/affix_fuzzer16.rs index 70fd6558ac5d..605c7831b803 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer16.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer16.rs @@ -126,14 +126,14 @@ impl ::re_types_core::Loggable for AffixFuzzer16 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer17.rs b/crates/store/re_types/src/testing/components/affix_fuzzer17.rs index f2cd5031ae0c..5c3584825e37 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer17.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer17.rs @@ -126,14 +126,14 @@ impl ::re_types_core::Loggable for AffixFuzzer17 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer18.rs b/crates/store/re_types/src/testing/components/affix_fuzzer18.rs index 2a370088b673..0ee06f26d382 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer18.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer18.rs @@ -126,14 +126,14 @@ impl ::re_types_core::Loggable for AffixFuzzer18 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer7.rs b/crates/store/re_types/src/testing/components/affix_fuzzer7.rs index 8467fb435de0..74fa0a201a01 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer7.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer7.rs @@ -124,14 +124,14 @@ impl ::re_types_core::Loggable for AffixFuzzer7 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/testing/components/affix_fuzzer9.rs b/crates/store/re_types/src/testing/components/affix_fuzzer9.rs index 4e9e6c414ca8..a5d0d98442cd 100644 --- a/crates/store/re_types/src/testing/components/affix_fuzzer9.rs +++ b/crates/store/re_types/src/testing/components/affix_fuzzer9.rs @@ -104,14 +104,15 @@ impl ::re_types_core::Loggable for AffixFuzzer9 { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer1.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer1.rs index a6bdbe5c3b41..4cec3891a667 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer1.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer1.rs @@ -543,14 +543,15 @@ impl ::re_types_core::Loggable for AffixFuzzer1 { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), @@ -600,14 +601,15 @@ impl ::re_types_core::Loggable for AffixFuzzer1 { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), @@ -678,14 +680,14 @@ impl ::re_types_core::Loggable for AffixFuzzer1 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -753,15 +755,16 @@ impl ::re_types_core::Loggable for AffixFuzzer1 { let arrow_data_inner_buf = arrow_data_inner.values(); let offsets = arrow_data_inner.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data_inner.validity(), ) .map(|elem| { elem - .map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner_buf.len() { + .map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_inner_buf.len() < end { return Err( DeserializationError::offset_slice_oob( (start, end), @@ -794,15 +797,15 @@ impl ::re_types_core::Loggable for AffixFuzzer1 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { elem - .map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + .map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err( DeserializationError::offset_slice_oob( (start, end), @@ -874,15 +877,16 @@ impl ::re_types_core::Loggable for AffixFuzzer1 { let arrow_data_inner_buf = arrow_data_inner.values(); let offsets = arrow_data_inner.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data_inner.validity(), ) .map(|elem| { elem - .map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner_buf.len() { + .map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_inner_buf.len() < end { return Err( DeserializationError::offset_slice_oob( (start, end), @@ -915,15 +919,15 @@ impl ::re_types_core::Loggable for AffixFuzzer1 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { elem - .map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + .map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err( DeserializationError::offset_slice_oob( (start, end), diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer20.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer20.rs index 0807008bf746..36adf314259f 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer20.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer20.rs @@ -214,14 +214,15 @@ impl ::re_types_core::Loggable for AffixFuzzer20 { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer21.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer21.rs index e29597829b98..aa6cac91defd 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer21.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer21.rs @@ -242,14 +242,14 @@ impl ::re_types_core::Loggable for AffixFuzzer21 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer3.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer3.rs index 53bff2f28a95..b43ce063aba7 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer3.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer3.rs @@ -288,10 +288,10 @@ impl ::re_types_core::Loggable for AffixFuzzer3 { .with_context("rerun.testing.datatypes.AffixFuzzer3"); } let degrees = { - if 1usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 1 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[1usize]; + let arrow_data = &*arrow_data_arrays[1]; arrow_data .as_any() .downcast_ref::() @@ -306,10 +306,10 @@ impl ::re_types_core::Loggable for AffixFuzzer3 { .collect::>() }; let craziness = { - if 2usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 2 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[2usize]; + let arrow_data = &*arrow_data_arrays[2]; { let arrow_data = arrow_data .as_any() @@ -338,14 +338,14 @@ impl ::re_types_core::Loggable for AffixFuzzer3 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), @@ -371,10 +371,10 @@ impl ::re_types_core::Loggable for AffixFuzzer3 { .collect::>() }; let fixed_size_shenanigans = { - if 3usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 3 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[3usize]; + let arrow_data = &*arrow_data_arrays[3]; { let arrow_data = arrow_data .as_any() diff --git a/crates/store/re_types/src/testing/datatypes/affix_fuzzer4.rs b/crates/store/re_types/src/testing/datatypes/affix_fuzzer4.rs index 8224c5bb8998..bc763821d865 100644 --- a/crates/store/re_types/src/testing/datatypes/affix_fuzzer4.rs +++ b/crates/store/re_types/src/testing/datatypes/affix_fuzzer4.rs @@ -229,20 +229,20 @@ impl ::re_types_core::Loggable for AffixFuzzer4 { .with_context("rerun.testing.datatypes.AffixFuzzer4"); } let single_required = { - if 1usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 1 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[1usize]; + let arrow_data = &*arrow_data_arrays[1]; crate::testing::datatypes::AffixFuzzer3::from_arrow2_opt(arrow_data) .with_context("rerun.testing.datatypes.AffixFuzzer4#single_required")? .into_iter() .collect::>() }; let many_required = { - if 2usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 2 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[2usize]; + let arrow_data = &*arrow_data_arrays[2]; { let arrow_data = arrow_data .as_any() @@ -271,14 +271,14 @@ impl ::re_types_core::Loggable for AffixFuzzer4 { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types/src/testing/datatypes/string_component.rs b/crates/store/re_types/src/testing/datatypes/string_component.rs index 1b2e10502f04..735ff75abb84 100644 --- a/crates/store/re_types/src/testing/datatypes/string_component.rs +++ b/crates/store/re_types/src/testing/datatypes/string_component.rs @@ -98,14 +98,15 @@ impl ::re_types_core::Loggable for StringComponent { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types/tests/types/validity.rs b/crates/store/re_types/tests/types/validity.rs index dab289a75f92..6b3f19cbe63a 100644 --- a/crates/store/re_types/tests/types/validity.rs +++ b/crates/store/re_types/tests/types/validity.rs @@ -31,8 +31,9 @@ fn validity_checks() { let serialized = Position2D::to_arrow2_opt(bad).unwrap(); let deserialized = Position2D::from_arrow2(serialized.as_ref()); assert!(deserialized.is_err()); - assert!(matches!( - deserialized.err().unwrap(), - DeserializationError::MissingData { .. } - )); + let actual_error = deserialized.err().unwrap(); + assert!( + matches!(actual_error, DeserializationError::MissingData { .. }), + "Expected error MissingData, got {actual_error:?}", + ); } diff --git a/crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list.rs b/crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list.rs index 7dd2246d1c5c..1e1d612b53c2 100644 --- a/crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list.rs +++ b/crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list.rs @@ -129,14 +129,15 @@ impl ::re_types_core::Loggable for Utf8List { let arrow_data_inner_buf = arrow_data_inner.values(); let offsets = arrow_data_inner.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data_inner.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_inner_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner_buf.len(), @@ -164,14 +165,14 @@ impl ::re_types_core::Loggable for Utf8List { }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + if arrow_data_inner.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_inner.len(), diff --git a/crates/store/re_types_core/src/archetype.rs b/crates/store/re_types_core/src/archetype.rs index 9032fb1b53a5..601684ef68fb 100644 --- a/crates/store/re_types_core/src/archetype.rs +++ b/crates/store/re_types_core/src/archetype.rs @@ -95,6 +95,24 @@ pub trait Archetype { // --- + /// Given an iterator of Arrow arrays and their respective field metadata, deserializes them + /// into this archetype. + /// + /// Arrow arrays that are unknown to this [`Archetype`] will simply be ignored and a warning + /// logged to stderr. + #[inline] + fn from_arrow( + data: impl IntoIterator, + ) -> DeserializationResult + where + Self: Sized, + { + Self::from_arrow_components( + data.into_iter() + .map(|(field, array)| (field.name.into(), array)), + ) + } + /// Given an iterator of Arrow arrays and their respective field metadata, deserializes them /// into this archetype. /// @@ -119,8 +137,8 @@ pub trait Archetype { /// Arrow arrays that are unknown to this [`Archetype`] will simply be ignored and a warning /// logged to stderr. #[inline] - fn from_arrow2_components( - data: impl IntoIterator)>, + fn from_arrow_components( + data: impl IntoIterator, ) -> DeserializationResult where Self: Sized, @@ -131,6 +149,23 @@ pub trait Archetype { backtrace: _Backtrace::new_unresolved(), }) } + + /// Given an iterator of Arrow arrays and their respective `ComponentNames`, deserializes them + /// into this archetype. + /// + /// Arrow arrays that are unknown to this [`Archetype`] will simply be ignored and a warning + /// logged to stderr. + #[inline] + fn from_arrow2_components( + data: impl IntoIterator)>, + ) -> DeserializationResult + where + Self: Sized, + { + Self::from_arrow_components(data.into_iter().map(|(component, arrow2_array)| { + (component, arrow::array::ArrayRef::from(arrow2_array)) + })) + } } /// Indicates that the archetype has reflection data available for it. diff --git a/crates/store/re_types_core/src/arrow_string.rs b/crates/store/re_types_core/src/arrow_string.rs index 9fd8b6d4e633..8376167d8deb 100644 --- a/crates/store/re_types_core/src/arrow_string.rs +++ b/crates/store/re_types_core/src/arrow_string.rs @@ -55,12 +55,24 @@ impl ArrowString { std::str::from_utf8(self.0.as_ref()).unwrap_or("INVALID UTF-8") } + #[inline] + pub fn into_arrow_buffer(self) -> arrow::buffer::Buffer { + self.0.into() + } + #[inline] pub fn into_arrow2_buffer(self) -> arrow2::buffer::Buffer { self.0 } } +impl From for ArrowString { + #[inline] + fn from(buf: arrow::buffer::Buffer) -> Self { + Self(buf.into()) + } +} + impl From> for ArrowString { #[inline] fn from(buf: arrow2::buffer::Buffer) -> Self { diff --git a/crates/store/re_types_core/src/datatypes/entity_path.rs b/crates/store/re_types_core/src/datatypes/entity_path.rs index f3b2fca0e5c8..52690454d531 100644 --- a/crates/store/re_types_core/src/datatypes/entity_path.rs +++ b/crates/store/re_types_core/src/datatypes/entity_path.rs @@ -99,14 +99,15 @@ impl crate::Loggable for EntityPath { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types_core/src/datatypes/time_range_boundary.rs b/crates/store/re_types_core/src/datatypes/time_range_boundary.rs index d50c56c9086c..92b12ba1ca91 100644 --- a/crates/store/re_types_core/src/datatypes/time_range_boundary.rs +++ b/crates/store/re_types_core/src/datatypes/time_range_boundary.rs @@ -231,10 +231,10 @@ impl crate::Loggable for TimeRangeBoundary { .with_context("rerun.datatypes.TimeRangeBoundary"); } let cursor_relative = { - if 1usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 1 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[1usize]; + let arrow_data = &*arrow_data_arrays[1]; arrow_data .as_any() .downcast_ref::() @@ -250,10 +250,10 @@ impl crate::Loggable for TimeRangeBoundary { .collect::>() }; let absolute = { - if 2usize >= arrow_data_arrays.len() { + if arrow_data_arrays.len() <= 2 { return Ok(Vec::new()); } - let arrow_data = &*arrow_data_arrays[2usize]; + let arrow_data = &*arrow_data_arrays[2]; arrow_data .as_any() .downcast_ref::() diff --git a/crates/store/re_types_core/src/datatypes/utf8.rs b/crates/store/re_types_core/src/datatypes/utf8.rs index 052f94e220d5..79e3fe46b16e 100644 --- a/crates/store/re_types_core/src/datatypes/utf8.rs +++ b/crates/store/re_types_core/src/datatypes/utf8.rs @@ -99,14 +99,15 @@ impl crate::Loggable for Utf8 { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types_core/src/datatypes/visible_time_range.rs b/crates/store/re_types_core/src/datatypes/visible_time_range.rs index fd0504caec70..91e470e85a07 100644 --- a/crates/store/re_types_core/src/datatypes/visible_time_range.rs +++ b/crates/store/re_types_core/src/datatypes/visible_time_range.rs @@ -190,14 +190,15 @@ impl crate::Loggable for VisibleTimeRange { let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), + offsets.windows(2), arrow_data.validity(), ) .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { + elem.map(|window| { + let start = window[0] as usize; + let end = window[1] as usize; + let len = end - start; + if arrow_data_buf.len() < end { return Err(DeserializationError::offset_slice_oob( (start, end), arrow_data_buf.len(), diff --git a/crates/store/re_types_core/src/lib.rs b/crates/store/re_types_core/src/lib.rs index c1fd9cf2a6df..f6deee691390 100644 --- a/crates/store/re_types_core/src/lib.rs +++ b/crates/store/re_types_core/src/lib.rs @@ -194,6 +194,7 @@ pub mod macros { pub mod external { pub use anyhow; + pub use arrow; pub use arrow2; pub use re_tuid; } diff --git a/crates/store/re_types_core/src/loggable.rs b/crates/store/re_types_core/src/loggable.rs index 1ebc3ecce1f8..0da30c5acc11 100644 --- a/crates/store/re_types_core/src/loggable.rs +++ b/crates/store/re_types_core/src/loggable.rs @@ -138,11 +138,8 @@ pub trait Loggable: 'static + Send + Sync + Clone + Sized + SizeBytes { fn from_arrow2_opt( data: &dyn arrow2::array::Array, ) -> DeserializationResult>> { - _ = data; // NOTE: do this here to avoid breaking users' autocomplete snippets - Err(crate::DeserializationError::NotImplemented { - fqname: "".to_owned(), - backtrace: _Backtrace::new_unresolved(), - }) + let boxed_arrow_array = arrow::array::ArrayRef::from(data); + Self::from_arrow_opt(boxed_arrow_array.as_ref()) } } diff --git a/tests/python/release_checklist/main.py b/tests/python/release_checklist/main.py index 96d4553c3f3d..a989c705b38d 100755 --- a/tests/python/release_checklist/main.py +++ b/tests/python/release_checklist/main.py @@ -32,10 +32,10 @@ def main() -> None: args = parser.parse_args() # Download test assets: - download_test_assest_path = ( + download_test_assets_path = ( Path(__file__).parent.parent.parent.joinpath("assets/download_test_assets.py").absolute() ) - subprocess.run([sys.executable, download_test_assest_path]) + subprocess.run([sys.executable, download_test_assets_path]) log_checks(args) From 484cd6817e9e4ad2d791da4a5ac607299ad43098 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Mon, 9 Dec 2024 19:40:53 +0100 Subject: [PATCH 06/71] Fix indicators showing up in override ui (#8374) The all components/recommended component list would previously contain a fantasy-component with an unqualified name instead of the indicator. --- crates/build/re_types_builder/src/codegen/rust/api.rs | 4 +++- crates/store/re_types/src/archetypes/annotation_context.rs | 4 ++-- crates/store/re_types/src/archetypes/arrows2d.rs | 4 ++-- crates/store/re_types/src/archetypes/arrows3d.rs | 4 ++-- crates/store/re_types/src/archetypes/asset3d.rs | 4 ++-- crates/store/re_types/src/archetypes/asset_video.rs | 4 ++-- crates/store/re_types/src/archetypes/bar_chart.rs | 4 ++-- crates/store/re_types/src/archetypes/boxes2d.rs | 4 ++-- crates/store/re_types/src/archetypes/boxes3d.rs | 4 ++-- crates/store/re_types/src/archetypes/capsules3d.rs | 4 ++-- crates/store/re_types/src/archetypes/depth_image.rs | 4 ++-- crates/store/re_types/src/archetypes/disconnected_space.rs | 4 ++-- crates/store/re_types/src/archetypes/ellipsoids3d.rs | 4 ++-- crates/store/re_types/src/archetypes/encoded_image.rs | 4 ++-- crates/store/re_types/src/archetypes/geo_line_strings.rs | 4 ++-- crates/store/re_types/src/archetypes/geo_points.rs | 4 ++-- crates/store/re_types/src/archetypes/graph_edges.rs | 4 ++-- crates/store/re_types/src/archetypes/graph_nodes.rs | 4 ++-- crates/store/re_types/src/archetypes/image.rs | 4 ++-- crates/store/re_types/src/archetypes/instance_poses3d.rs | 4 ++-- crates/store/re_types/src/archetypes/line_strips2d.rs | 4 ++-- crates/store/re_types/src/archetypes/line_strips3d.rs | 4 ++-- crates/store/re_types/src/archetypes/mesh3d.rs | 4 ++-- crates/store/re_types/src/archetypes/pinhole.rs | 4 ++-- crates/store/re_types/src/archetypes/points2d.rs | 4 ++-- crates/store/re_types/src/archetypes/points3d.rs | 4 ++-- crates/store/re_types/src/archetypes/scalar.rs | 4 ++-- crates/store/re_types/src/archetypes/segmentation_image.rs | 4 ++-- crates/store/re_types/src/archetypes/series_line.rs | 4 ++-- crates/store/re_types/src/archetypes/series_point.rs | 4 ++-- crates/store/re_types/src/archetypes/tensor.rs | 4 ++-- crates/store/re_types/src/archetypes/text_document.rs | 4 ++-- crates/store/re_types/src/archetypes/text_log.rs | 4 ++-- crates/store/re_types/src/archetypes/transform3d.rs | 4 ++-- crates/store/re_types/src/archetypes/video_frame_reference.rs | 4 ++-- crates/store/re_types/src/archetypes/view_coordinates.rs | 4 ++-- crates/store/re_types/src/blueprint/archetypes/background.rs | 4 ++-- .../re_types/src/blueprint/archetypes/dataframe_query.rs | 4 ++-- crates/store/re_types/src/blueprint/archetypes/line_grid3d.rs | 4 ++-- .../store/re_types/src/blueprint/archetypes/map_background.rs | 4 ++-- crates/store/re_types/src/blueprint/archetypes/map_zoom.rs | 4 ++-- crates/store/re_types/src/blueprint/archetypes/plot_legend.rs | 4 ++-- crates/store/re_types/src/blueprint/archetypes/scalar_axis.rs | 4 ++-- .../re_types/src/blueprint/archetypes/space_view_blueprint.rs | 4 ++-- .../re_types/src/blueprint/archetypes/space_view_contents.rs | 4 ++-- .../src/blueprint/archetypes/tensor_scalar_mapping.rs | 4 ++-- .../src/blueprint/archetypes/tensor_slice_selection.rs | 4 ++-- .../re_types/src/blueprint/archetypes/tensor_view_fit.rs | 4 ++-- .../re_types/src/blueprint/archetypes/visible_time_ranges.rs | 4 ++-- .../re_types/src/blueprint/archetypes/visual_bounds2d.rs | 4 ++-- crates/store/re_types/src/testing/archetypes/affix_fuzzer1.rs | 4 ++-- crates/store/re_types/src/testing/archetypes/affix_fuzzer2.rs | 4 ++-- crates/store/re_types/src/testing/archetypes/affix_fuzzer3.rs | 4 ++-- crates/store/re_types/src/testing/archetypes/affix_fuzzer4.rs | 4 ++-- .../src/blueprint/archetypes/container_blueprint.rs | 4 ++-- .../src/blueprint/archetypes/panel_blueprint.rs | 4 ++-- .../src/blueprint/archetypes/viewport_blueprint.rs | 4 ++-- crates/store/re_types_core/src/archetypes/clear.rs | 4 ++-- 58 files changed, 117 insertions(+), 115 deletions(-) diff --git a/crates/build/re_types_builder/src/codegen/rust/api.rs b/crates/build/re_types_builder/src/codegen/rust/api.rs index 3125197d0889..1f6d2c754f7e 100644 --- a/crates/build/re_types_builder/src/codegen/rust/api.rs +++ b/crates/build/re_types_builder/src/codegen/rust/api.rs @@ -1084,6 +1084,8 @@ fn quote_trait_impls_for_archetype(obj: &Object) -> TokenStream { let quoted_indicator_name = format_ident!("{indicator_name}"); let quoted_indicator_doc = format!("Indicator component for the [`{name}`] [`::re_types_core::Archetype`]"); + let indicator_component_name = + format!("{}Indicator", fqname.replace("archetypes", "components")); let (num_required_descriptors, required_descriptors) = compute_component_descriptors(obj, ATTR_RERUN_COMPONENT_REQUIRED); @@ -1097,7 +1099,7 @@ fn quote_trait_impls_for_archetype(obj: &Object) -> TokenStream { #recommended_descriptors ComponentDescriptor { archetype_name: Some(#archetype_name.into()), - component_name: #indicator_name.into(), + component_name: #indicator_component_name.into(), archetype_field_name: None, }, }; diff --git a/crates/store/re_types/src/archetypes/annotation_context.rs b/crates/store/re_types/src/archetypes/annotation_context.rs index e4668e6c5360..8612d3af7624 100644 --- a/crates/store/re_types/src/archetypes/annotation_context.rs +++ b/crates/store/re_types/src/archetypes/annotation_context.rs @@ -88,7 +88,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.AnnotationContext".into()), - component_name: "AnnotationContextIndicator".into(), + component_name: "rerun.components.AnnotationContextIndicator".into(), archetype_field_name: None, }] }); @@ -106,7 +106,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.AnnotationContext".into()), - component_name: "AnnotationContextIndicator".into(), + component_name: "rerun.components.AnnotationContextIndicator".into(), archetype_field_name: None, }, ] diff --git a/crates/store/re_types/src/archetypes/arrows2d.rs b/crates/store/re_types/src/archetypes/arrows2d.rs index f2b4e977d614..73d077994f4f 100644 --- a/crates/store/re_types/src/archetypes/arrows2d.rs +++ b/crates/store/re_types/src/archetypes/arrows2d.rs @@ -106,7 +106,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Arrows2D".into()), - component_name: "Arrows2DIndicator".into(), + component_name: "rerun.components.Arrows2DIndicator".into(), archetype_field_name: None, }, ] @@ -163,7 +163,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 9usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Arrows2D".into()), - component_name: "Arrows2DIndicator".into(), + component_name: "rerun.components.Arrows2DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/arrows3d.rs b/crates/store/re_types/src/archetypes/arrows3d.rs index 365b717eb754..a6cd1074b5c3 100644 --- a/crates/store/re_types/src/archetypes/arrows3d.rs +++ b/crates/store/re_types/src/archetypes/arrows3d.rs @@ -114,7 +114,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Arrows3D".into()), - component_name: "Arrows3DIndicator".into(), + component_name: "rerun.components.Arrows3DIndicator".into(), archetype_field_name: None, }, ] @@ -166,7 +166,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Arrows3D".into()), - component_name: "Arrows3DIndicator".into(), + component_name: "rerun.components.Arrows3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/asset3d.rs b/crates/store/re_types/src/archetypes/asset3d.rs index 4060c8c717c7..e1381ac13f03 100644 --- a/crates/store/re_types/src/archetypes/asset3d.rs +++ b/crates/store/re_types/src/archetypes/asset3d.rs @@ -97,7 +97,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Asset3D".into()), - component_name: "Asset3DIndicator".into(), + component_name: "rerun.components.Asset3DIndicator".into(), archetype_field_name: None, }, ] @@ -127,7 +127,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Asset3D".into()), - component_name: "Asset3DIndicator".into(), + component_name: "rerun.components.Asset3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/asset_video.rs b/crates/store/re_types/src/archetypes/asset_video.rs index f4bfa89834c3..6d405894be12 100644 --- a/crates/store/re_types/src/archetypes/asset_video.rs +++ b/crates/store/re_types/src/archetypes/asset_video.rs @@ -158,7 +158,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.AssetVideo".into()), - component_name: "AssetVideoIndicator".into(), + component_name: "rerun.components.AssetVideoIndicator".into(), archetype_field_name: None, }, ] @@ -182,7 +182,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.AssetVideo".into()), - component_name: "AssetVideoIndicator".into(), + component_name: "rerun.components.AssetVideoIndicator".into(), archetype_field_name: None, }, ] diff --git a/crates/store/re_types/src/archetypes/bar_chart.rs b/crates/store/re_types/src/archetypes/bar_chart.rs index cd2e8ec7f816..8f5e2157db79 100644 --- a/crates/store/re_types/src/archetypes/bar_chart.rs +++ b/crates/store/re_types/src/archetypes/bar_chart.rs @@ -68,7 +68,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.BarChart".into()), - component_name: "BarChartIndicator".into(), + component_name: "rerun.components.BarChartIndicator".into(), archetype_field_name: None, }] }); @@ -92,7 +92,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.BarChart".into()), - component_name: "BarChartIndicator".into(), + component_name: "rerun.components.BarChartIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/boxes2d.rs b/crates/store/re_types/src/archetypes/boxes2d.rs index 1e6fd8ebb4ba..e63a42357d97 100644 --- a/crates/store/re_types/src/archetypes/boxes2d.rs +++ b/crates/store/re_types/src/archetypes/boxes2d.rs @@ -104,7 +104,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Boxes2D".into()), - component_name: "Boxes2DIndicator".into(), + component_name: "rerun.components.Boxes2DIndicator".into(), archetype_field_name: None, }, ] @@ -161,7 +161,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 9usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Boxes2D".into()), - component_name: "Boxes2DIndicator".into(), + component_name: "rerun.components.Boxes2DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/boxes3d.rs b/crates/store/re_types/src/archetypes/boxes3d.rs index 05aa282251b5..f0b2d929212e 100644 --- a/crates/store/re_types/src/archetypes/boxes3d.rs +++ b/crates/store/re_types/src/archetypes/boxes3d.rs @@ -134,7 +134,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Boxes3D".into()), - component_name: "Boxes3DIndicator".into(), + component_name: "rerun.components.Boxes3DIndicator".into(), archetype_field_name: None, }, ] @@ -201,7 +201,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 11usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Boxes3D".into()), - component_name: "Boxes3DIndicator".into(), + component_name: "rerun.components.Boxes3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/capsules3d.rs b/crates/store/re_types/src/archetypes/capsules3d.rs index 6270589d7797..7e5cb90368b7 100644 --- a/crates/store/re_types/src/archetypes/capsules3d.rs +++ b/crates/store/re_types/src/archetypes/capsules3d.rs @@ -143,7 +143,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Capsules3D".into()), - component_name: "Capsules3DIndicator".into(), + component_name: "rerun.components.Capsules3DIndicator".into(), archetype_field_name: None, }, ] @@ -205,7 +205,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 10usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Capsules3D".into()), - component_name: "Capsules3DIndicator".into(), + component_name: "rerun.components.Capsules3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/depth_image.rs b/crates/store/re_types/src/archetypes/depth_image.rs index e40dda40b807..fcaa8f20b1b7 100644 --- a/crates/store/re_types/src/archetypes/depth_image.rs +++ b/crates/store/re_types/src/archetypes/depth_image.rs @@ -134,7 +134,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.DepthImage".into()), - component_name: "DepthImageIndicator".into(), + component_name: "rerun.components.DepthImageIndicator".into(), archetype_field_name: None, }] }); @@ -185,7 +185,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.DepthImage".into()), - component_name: "DepthImageIndicator".into(), + component_name: "rerun.components.DepthImageIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/disconnected_space.rs b/crates/store/re_types/src/archetypes/disconnected_space.rs index aa1e23a04bca..06e7a14804bb 100644 --- a/crates/store/re_types/src/archetypes/disconnected_space.rs +++ b/crates/store/re_types/src/archetypes/disconnected_space.rs @@ -80,7 +80,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.DisconnectedSpace".into()), - component_name: "DisconnectedSpaceIndicator".into(), + component_name: "rerun.components.DisconnectedSpaceIndicator".into(), archetype_field_name: None, }] }); @@ -98,7 +98,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.DisconnectedSpace".into()), - component_name: "DisconnectedSpaceIndicator".into(), + component_name: "rerun.components.DisconnectedSpaceIndicator".into(), archetype_field_name: None, }, ] diff --git a/crates/store/re_types/src/archetypes/ellipsoids3d.rs b/crates/store/re_types/src/archetypes/ellipsoids3d.rs index 40694e88c462..bc6ee14a53f6 100644 --- a/crates/store/re_types/src/archetypes/ellipsoids3d.rs +++ b/crates/store/re_types/src/archetypes/ellipsoids3d.rs @@ -97,7 +97,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), - component_name: "Ellipsoids3DIndicator".into(), + component_name: "rerun.components.Ellipsoids3DIndicator".into(), archetype_field_name: None, }, ] @@ -164,7 +164,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 11usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Ellipsoids3D".into()), - component_name: "Ellipsoids3DIndicator".into(), + component_name: "rerun.components.Ellipsoids3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/encoded_image.rs b/crates/store/re_types/src/archetypes/encoded_image.rs index f84b751f95bd..c415be42a437 100644 --- a/crates/store/re_types/src/archetypes/encoded_image.rs +++ b/crates/store/re_types/src/archetypes/encoded_image.rs @@ -85,7 +85,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.EncodedImage".into()), - component_name: "EncodedImageIndicator".into(), + component_name: "rerun.components.EncodedImageIndicator".into(), archetype_field_name: None, }, ] @@ -122,7 +122,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.EncodedImage".into()), - component_name: "EncodedImageIndicator".into(), + component_name: "rerun.components.EncodedImageIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/geo_line_strings.rs b/crates/store/re_types/src/archetypes/geo_line_strings.rs index 7163de6e1eda..341616ee2eb3 100644 --- a/crates/store/re_types/src/archetypes/geo_line_strings.rs +++ b/crates/store/re_types/src/archetypes/geo_line_strings.rs @@ -93,7 +93,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), - component_name: "GeoLineStringsIndicator".into(), + component_name: "rerun.components.GeoLineStringsIndicator".into(), archetype_field_name: None, }, ] @@ -122,7 +122,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.GeoLineStrings".into()), - component_name: "GeoLineStringsIndicator".into(), + component_name: "rerun.components.GeoLineStringsIndicator".into(), archetype_field_name: None, }, ] diff --git a/crates/store/re_types/src/archetypes/geo_points.rs b/crates/store/re_types/src/archetypes/geo_points.rs index 296023d7aacd..1051801f5767 100644 --- a/crates/store/re_types/src/archetypes/geo_points.rs +++ b/crates/store/re_types/src/archetypes/geo_points.rs @@ -89,7 +89,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.GeoPoints".into()), - component_name: "GeoPointsIndicator".into(), + component_name: "rerun.components.GeoPointsIndicator".into(), archetype_field_name: None, }, ] @@ -124,7 +124,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.GeoPoints".into()), - component_name: "GeoPointsIndicator".into(), + component_name: "rerun.components.GeoPointsIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/graph_edges.rs b/crates/store/re_types/src/archetypes/graph_edges.rs index f93d9081c749..a4aee2905982 100644 --- a/crates/store/re_types/src/archetypes/graph_edges.rs +++ b/crates/store/re_types/src/archetypes/graph_edges.rs @@ -53,7 +53,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.GraphEdges".into()), - component_name: "GraphEdgesIndicator".into(), + component_name: "rerun.components.GraphEdgesIndicator".into(), archetype_field_name: None, }, ] @@ -77,7 +77,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.GraphEdges".into()), - component_name: "GraphEdgesIndicator".into(), + component_name: "rerun.components.GraphEdgesIndicator".into(), archetype_field_name: None, }, ] diff --git a/crates/store/re_types/src/archetypes/graph_nodes.rs b/crates/store/re_types/src/archetypes/graph_nodes.rs index 83f54409f8e8..7a2c73d84601 100644 --- a/crates/store/re_types/src/archetypes/graph_nodes.rs +++ b/crates/store/re_types/src/archetypes/graph_nodes.rs @@ -55,7 +55,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.GraphNodes".into()), - component_name: "GraphNodesIndicator".into(), + component_name: "rerun.components.GraphNodesIndicator".into(), archetype_field_name: None, }] }); @@ -101,7 +101,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.GraphNodes".into()), - component_name: "GraphNodesIndicator".into(), + component_name: "rerun.components.GraphNodesIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/image.rs b/crates/store/re_types/src/archetypes/image.rs index 8155275d8c8b..523f26001142 100644 --- a/crates/store/re_types/src/archetypes/image.rs +++ b/crates/store/re_types/src/archetypes/image.rs @@ -165,7 +165,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.Image".into()), - component_name: "ImageIndicator".into(), + component_name: "rerun.components.ImageIndicator".into(), archetype_field_name: None, }] }); @@ -201,7 +201,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Image".into()), - component_name: "ImageIndicator".into(), + component_name: "rerun.components.ImageIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/instance_poses3d.rs b/crates/store/re_types/src/archetypes/instance_poses3d.rs index 397a5eec43a9..fd99a27f18ea 100644 --- a/crates/store/re_types/src/archetypes/instance_poses3d.rs +++ b/crates/store/re_types/src/archetypes/instance_poses3d.rs @@ -115,7 +115,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), - component_name: "InstancePoses3DIndicator".into(), + component_name: "rerun.components.InstancePoses3DIndicator".into(), archetype_field_name: None, }] }); @@ -156,7 +156,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.archetypes.InstancePoses3D".into()), - component_name: "InstancePoses3DIndicator".into(), + component_name: "rerun.components.InstancePoses3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/line_strips2d.rs b/crates/store/re_types/src/archetypes/line_strips2d.rs index c8e2ba6827e3..6e44147492ee 100644 --- a/crates/store/re_types/src/archetypes/line_strips2d.rs +++ b/crates/store/re_types/src/archetypes/line_strips2d.rs @@ -138,7 +138,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.LineStrips2D".into()), - component_name: "LineStrips2DIndicator".into(), + component_name: "rerun.components.LineStrips2DIndicator".into(), archetype_field_name: None, }, ] @@ -190,7 +190,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.LineStrips2D".into()), - component_name: "LineStrips2DIndicator".into(), + component_name: "rerun.components.LineStrips2DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/line_strips3d.rs b/crates/store/re_types/src/archetypes/line_strips3d.rs index 1fcdee8bc99f..3bca90b8753f 100644 --- a/crates/store/re_types/src/archetypes/line_strips3d.rs +++ b/crates/store/re_types/src/archetypes/line_strips3d.rs @@ -148,7 +148,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.LineStrips3D".into()), - component_name: "LineStrips3DIndicator".into(), + component_name: "rerun.components.LineStrips3DIndicator".into(), archetype_field_name: None, }, ] @@ -195,7 +195,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.LineStrips3D".into()), - component_name: "LineStrips3DIndicator".into(), + component_name: "rerun.components.LineStrips3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/mesh3d.rs b/crates/store/re_types/src/archetypes/mesh3d.rs index b7d1f8211434..e4a7d8528a09 100644 --- a/crates/store/re_types/src/archetypes/mesh3d.rs +++ b/crates/store/re_types/src/archetypes/mesh3d.rs @@ -169,7 +169,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Mesh3D".into()), - component_name: "Mesh3DIndicator".into(), + component_name: "rerun.components.Mesh3DIndicator".into(), archetype_field_name: None, }, ] @@ -231,7 +231,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 10usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Mesh3D".into()), - component_name: "Mesh3DIndicator".into(), + component_name: "rerun.components.Mesh3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/pinhole.rs b/crates/store/re_types/src/archetypes/pinhole.rs index 4d3c1199c867..23dc3ee1c755 100644 --- a/crates/store/re_types/src/archetypes/pinhole.rs +++ b/crates/store/re_types/src/archetypes/pinhole.rs @@ -155,7 +155,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Pinhole".into()), - component_name: "PinholeIndicator".into(), + component_name: "rerun.components.PinholeIndicator".into(), archetype_field_name: None, }, ] @@ -192,7 +192,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Pinhole".into()), - component_name: "PinholeIndicator".into(), + component_name: "rerun.components.PinholeIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/points2d.rs b/crates/store/re_types/src/archetypes/points2d.rs index c10aafffbad4..8b8cbf318a53 100644 --- a/crates/store/re_types/src/archetypes/points2d.rs +++ b/crates/store/re_types/src/archetypes/points2d.rs @@ -161,7 +161,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Points2D".into()), - component_name: "Points2DIndicator".into(), + component_name: "rerun.components.Points2DIndicator".into(), archetype_field_name: None, }, ] @@ -218,7 +218,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 9usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Points2D".into()), - component_name: "Points2DIndicator".into(), + component_name: "rerun.components.Points2DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/points3d.rs b/crates/store/re_types/src/archetypes/points3d.rs index 98ad990b572a..0828e9e0eda4 100644 --- a/crates/store/re_types/src/archetypes/points3d.rs +++ b/crates/store/re_types/src/archetypes/points3d.rs @@ -154,7 +154,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Points3D".into()), - component_name: "Points3DIndicator".into(), + component_name: "rerun.components.Points3DIndicator".into(), archetype_field_name: None, }, ] @@ -206,7 +206,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Points3D".into()), - component_name: "Points3DIndicator".into(), + component_name: "rerun.components.Points3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/scalar.rs b/crates/store/re_types/src/archetypes/scalar.rs index a1790cc727d3..8bebaac4327a 100644 --- a/crates/store/re_types/src/archetypes/scalar.rs +++ b/crates/store/re_types/src/archetypes/scalar.rs @@ -72,7 +72,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.Scalar".into()), - component_name: "ScalarIndicator".into(), + component_name: "rerun.components.ScalarIndicator".into(), archetype_field_name: None, }] }); @@ -90,7 +90,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Scalar".into()), - component_name: "ScalarIndicator".into(), + component_name: "rerun.components.ScalarIndicator".into(), archetype_field_name: None, }, ] diff --git a/crates/store/re_types/src/archetypes/segmentation_image.rs b/crates/store/re_types/src/archetypes/segmentation_image.rs index 6896664fed5d..b26145d93c44 100644 --- a/crates/store/re_types/src/archetypes/segmentation_image.rs +++ b/crates/store/re_types/src/archetypes/segmentation_image.rs @@ -103,7 +103,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.SegmentationImage".into()), - component_name: "SegmentationImageIndicator".into(), + component_name: "rerun.components.SegmentationImageIndicator".into(), archetype_field_name: None, }] }); @@ -139,7 +139,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.SegmentationImage".into()), - component_name: "SegmentationImageIndicator".into(), + component_name: "rerun.components.SegmentationImageIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/series_line.rs b/crates/store/re_types/src/archetypes/series_line.rs index 5b28774c30ee..258b7bd9996c 100644 --- a/crates/store/re_types/src/archetypes/series_line.rs +++ b/crates/store/re_types/src/archetypes/series_line.rs @@ -97,7 +97,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.SeriesLine".into()), - component_name: "SeriesLineIndicator".into(), + component_name: "rerun.components.SeriesLineIndicator".into(), archetype_field_name: None, }] }); @@ -133,7 +133,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.archetypes.SeriesLine".into()), - component_name: "SeriesLineIndicator".into(), + component_name: "rerun.components.SeriesLineIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/series_point.rs b/crates/store/re_types/src/archetypes/series_point.rs index ca99b4c9421c..b77a9c91b18b 100644 --- a/crates/store/re_types/src/archetypes/series_point.rs +++ b/crates/store/re_types/src/archetypes/series_point.rs @@ -95,7 +95,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.SeriesPoint".into()), - component_name: "SeriesPointIndicator".into(), + component_name: "rerun.components.SeriesPointIndicator".into(), archetype_field_name: None, }] }); @@ -131,7 +131,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.archetypes.SeriesPoint".into()), - component_name: "SeriesPointIndicator".into(), + component_name: "rerun.components.SeriesPointIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/tensor.rs b/crates/store/re_types/src/archetypes/tensor.rs index 560fca86232b..54abbdffd86c 100644 --- a/crates/store/re_types/src/archetypes/tensor.rs +++ b/crates/store/re_types/src/archetypes/tensor.rs @@ -80,7 +80,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.Tensor".into()), - component_name: "TensorIndicator".into(), + component_name: "rerun.components.TensorIndicator".into(), archetype_field_name: None, }] }); @@ -104,7 +104,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Tensor".into()), - component_name: "TensorIndicator".into(), + component_name: "rerun.components.TensorIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/text_document.rs b/crates/store/re_types/src/archetypes/text_document.rs index 6e7a75e9b4ef..06d506570baf 100644 --- a/crates/store/re_types/src/archetypes/text_document.rs +++ b/crates/store/re_types/src/archetypes/text_document.rs @@ -115,7 +115,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.TextDocument".into()), - component_name: "TextDocumentIndicator".into(), + component_name: "rerun.components.TextDocumentIndicator".into(), archetype_field_name: None, }] }); @@ -139,7 +139,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.TextDocument".into()), - component_name: "TextDocumentIndicator".into(), + component_name: "rerun.components.TextDocumentIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/text_log.rs b/crates/store/re_types/src/archetypes/text_log.rs index 790eff336028..c23408094261 100644 --- a/crates/store/re_types/src/archetypes/text_log.rs +++ b/crates/store/re_types/src/archetypes/text_log.rs @@ -91,7 +91,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usiz }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.TextLog".into()), - component_name: "TextLogIndicator".into(), + component_name: "rerun.components.TextLogIndicator".into(), archetype_field_name: None, }, ] @@ -121,7 +121,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.TextLog".into()), - component_name: "TextLogIndicator".into(), + component_name: "rerun.components.TextLogIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/transform3d.rs b/crates/store/re_types/src/archetypes/transform3d.rs index 83b75fe0094c..19bea105a99f 100644 --- a/crates/store/re_types/src/archetypes/transform3d.rs +++ b/crates/store/re_types/src/archetypes/transform3d.rs @@ -200,7 +200,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.Transform3D".into()), - component_name: "Transform3DIndicator".into(), + component_name: "rerun.components.Transform3DIndicator".into(), archetype_field_name: None, }] }); @@ -251,7 +251,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 8usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.archetypes.Transform3D".into()), - component_name: "Transform3DIndicator".into(), + component_name: "rerun.components.Transform3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/video_frame_reference.rs b/crates/store/re_types/src/archetypes/video_frame_reference.rs index 115bc100907e..e302867c0531 100644 --- a/crates/store/re_types/src/archetypes/video_frame_reference.rs +++ b/crates/store/re_types/src/archetypes/video_frame_reference.rs @@ -159,7 +159,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.VideoFrameReference".into()), - component_name: "VideoFrameReferenceIndicator".into(), + component_name: "rerun.components.VideoFrameReferenceIndicator".into(), archetype_field_name: None, }] }); @@ -183,7 +183,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.VideoFrameReference".into()), - component_name: "VideoFrameReferenceIndicator".into(), + component_name: "rerun.components.VideoFrameReferenceIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/archetypes/view_coordinates.rs b/crates/store/re_types/src/archetypes/view_coordinates.rs index 21a54202049e..4007da4f52f6 100644 --- a/crates/store/re_types/src/archetypes/view_coordinates.rs +++ b/crates/store/re_types/src/archetypes/view_coordinates.rs @@ -79,7 +79,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.ViewCoordinates".into()), - component_name: "ViewCoordinatesIndicator".into(), + component_name: "rerun.components.ViewCoordinatesIndicator".into(), archetype_field_name: None, }] }); @@ -97,7 +97,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.ViewCoordinates".into()), - component_name: "ViewCoordinatesIndicator".into(), + component_name: "rerun.components.ViewCoordinatesIndicator".into(), archetype_field_name: None, }, ] diff --git a/crates/store/re_types/src/blueprint/archetypes/background.rs b/crates/store/re_types/src/blueprint/archetypes/background.rs index 40f46eaf3dd2..0b56c276a7e5 100644 --- a/crates/store/re_types/src/blueprint/archetypes/background.rs +++ b/crates/store/re_types/src/blueprint/archetypes/background.rs @@ -41,7 +41,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.Background".into()), - component_name: "BackgroundIndicator".into(), + component_name: "rerun.blueprint.components.BackgroundIndicator".into(), archetype_field_name: None, }] }); @@ -65,7 +65,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.Background".into()), - component_name: "BackgroundIndicator".into(), + component_name: "rerun.blueprint.components.BackgroundIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs b/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs index e6ebc097fa6b..22044c2a31ed 100644 --- a/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs +++ b/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs @@ -48,7 +48,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), - component_name: "DataframeQueryIndicator".into(), + component_name: "rerun.blueprint.components.DataframeQueryIndicator".into(), archetype_field_name: None, }] }); @@ -89,7 +89,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.DataframeQuery".into()), - component_name: "DataframeQueryIndicator".into(), + component_name: "rerun.blueprint.components.DataframeQueryIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/line_grid3d.rs b/crates/store/re_types/src/blueprint/archetypes/line_grid3d.rs index 933cc2bfb1ff..3442f7edc628 100644 --- a/crates/store/re_types/src/blueprint/archetypes/line_grid3d.rs +++ b/crates/store/re_types/src/blueprint/archetypes/line_grid3d.rs @@ -56,7 +56,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.LineGrid3D".into()), - component_name: "LineGrid3DIndicator".into(), + component_name: "rerun.blueprint.components.LineGrid3DIndicator".into(), archetype_field_name: None, }] }); @@ -97,7 +97,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.LineGrid3D".into()), - component_name: "LineGrid3DIndicator".into(), + component_name: "rerun.blueprint.components.LineGrid3DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/map_background.rs b/crates/store/re_types/src/blueprint/archetypes/map_background.rs index 8bfdb2e0d359..7efeb6d2a687 100644 --- a/crates/store/re_types/src/blueprint/archetypes/map_background.rs +++ b/crates/store/re_types/src/blueprint/archetypes/map_background.rs @@ -34,7 +34,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.MapBackground".into()), - component_name: "MapBackgroundIndicator".into(), + component_name: "rerun.blueprint.components.MapBackgroundIndicator".into(), archetype_field_name: None, }] }); @@ -53,7 +53,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.MapBackground".into()), - component_name: "MapBackgroundIndicator".into(), + component_name: "rerun.blueprint.components.MapBackgroundIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/map_zoom.rs b/crates/store/re_types/src/blueprint/archetypes/map_zoom.rs index 6904408597da..d4f68720d285 100644 --- a/crates/store/re_types/src/blueprint/archetypes/map_zoom.rs +++ b/crates/store/re_types/src/blueprint/archetypes/map_zoom.rs @@ -34,7 +34,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.MapZoom".into()), - component_name: "MapZoomIndicator".into(), + component_name: "rerun.blueprint.components.MapZoomIndicator".into(), archetype_field_name: None, }] }); @@ -53,7 +53,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.MapZoom".into()), - component_name: "MapZoomIndicator".into(), + component_name: "rerun.blueprint.components.MapZoomIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/plot_legend.rs b/crates/store/re_types/src/blueprint/archetypes/plot_legend.rs index 4dc4f647f52e..7c371c5c9a44 100644 --- a/crates/store/re_types/src/blueprint/archetypes/plot_legend.rs +++ b/crates/store/re_types/src/blueprint/archetypes/plot_legend.rs @@ -39,7 +39,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.PlotLegend".into()), - component_name: "PlotLegendIndicator".into(), + component_name: "rerun.blueprint.components.PlotLegendIndicator".into(), archetype_field_name: None, }] }); @@ -65,7 +65,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.PlotLegend".into()), - component_name: "PlotLegendIndicator".into(), + component_name: "rerun.blueprint.components.PlotLegendIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/scalar_axis.rs b/crates/store/re_types/src/blueprint/archetypes/scalar_axis.rs index 6a1a53efdf8e..a6a75ebc6def 100644 --- a/crates/store/re_types/src/blueprint/archetypes/scalar_axis.rs +++ b/crates/store/re_types/src/blueprint/archetypes/scalar_axis.rs @@ -37,7 +37,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ScalarAxis".into()), - component_name: "ScalarAxisIndicator".into(), + component_name: "rerun.blueprint.components.ScalarAxisIndicator".into(), archetype_field_name: None, }] }); @@ -63,7 +63,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ScalarAxis".into()), - component_name: "ScalarAxisIndicator".into(), + component_name: "rerun.blueprint.components.ScalarAxisIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs b/crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs index 862698b22376..996c0d54dd19 100644 --- a/crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs +++ b/crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs @@ -55,7 +55,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), - component_name: "SpaceViewBlueprintIndicator".into(), + component_name: "rerun.blueprint.components.SpaceViewBlueprintIndicator".into(), archetype_field_name: None, }] }); @@ -91,7 +91,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), - component_name: "SpaceViewBlueprintIndicator".into(), + component_name: "rerun.blueprint.components.SpaceViewBlueprintIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs b/crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs index e2f80f7c17ee..6d0561e4c87f 100644 --- a/crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs +++ b/crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs @@ -71,7 +71,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), - component_name: "SpaceViewContentsIndicator".into(), + component_name: "rerun.blueprint.components.SpaceViewContentsIndicator".into(), archetype_field_name: None, }] }); @@ -90,7 +90,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), - component_name: "SpaceViewContentsIndicator".into(), + component_name: "rerun.blueprint.components.SpaceViewContentsIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/tensor_scalar_mapping.rs b/crates/store/re_types/src/blueprint/archetypes/tensor_scalar_mapping.rs index e41bd0f1a192..0756e3347a66 100644 --- a/crates/store/re_types/src/blueprint/archetypes/tensor_scalar_mapping.rs +++ b/crates/store/re_types/src/blueprint/archetypes/tensor_scalar_mapping.rs @@ -46,7 +46,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), - component_name: "TensorScalarMappingIndicator".into(), + component_name: "rerun.blueprint.components.TensorScalarMappingIndicator".into(), archetype_field_name: None, }] }); @@ -77,7 +77,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.TensorScalarMapping".into()), - component_name: "TensorScalarMappingIndicator".into(), + component_name: "rerun.blueprint.components.TensorScalarMappingIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/tensor_slice_selection.rs b/crates/store/re_types/src/blueprint/archetypes/tensor_slice_selection.rs index ac2e9755bb79..422cd47a38d7 100644 --- a/crates/store/re_types/src/blueprint/archetypes/tensor_slice_selection.rs +++ b/crates/store/re_types/src/blueprint/archetypes/tensor_slice_selection.rs @@ -51,7 +51,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), - component_name: "TensorSliceSelectionIndicator".into(), + component_name: "rerun.blueprint.components.TensorSliceSelectionIndicator".into(), archetype_field_name: None, }] }); @@ -87,7 +87,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.TensorSliceSelection".into()), - component_name: "TensorSliceSelectionIndicator".into(), + component_name: "rerun.blueprint.components.TensorSliceSelectionIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/tensor_view_fit.rs b/crates/store/re_types/src/blueprint/archetypes/tensor_view_fit.rs index 5b3a69bcc05a..8e6bbfd0aa10 100644 --- a/crates/store/re_types/src/blueprint/archetypes/tensor_view_fit.rs +++ b/crates/store/re_types/src/blueprint/archetypes/tensor_view_fit.rs @@ -32,7 +32,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.TensorViewFit".into()), - component_name: "TensorViewFitIndicator".into(), + component_name: "rerun.blueprint.components.TensorViewFitIndicator".into(), archetype_field_name: None, }] }); @@ -51,7 +51,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.TensorViewFit".into()), - component_name: "TensorViewFitIndicator".into(), + component_name: "rerun.blueprint.components.TensorViewFitIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/blueprint/archetypes/visible_time_ranges.rs b/crates/store/re_types/src/blueprint/archetypes/visible_time_ranges.rs index 4ecccbefec41..8056a916b681 100644 --- a/crates/store/re_types/src/blueprint/archetypes/visible_time_ranges.rs +++ b/crates/store/re_types/src/blueprint/archetypes/visible_time_ranges.rs @@ -48,7 +48,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.VisibleTimeRanges".into()), - component_name: "VisibleTimeRangesIndicator".into(), + component_name: "rerun.blueprint.components.VisibleTimeRangesIndicator".into(), archetype_field_name: None, }] }); @@ -66,7 +66,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.VisibleTimeRanges".into()), - component_name: "VisibleTimeRangesIndicator".into(), + component_name: "rerun.blueprint.components.VisibleTimeRangesIndicator".into(), archetype_field_name: None, }, ] diff --git a/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs b/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs index 7cf84881ea80..48072b0eedf8 100644 --- a/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs +++ b/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs @@ -51,7 +51,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), - component_name: "VisualBounds2DIndicator".into(), + component_name: "rerun.blueprint.components.VisualBounds2DIndicator".into(), archetype_field_name: None, }] }); @@ -75,7 +75,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), - component_name: "VisualBounds2DIndicator".into(), + component_name: "rerun.blueprint.components.VisualBounds2DIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/testing/archetypes/affix_fuzzer1.rs b/crates/store/re_types/src/testing/archetypes/affix_fuzzer1.rs index 47c4f74273ab..8eed4f39795a 100644 --- a/crates/store/re_types/src/testing/archetypes/affix_fuzzer1.rs +++ b/crates/store/re_types/src/testing/archetypes/affix_fuzzer1.rs @@ -164,7 +164,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), - component_name: "AffixFuzzer1Indicator".into(), + component_name: "rerun.testing.components.AffixFuzzer1Indicator".into(), archetype_field_name: None, }] }); @@ -287,7 +287,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 23usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.testing.archetypes.AffixFuzzer1".into()), - component_name: "AffixFuzzer1Indicator".into(), + component_name: "rerun.testing.components.AffixFuzzer1Indicator".into(), archetype_field_name: None, }, ] diff --git a/crates/store/re_types/src/testing/archetypes/affix_fuzzer2.rs b/crates/store/re_types/src/testing/archetypes/affix_fuzzer2.rs index 24c81be72891..28cb64bfebc6 100644 --- a/crates/store/re_types/src/testing/archetypes/affix_fuzzer2.rs +++ b/crates/store/re_types/src/testing/archetypes/affix_fuzzer2.rs @@ -146,7 +146,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), - component_name: "AffixFuzzer2Indicator".into(), + component_name: "rerun.testing.components.AffixFuzzer2Indicator".into(), archetype_field_name: None, }] }); @@ -254,7 +254,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 20usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.testing.archetypes.AffixFuzzer2".into()), - component_name: "AffixFuzzer2Indicator".into(), + component_name: "rerun.testing.components.AffixFuzzer2Indicator".into(), archetype_field_name: None, }, ] diff --git a/crates/store/re_types/src/testing/archetypes/affix_fuzzer3.rs b/crates/store/re_types/src/testing/archetypes/affix_fuzzer3.rs index ede139b4c342..643d315ff076 100644 --- a/crates/store/re_types/src/testing/archetypes/affix_fuzzer3.rs +++ b/crates/store/re_types/src/testing/archetypes/affix_fuzzer3.rs @@ -47,7 +47,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), - component_name: "AffixFuzzer3Indicator".into(), + component_name: "rerun.testing.components.AffixFuzzer3Indicator".into(), archetype_field_name: None, }] }); @@ -153,7 +153,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 19usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.testing.archetypes.AffixFuzzer3".into()), - component_name: "AffixFuzzer3Indicator".into(), + component_name: "rerun.testing.components.AffixFuzzer3Indicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types/src/testing/archetypes/affix_fuzzer4.rs b/crates/store/re_types/src/testing/archetypes/affix_fuzzer4.rs index 797f5089e777..e3f2d70e7783 100644 --- a/crates/store/re_types/src/testing/archetypes/affix_fuzzer4.rs +++ b/crates/store/re_types/src/testing/archetypes/affix_fuzzer4.rs @@ -47,7 +47,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), - component_name: "AffixFuzzer4Indicator".into(), + component_name: "rerun.testing.components.AffixFuzzer4Indicator".into(), archetype_field_name: None, }] }); @@ -153,7 +153,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 19usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.testing.archetypes.AffixFuzzer4".into()), - component_name: "AffixFuzzer4Indicator".into(), + component_name: "rerun.testing.components.AffixFuzzer4Indicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs b/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs index 95e2991da168..c7327f7eb3d2 100644 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs +++ b/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs @@ -75,7 +75,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), - component_name: "ContainerBlueprintIndicator".into(), + component_name: "rerun.blueprint.components.ContainerBlueprintIndicator".into(), archetype_field_name: None, }] }); @@ -131,7 +131,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 9usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ContainerBlueprint".into()), - component_name: "ContainerBlueprintIndicator".into(), + component_name: "rerun.blueprint.components.ContainerBlueprintIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs b/crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs index b89f6f9d0f68..8197210161ae 100644 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs +++ b/crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs @@ -31,7 +31,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.PanelBlueprint".into()), - component_name: "PanelBlueprintIndicator".into(), + component_name: "rerun.blueprint.components.PanelBlueprintIndicator".into(), archetype_field_name: None, }] }); @@ -50,7 +50,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.PanelBlueprint".into()), - component_name: "PanelBlueprintIndicator".into(), + component_name: "rerun.blueprint.components.PanelBlueprintIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs b/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs index 19de25e1b5bb..0f70ecad33dc 100644 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs +++ b/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs @@ -57,7 +57,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), - component_name: "ViewportBlueprintIndicator".into(), + component_name: "rerun.blueprint.components.ViewportBlueprintIndicator".into(), archetype_field_name: None, }] }); @@ -98,7 +98,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = [ ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), - component_name: "ViewportBlueprintIndicator".into(), + component_name: "rerun.blueprint.components.ViewportBlueprintIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { diff --git a/crates/store/re_types_core/src/archetypes/clear.rs b/crates/store/re_types_core/src/archetypes/clear.rs index c4ea1b2433d0..019572ddf0ae 100644 --- a/crates/store/re_types_core/src/archetypes/clear.rs +++ b/crates/store/re_types_core/src/archetypes/clear.rs @@ -91,7 +91,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz once_cell::sync::Lazy::new(|| { [ComponentDescriptor { archetype_name: Some("rerun.archetypes.Clear".into()), - component_name: "ClearIndicator".into(), + component_name: "rerun.components.ClearIndicator".into(), archetype_field_name: None, }] }); @@ -109,7 +109,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.archetypes.Clear".into()), - component_name: "ClearIndicator".into(), + component_name: "rerun.components.ClearIndicator".into(), archetype_field_name: None, }, ] From b3db65a6d2e5a214c6c52e75aef9399c6f33908b Mon Sep 17 00:00:00 2001 From: Andrew Straw Date: Tue, 10 Dec 2024 10:20:42 +0100 Subject: [PATCH 07/71] remove unused dependencies in re_log_types (#8363) ### What This removes a couple unused crates from re_log_types's Cargo.toml. --- crates/store/re_log_types/Cargo.toml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/crates/store/re_log_types/Cargo.toml b/crates/store/re_log_types/Cargo.toml index 9ac3b184401b..0fd6f76e837c 100644 --- a/crates/store/re_log_types/Cargo.toml +++ b/crates/store/re_log_types/Cargo.toml @@ -71,7 +71,6 @@ natord.workspace = true nohash-hasher.workspace = true num-derive.workspace = true num-traits.workspace = true -similar-asserts.workspace = true static_assertions.workspace = true thiserror.workspace = true time = { workspace = true, features = ["formatting", "macros", "local-offset"] } @@ -84,11 +83,6 @@ web-time.workspace = true serde = { workspace = true, optional = true, features = ["derive", "rc"] } serde_bytes = { workspace = true, optional = true } -# Native dependencies: -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -crossbeam.workspace = true - - [dev-dependencies] criterion.workspace = true mimalloc.workspace = true From 6fdb8c7b43f491ce02d6153dc5db2e0a9bad4d6e Mon Sep 17 00:00:00 2001 From: Pablo Vela Date: Tue, 10 Dec 2024 05:20:53 -0600 Subject: [PATCH 08/71] Add hloc_glomap example and update manifest (#8352) https://github.com/user-attachments/assets/2adfef1b-de0b-4789-b446-04e75f5723cf add python external example for Hloc-GLOMAP, this example show how to use rerun to visualize feature detection, feature matching, and reconstruction using the [hloc repo](https://github.com/cvg/Hierarchical-Localization) and [GLOMAP](https://github.com/colmap/glomap) --- examples/manifest.toml | 1 + examples/python/hloc_glomap/README.md | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 examples/python/hloc_glomap/README.md diff --git a/examples/manifest.toml b/examples/manifest.toml index d3ae1b172e64..66774263a558 100644 --- a/examples/manifest.toml +++ b/examples/manifest.toml @@ -101,6 +101,7 @@ examples = [ "differentiable_blocks_world", "stereo_vision_slam", "glomap", + "hloc_glomap", "instant_splat", "signed_distance_fields", "raw_mesh", diff --git a/examples/python/hloc_glomap/README.md b/examples/python/hloc_glomap/README.md new file mode 100644 index 000000000000..c55b178d69e7 --- /dev/null +++ b/examples/python/hloc_glomap/README.md @@ -0,0 +1,24 @@ + + +https://vimeo.com/1037241347?autoplay=1&loop=1&autopause=0&background=1&muted=1&ratio=2802:1790 + +## Background + +This examples allows use of the Hierarchical-Localization (hloc) repo and GLOMAP for easy and fast Structure-from-Motion with deep learned features and matchers. The Hierarchical-Localization repo (hloc for short) is a modular toolbox for state-of-the-art 6-DoF visual localization. It implements Hierarchical Localization, leveraging image retrieval and feature matching, and is fast, accurate, and scalable. This codebase combines and makes easily accessible years of research on image matching and Structure-from-Motion. GLOMAP is a general purpose global structure-from-motion pipeline for image-based sparse reconstruction. As compared to COLMAP it provides a much more efficient and scalable reconstruction process, typically 1-2 orders of magnitude faster, with on-par or superior reconstruction quality. + +## Run the code + +This is an external example. Check the [repository](https://github.com/pablovela5620/hloc-glomap) for more information on how to run the code. + +TLDR: make sure you have the [Pixi package manager](https://pixi.sh/latest/#installation) installed and run +``` +git clone https://github.com/pablovela5620/hloc-glomap.git +cd hloc-glomap +pixi run app +``` From 671b5105ef94d9fab9e53291e619914f8a4793ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Tue, 10 Dec 2024 12:36:06 +0100 Subject: [PATCH 09/71] Dynamic configuration of graph layout forces through blueprints (#8299) ### Related * Closes #8278 ### What Title. --------- Co-authored-by: Antoine Beyeler --- Cargo.lock | 6 +- Cargo.toml | 2 +- .../rerun/blueprint/archetypes.fbs | 5 + .../blueprint/archetypes/force_center.fbs | 12 + .../archetypes/force_collision_radius.fbs | 17 + .../rerun/blueprint/archetypes/force_link.fbs | 17 + .../blueprint/archetypes/force_many_body.fbs | 16 + .../blueprint/archetypes/force_position.fbs | 15 + .../rerun/blueprint/components.fbs | 4 + .../rerun/blueprint/components/enabled.fbs | 15 + .../blueprint/components/force_distance.fbs | 14 + .../blueprint/components/force_iterations.fbs | 14 + .../blueprint/components/force_strength.fbs | 14 + .../rerun/blueprint/views/graph.fbs | 15 + .../src/blueprint/archetypes/.gitattributes | 5 + .../src/blueprint/archetypes/force_center.rs | 242 ++++++++++++++ .../archetypes/force_collision_radius.rs | 300 ++++++++++++++++++ .../src/blueprint/archetypes/force_link.rs | 299 +++++++++++++++++ .../blueprint/archetypes/force_many_body.rs | 248 +++++++++++++++ .../blueprint/archetypes/force_position.rs | 291 +++++++++++++++++ .../re_types/src/blueprint/archetypes/mod.rs | 10 + .../src/blueprint/components/.gitattributes | 4 + .../src/blueprint/components/enabled.rs | 105 ++++++ .../src/blueprint/components/enabled_ext.rs | 8 + .../blueprint/components/force_distance.rs | 116 +++++++ .../blueprint/components/force_iterations.rs | 115 +++++++ .../blueprint/components/force_strength.rs | 116 +++++++ .../re_types/src/blueprint/components/mod.rs | 9 + .../src/blueprint/views/graph_view.rs | 52 ++- .../src/datatype_uis/float_drag.rs | 36 +++ .../src/datatype_uis/int_drag.rs | 51 +++ .../re_component_ui/src/datatype_uis/mod.rs | 5 +- crates/viewer/re_component_ui/src/lib.rs | 25 +- crates/viewer/re_space_view_graph/Cargo.toml | 1 + .../re_space_view_graph/src/layout/mod.rs | 2 + .../re_space_view_graph/src/layout/params.rs | 109 +++++++ .../src/layout/provider.rs | 115 +++++-- .../re_space_view_graph/src/properties.rs | 54 +++- .../viewer/re_space_view_graph/src/ui/draw.rs | 14 +- .../viewer/re_space_view_graph/src/ui/mod.rs | 2 + .../re_space_view_graph/src/ui/selection.rs | 90 ++++++ .../re_space_view_graph/src/ui/state.rs | 65 +++- crates/viewer/re_space_view_graph/src/view.rs | 25 +- .../src/view_3d_properties.rs | 2 +- .../src/blueprint/validation_gen/mod.rs | 8 + crates/viewer/re_viewer/src/reflection/mod.rs | 125 ++++++++ .../reference/types/views/graph_view.md | 28 ++ rerun_cpp/src/rerun/blueprint/archetypes.hpp | 5 + .../rerun/blueprint/archetypes/.gitattributes | 10 + .../blueprint/archetypes/force_center.cpp | 52 +++ .../blueprint/archetypes/force_center.hpp | 69 ++++ .../archetypes/force_collision_radius.cpp | 65 ++++ .../archetypes/force_collision_radius.hpp | 87 +++++ .../rerun/blueprint/archetypes/force_link.cpp | 64 ++++ .../rerun/blueprint/archetypes/force_link.hpp | 84 +++++ .../blueprint/archetypes/force_many_body.cpp | 53 ++++ .../blueprint/archetypes/force_many_body.hpp | 75 +++++ .../blueprint/archetypes/force_position.cpp | 65 ++++ .../blueprint/archetypes/force_position.hpp | 80 +++++ rerun_cpp/src/rerun/blueprint/components.hpp | 4 + .../rerun/blueprint/components/.gitattributes | 4 + .../rerun/blueprint/components/enabled.hpp | 74 +++++ .../blueprint/components/force_distance.hpp | 79 +++++ .../blueprint/components/force_iterations.hpp | 79 +++++ .../blueprint/components/force_strength.hpp | 79 +++++ .../rerun/blueprint/archetypes/.gitattributes | 5 + .../rerun/blueprint/archetypes/__init__.py | 10 + .../blueprint/archetypes/force_center.py | 80 +++++ .../archetypes/force_collision_radius.py | 100 ++++++ .../rerun/blueprint/archetypes/force_link.py | 100 ++++++ .../blueprint/archetypes/force_many_body.py | 88 +++++ .../blueprint/archetypes/force_position.py | 96 ++++++ .../rerun/blueprint/components/.gitattributes | 4 + .../rerun/blueprint/components/__init__.py | 12 + .../rerun/blueprint/components/enabled.py | 33 ++ .../blueprint/components/force_distance.py | 37 +++ .../blueprint/components/force_iterations.py | 37 +++ .../blueprint/components/force_strength.py | 37 +++ .../rerun/blueprint/views/graph_view.py | 40 +++ .../check_graph_time_layout.py | 52 ++- 80 files changed, 4510 insertions(+), 92 deletions(-) create mode 100644 crates/store/re_types/definitions/rerun/blueprint/archetypes/force_center.fbs create mode 100644 crates/store/re_types/definitions/rerun/blueprint/archetypes/force_collision_radius.fbs create mode 100644 crates/store/re_types/definitions/rerun/blueprint/archetypes/force_link.fbs create mode 100644 crates/store/re_types/definitions/rerun/blueprint/archetypes/force_many_body.fbs create mode 100644 crates/store/re_types/definitions/rerun/blueprint/archetypes/force_position.fbs create mode 100644 crates/store/re_types/definitions/rerun/blueprint/components/enabled.fbs create mode 100644 crates/store/re_types/definitions/rerun/blueprint/components/force_distance.fbs create mode 100644 crates/store/re_types/definitions/rerun/blueprint/components/force_iterations.fbs create mode 100644 crates/store/re_types/definitions/rerun/blueprint/components/force_strength.fbs create mode 100644 crates/store/re_types/src/blueprint/archetypes/force_center.rs create mode 100644 crates/store/re_types/src/blueprint/archetypes/force_collision_radius.rs create mode 100644 crates/store/re_types/src/blueprint/archetypes/force_link.rs create mode 100644 crates/store/re_types/src/blueprint/archetypes/force_many_body.rs create mode 100644 crates/store/re_types/src/blueprint/archetypes/force_position.rs create mode 100644 crates/store/re_types/src/blueprint/components/enabled.rs create mode 100644 crates/store/re_types/src/blueprint/components/enabled_ext.rs create mode 100644 crates/store/re_types/src/blueprint/components/force_distance.rs create mode 100644 crates/store/re_types/src/blueprint/components/force_iterations.rs create mode 100644 crates/store/re_types/src/blueprint/components/force_strength.rs create mode 100644 crates/viewer/re_component_ui/src/datatype_uis/int_drag.rs create mode 100644 crates/viewer/re_space_view_graph/src/layout/params.rs create mode 100644 crates/viewer/re_space_view_graph/src/ui/selection.rs create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/force_center.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/force_center.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/force_collision_radius.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/force_collision_radius.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/force_link.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/force_link.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/force_many_body.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/force_many_body.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/force_position.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/force_position.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/enabled.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/force_distance.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/force_iterations.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/force_strength.hpp create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_center.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_collision_radius.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_link.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_many_body.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_position.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/enabled.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/force_distance.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/force_iterations.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/force_strength.py diff --git a/Cargo.lock b/Cargo.lock index cba234963c38..f41c6edc923b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2455,9 +2455,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "fjadra" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccc0416b27f53bba6c9bd564260f27d4784c5f430926eb16a519356be7d66bbc" +checksum = "d8d17b174735bd1464bc491c49570fc824466e9140617c371de9a6d86ebd33ec" [[package]] name = "flatbuffers" @@ -5999,7 +5999,6 @@ dependencies = [ "bytemuck", "clean-path", "criterion", - "crossbeam", "document-features", "fixed", "half", @@ -6393,6 +6392,7 @@ dependencies = [ "re_data_ui", "re_entity_db", "re_format", + "re_log", "re_log_types", "re_query", "re_renderer", diff --git a/Cargo.toml b/Cargo.toml index ab7e374f6c69..75aebebf1c04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -190,7 +190,7 @@ enumset = "1.0.12" env_logger = { version = "0.10", default-features = false } ffmpeg-sidecar = { version = "2.0.2", default-features = false } fixed = { version = "1.28", default-features = false } -fjadra = "0.1" +fjadra = "0.2" flatbuffers = "23.0" futures-channel = "0.3" futures-util = { version = "0.3", default-features = false } diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs index 448b93b16a60..ec814ca64051 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs @@ -3,6 +3,11 @@ include "./archetypes/background.fbs"; include "./archetypes/container_blueprint.fbs"; include "./archetypes/dataframe_query.fbs"; +include "./archetypes/force_center.fbs"; +include "./archetypes/force_collision_radius.fbs"; +include "./archetypes/force_link.fbs"; +include "./archetypes/force_many_body.fbs"; +include "./archetypes/force_position.fbs"; include "./archetypes/line_grid3d.fbs"; include "./archetypes/map_background.fbs"; include "./archetypes/map_zoom.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_center.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_center.fbs new file mode 100644 index 000000000000..c3b477bf49d0 --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_center.fbs @@ -0,0 +1,12 @@ +namespace rerun.blueprint.archetypes; + +/// Tries to move the center of mass of the graph to the origin. +struct ForceCenter ( + "attr.rerun.scope": "blueprint" +) { + /// Whether the force is enabled. + enabled: rerun.blueprint.components.Enabled ("attr.rerun.component_optional", nullable, order: 100); + + /// The strength of the force. + strength: rerun.blueprint.components.ForceStrength ("attr.rerun.component_optional", nullable, order: 200); +} diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_collision_radius.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_collision_radius.fbs new file mode 100644 index 000000000000..9ffcf43376ff --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_collision_radius.fbs @@ -0,0 +1,17 @@ +namespace rerun.blueprint.archetypes; + +/// Resolves collisions between the bounding spheres, according to the radius of the nodes. +struct ForceCollisionRadius ( + "attr.rerun.scope": "blueprint" +) { + /// Whether the force is enabled. + enabled: rerun.blueprint.components.Enabled ("attr.rerun.component_optional", nullable, order: 100); + + /// The strength of the force. + strength: rerun.blueprint.components.ForceStrength ("attr.rerun.component_optional", nullable, order: 200); + + /// Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + iterations: rerun.blueprint.components.ForceIterations ("attr.rerun.component_optional", nullable, order: 300); +} diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_link.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_link.fbs new file mode 100644 index 000000000000..fc963b757cf3 --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_link.fbs @@ -0,0 +1,17 @@ +namespace rerun.blueprint.archetypes; + +/// Aims to achieve a target distance between two nodes that are connected by an edge. +struct ForceLink ( + "attr.rerun.scope": "blueprint" +) { + /// Whether the force is enabled. + enabled: rerun.blueprint.components.Enabled ("attr.rerun.component_optional", nullable, order: 100); + + /// The target distance between two nodes. + distance: rerun.blueprint.components.ForceDistance ("attr.rerun.component_optional", nullable, order: 200); + + /// Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + iterations: rerun.blueprint.components.ForceIterations ("attr.rerun.component_optional", nullable, order: 300); +} diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_many_body.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_many_body.fbs new file mode 100644 index 000000000000..edafce01c777 --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_many_body.fbs @@ -0,0 +1,16 @@ +namespace rerun.blueprint.archetypes; + +/// A force between each pair of nodes that ressembles an electrical charge. +/// +/// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. +struct ForceManyBody ( + "attr.rerun.scope": "blueprint" +) { + /// Whether the force is enabled. + enabled: rerun.blueprint.components.Enabled ("attr.rerun.component_optional", nullable, order: 100); + + /// The strength of the force. + /// + /// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. + strength: rerun.blueprint.components.ForceStrength ("attr.rerun.component_optional", nullable, order: 200); +} diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_position.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_position.fbs new file mode 100644 index 000000000000..7ff9fd24d340 --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/force_position.fbs @@ -0,0 +1,15 @@ +namespace rerun.blueprint.archetypes; + +/// Similar to gravity, this force pulls nodes towards a specific position. +struct ForcePosition ( + "attr.rerun.scope": "blueprint" +) { + /// Whether the force is enabled. + enabled: rerun.blueprint.components.Enabled ("attr.rerun.component_optional", nullable, order: 100); + + /// The strength of the force. + strength: rerun.blueprint.components.ForceStrength ("attr.rerun.component_optional", nullable, order: 200); + + /// The position where the nodes should be pulled towards. + position: rerun.components.Position2D ("attr.rerun.component_optional", nullable, order: 300); +} diff --git a/crates/store/re_types/definitions/rerun/blueprint/components.fbs b/crates/store/re_types/definitions/rerun/blueprint/components.fbs index 4f216593296d..55db3d7a4e50 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components.fbs @@ -9,8 +9,12 @@ include "./components/column_share.fbs"; include "./components/component_column_selector.fbs"; include "./components/container_kind.fbs"; include "./components/corner_2d.fbs"; +include "./components/enabled.fbs"; include "./components/filter_by_range.fbs"; include "./components/filter_is_not_null.fbs"; +include "./components/force_distance.fbs"; +include "./components/force_iterations.fbs"; +include "./components/force_strength.fbs"; include "./components/grid_columns.fbs"; include "./components/grid_spacing.fbs"; include "./components/included_content.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/enabled.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/enabled.fbs new file mode 100644 index 000000000000..d4b9219adb9f --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/components/enabled.fbs @@ -0,0 +1,15 @@ +namespace rerun.blueprint.components; + +// --- + +/// Whether a procedure is enabled. +struct Enabled ( + "attr.arrow.transparent", + "attr.rerun.scope": "blueprint", + "attr.python.aliases": "bool", + "attr.rust.derive": "Copy, Default, PartialEq, Eq, PartialOrd, Ord", + "attr.rust.repr": "transparent", + "attr.rust.tuple_struct" +) { + visible: rerun.datatypes.Bool (order: 100); +} diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/force_distance.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/force_distance.fbs new file mode 100644 index 000000000000..49d728662e03 --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/components/force_distance.fbs @@ -0,0 +1,14 @@ + +namespace rerun.blueprint.components; + +/// The target distance between two nodes. +/// +/// This is helpful to scale the layout, for example if long labels are involved. +struct ForceDistance ( + "attr.arrow.transparent", + "attr.rust.derive": "Default, Copy, PartialEq", + "attr.rust.repr": "transparent", + "attr.rerun.scope": "blueprint" +) { + distance: rerun.datatypes.Float64 (order: 100); +} diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/force_iterations.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/force_iterations.fbs new file mode 100644 index 000000000000..6cdcca9af94c --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/components/force_iterations.fbs @@ -0,0 +1,14 @@ + +namespace rerun.blueprint.components; + +/// Specifies how often this force should be applied per iteration. +/// +/// Increasing this parameter can lead to better results at the cost of longer computation time. +struct ForceIterations ( + "attr.arrow.transparent", + "attr.rust.derive": "Default, Copy, PartialEq, Eq", + "attr.rust.repr": "transparent", + "attr.rerun.scope": "blueprint" +) { + distance: rerun.datatypes.UInt64 (order: 100); +} diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/force_strength.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/force_strength.fbs new file mode 100644 index 000000000000..505deda12ac7 --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/components/force_strength.fbs @@ -0,0 +1,14 @@ + +namespace rerun.blueprint.components; + +/// The strength of a given force. +/// +/// Allows to assign different weights to the individual forces, prioritizing one over the other. +struct ForceStrength ( + "attr.arrow.transparent", + "attr.rust.derive": "Default, Copy, PartialEq", + "attr.rust.repr": "transparent", + "attr.rerun.scope": "blueprint" +) { + distance: rerun.datatypes.Float64 (order: 100); +} diff --git a/crates/store/re_types/definitions/rerun/blueprint/views/graph.fbs b/crates/store/re_types/definitions/rerun/blueprint/views/graph.fbs index 2f808bb8df2a..848ad4f3255a 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/views/graph.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/views/graph.fbs @@ -11,4 +11,19 @@ table GraphView ( /// /// Somethings outside of these bounds may also be visible due to letterboxing. visual_bounds: rerun.blueprint.archetypes.VisualBounds2D (order: 1000); + + /// Allows to control the interaction between two nodes connected by an edge. + force_link: rerun.blueprint.archetypes.ForceLink (order: 2000); + + /// A force between each pair of nodes that ressembles an electrical charge. + force_many_body: rerun.blueprint.archetypes.ForceManyBody (order: 3000); + + /// Similar to gravity, this force pulls nodes towards a specific position. + force_position: rerun.blueprint.archetypes.ForcePosition (order: 4000); + + /// Resolves collisions between the bounding spheres, according to the radius of the nodes. + force_collision_radius: rerun.blueprint.archetypes.ForceCollisionRadius (order: 5000); + + /// Tries to move the center of mass of the graph to the origin. + force_center: rerun.blueprint.archetypes.ForceCenter (order: 6000); } diff --git a/crates/store/re_types/src/blueprint/archetypes/.gitattributes b/crates/store/re_types/src/blueprint/archetypes/.gitattributes index 0053d35aa081..4ef9cf481468 100644 --- a/crates/store/re_types/src/blueprint/archetypes/.gitattributes +++ b/crates/store/re_types/src/blueprint/archetypes/.gitattributes @@ -3,6 +3,11 @@ .gitattributes linguist-generated=true background.rs linguist-generated=true dataframe_query.rs linguist-generated=true +force_center.rs linguist-generated=true +force_collision_radius.rs linguist-generated=true +force_link.rs linguist-generated=true +force_many_body.rs linguist-generated=true +force_position.rs linguist-generated=true line_grid3d.rs linguist-generated=true map_background.rs linguist-generated=true map_zoom.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/archetypes/force_center.rs b/crates/store/re_types/src/blueprint/archetypes/force_center.rs new file mode 100644 index 000000000000..9cb1870a5af5 --- /dev/null +++ b/crates/store/re_types/src/blueprint/archetypes/force_center.rs @@ -0,0 +1,242 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_center.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Archetype**: Tries to move the center of mass of the graph to the origin. +#[derive(Clone, Debug)] +pub struct ForceCenter { + /// Whether the force is enabled. + pub enabled: Option, + + /// The strength of the force. + pub strength: Option, +} + +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = + once_cell::sync::Lazy::new(|| []); + +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCenter".into()), + component_name: "rerun.blueprint.components.ForceCenterIndicator".into(), + archetype_field_name: None, + }] + }); + +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCenter".into()), + component_name: "rerun.blueprint.components.Enabled".into(), + archetype_field_name: Some("enabled".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCenter".into()), + component_name: "rerun.blueprint.components.ForceStrength".into(), + archetype_field_name: Some("strength".into()), + }, + ] + }); + +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCenter".into()), + component_name: "rerun.blueprint.components.ForceCenterIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCenter".into()), + component_name: "rerun.blueprint.components.Enabled".into(), + archetype_field_name: Some("enabled".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCenter".into()), + component_name: "rerun.blueprint.components.ForceStrength".into(), + archetype_field_name: Some("strength".into()), + }, + ] + }); + +impl ForceCenter { + /// The total number of components in the archetype: 0 required, 1 recommended, 2 optional + pub const NUM_COMPONENTS: usize = 3usize; +} + +/// Indicator component for the [`ForceCenter`] [`::re_types_core::Archetype`] +pub type ForceCenterIndicator = ::re_types_core::GenericIndicatorComponent; + +impl ::re_types_core::Archetype for ForceCenter { + type Indicator = ForceCenterIndicator; + + #[inline] + fn name() -> ::re_types_core::ArchetypeName { + "rerun.blueprint.archetypes.ForceCenter".into() + } + + #[inline] + fn display_name() -> &'static str { + "Force center" + } + + #[inline] + fn indicator() -> ComponentBatchCowWithDescriptor<'static> { + static INDICATOR: ForceCenterIndicator = ForceCenterIndicator::DEFAULT; + ComponentBatchCowWithDescriptor::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) + } + + #[inline] + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + REQUIRED_COMPONENTS.as_slice().into() + } + + #[inline] + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + RECOMMENDED_COMPONENTS.as_slice().into() + } + + #[inline] + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + OPTIONAL_COMPONENTS.as_slice().into() + } + + #[inline] + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + ALL_COMPONENTS.as_slice().into() + } + + #[inline] + fn from_arrow2_components( + arrow_data: impl IntoIterator)>, + ) -> DeserializationResult { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data + .into_iter() + .map(|(name, array)| (name.full_name(), array)) + .collect(); + let enabled = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.Enabled") + { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForceCenter#enabled")? + .into_iter() + .next() + .flatten() + } else { + None + }; + let strength = + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.ForceStrength") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForceCenter#strength")? + .into_iter() + .next() + .flatten() + } else { + None + }; + Ok(Self { enabled, strength }) + } +} + +impl ::re_types_core::AsComponents for ForceCenter { + fn as_component_batches(&self) -> Vec> { + re_tracing::profile_function!(); + use ::re_types_core::Archetype as _; + [ + Some(Self::indicator()), + (self + .enabled + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCenter".into()), + archetype_field_name: Some(("enabled").into()), + component_name: ("rerun.blueprint.components.Enabled").into(), + }), + }), + (self + .strength + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCenter".into()), + archetype_field_name: Some(("strength").into()), + component_name: ("rerun.blueprint.components.ForceStrength").into(), + }), + }), + ] + .into_iter() + .flatten() + .collect() + } +} + +impl ::re_types_core::ArchetypeReflectionMarker for ForceCenter {} + +impl ForceCenter { + /// Create a new `ForceCenter`. + #[inline] + pub fn new() -> Self { + Self { + enabled: None, + strength: None, + } + } + + /// Whether the force is enabled. + #[inline] + pub fn with_enabled( + mut self, + enabled: impl Into, + ) -> Self { + self.enabled = Some(enabled.into()); + self + } + + /// The strength of the force. + #[inline] + pub fn with_strength( + mut self, + strength: impl Into, + ) -> Self { + self.strength = Some(strength.into()); + self + } +} + +impl ::re_types_core::SizeBytes for ForceCenter { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.enabled.heap_size_bytes() + self.strength.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/force_collision_radius.rs b/crates/store/re_types/src/blueprint/archetypes/force_collision_radius.rs new file mode 100644 index 000000000000..71055ab49f0f --- /dev/null +++ b/crates/store/re_types/src/blueprint/archetypes/force_collision_radius.rs @@ -0,0 +1,300 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_collision_radius.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Archetype**: Resolves collisions between the bounding spheres, according to the radius of the nodes. +#[derive(Clone, Debug)] +pub struct ForceCollisionRadius { + /// Whether the force is enabled. + pub enabled: Option, + + /// The strength of the force. + pub strength: Option, + + /// Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + pub iterations: Option, +} + +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = + once_cell::sync::Lazy::new(|| []); + +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + component_name: "rerun.blueprint.components.ForceCollisionRadiusIndicator".into(), + archetype_field_name: None, + }] + }); + +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + component_name: "rerun.blueprint.components.Enabled".into(), + archetype_field_name: Some("enabled".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + component_name: "rerun.blueprint.components.ForceStrength".into(), + archetype_field_name: Some("strength".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + component_name: "rerun.blueprint.components.ForceIterations".into(), + archetype_field_name: Some("iterations".into()), + }, + ] + }); + +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + component_name: "rerun.blueprint.components.ForceCollisionRadiusIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + component_name: "rerun.blueprint.components.Enabled".into(), + archetype_field_name: Some("enabled".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + component_name: "rerun.blueprint.components.ForceStrength".into(), + archetype_field_name: Some("strength".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + component_name: "rerun.blueprint.components.ForceIterations".into(), + archetype_field_name: Some("iterations".into()), + }, + ] + }); + +impl ForceCollisionRadius { + /// The total number of components in the archetype: 0 required, 1 recommended, 3 optional + pub const NUM_COMPONENTS: usize = 4usize; +} + +/// Indicator component for the [`ForceCollisionRadius`] [`::re_types_core::Archetype`] +pub type ForceCollisionRadiusIndicator = + ::re_types_core::GenericIndicatorComponent; + +impl ::re_types_core::Archetype for ForceCollisionRadius { + type Indicator = ForceCollisionRadiusIndicator; + + #[inline] + fn name() -> ::re_types_core::ArchetypeName { + "rerun.blueprint.archetypes.ForceCollisionRadius".into() + } + + #[inline] + fn display_name() -> &'static str { + "Force collision radius" + } + + #[inline] + fn indicator() -> ComponentBatchCowWithDescriptor<'static> { + static INDICATOR: ForceCollisionRadiusIndicator = ForceCollisionRadiusIndicator::DEFAULT; + ComponentBatchCowWithDescriptor::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) + } + + #[inline] + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + REQUIRED_COMPONENTS.as_slice().into() + } + + #[inline] + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + RECOMMENDED_COMPONENTS.as_slice().into() + } + + #[inline] + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + OPTIONAL_COMPONENTS.as_slice().into() + } + + #[inline] + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + ALL_COMPONENTS.as_slice().into() + } + + #[inline] + fn from_arrow2_components( + arrow_data: impl IntoIterator)>, + ) -> DeserializationResult { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data + .into_iter() + .map(|(name, array)| (name.full_name(), array)) + .collect(); + let enabled = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.Enabled") + { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForceCollisionRadius#enabled")? + .into_iter() + .next() + .flatten() + } else { + None + }; + let strength = + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.ForceStrength") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForceCollisionRadius#strength")? + .into_iter() + .next() + .flatten() + } else { + None + }; + let iterations = + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.ForceIterations") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForceCollisionRadius#iterations")? + .into_iter() + .next() + .flatten() + } else { + None + }; + Ok(Self { + enabled, + strength, + iterations, + }) + } +} + +impl ::re_types_core::AsComponents for ForceCollisionRadius { + fn as_component_batches(&self) -> Vec> { + re_tracing::profile_function!(); + use ::re_types_core::Archetype as _; + [ + Some(Self::indicator()), + (self + .enabled + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + archetype_field_name: Some(("enabled").into()), + component_name: ("rerun.blueprint.components.Enabled").into(), + }), + }), + (self + .strength + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + archetype_field_name: Some(("strength").into()), + component_name: ("rerun.blueprint.components.ForceStrength").into(), + }), + }), + (self + .iterations + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceCollisionRadius".into()), + archetype_field_name: Some(("iterations").into()), + component_name: ("rerun.blueprint.components.ForceIterations").into(), + }), + }), + ] + .into_iter() + .flatten() + .collect() + } +} + +impl ::re_types_core::ArchetypeReflectionMarker for ForceCollisionRadius {} + +impl ForceCollisionRadius { + /// Create a new `ForceCollisionRadius`. + #[inline] + pub fn new() -> Self { + Self { + enabled: None, + strength: None, + iterations: None, + } + } + + /// Whether the force is enabled. + #[inline] + pub fn with_enabled( + mut self, + enabled: impl Into, + ) -> Self { + self.enabled = Some(enabled.into()); + self + } + + /// The strength of the force. + #[inline] + pub fn with_strength( + mut self, + strength: impl Into, + ) -> Self { + self.strength = Some(strength.into()); + self + } + + /// Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + #[inline] + pub fn with_iterations( + mut self, + iterations: impl Into, + ) -> Self { + self.iterations = Some(iterations.into()); + self + } +} + +impl ::re_types_core::SizeBytes for ForceCollisionRadius { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.enabled.heap_size_bytes() + + self.strength.heap_size_bytes() + + self.iterations.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/force_link.rs b/crates/store/re_types/src/blueprint/archetypes/force_link.rs new file mode 100644 index 000000000000..9c6fe8aa11d2 --- /dev/null +++ b/crates/store/re_types/src/blueprint/archetypes/force_link.rs @@ -0,0 +1,299 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_link.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Archetype**: Aims to achieve a target distance between two nodes that are connected by an edge. +#[derive(Clone, Debug)] +pub struct ForceLink { + /// Whether the force is enabled. + pub enabled: Option, + + /// The target distance between two nodes. + pub distance: Option, + + /// Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + pub iterations: Option, +} + +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = + once_cell::sync::Lazy::new(|| []); + +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + component_name: "rerun.blueprint.components.ForceLinkIndicator".into(), + archetype_field_name: None, + }] + }); + +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + component_name: "rerun.blueprint.components.Enabled".into(), + archetype_field_name: Some("enabled".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + component_name: "rerun.blueprint.components.ForceDistance".into(), + archetype_field_name: Some("distance".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + component_name: "rerun.blueprint.components.ForceIterations".into(), + archetype_field_name: Some("iterations".into()), + }, + ] + }); + +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + component_name: "rerun.blueprint.components.ForceLinkIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + component_name: "rerun.blueprint.components.Enabled".into(), + archetype_field_name: Some("enabled".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + component_name: "rerun.blueprint.components.ForceDistance".into(), + archetype_field_name: Some("distance".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + component_name: "rerun.blueprint.components.ForceIterations".into(), + archetype_field_name: Some("iterations".into()), + }, + ] + }); + +impl ForceLink { + /// The total number of components in the archetype: 0 required, 1 recommended, 3 optional + pub const NUM_COMPONENTS: usize = 4usize; +} + +/// Indicator component for the [`ForceLink`] [`::re_types_core::Archetype`] +pub type ForceLinkIndicator = ::re_types_core::GenericIndicatorComponent; + +impl ::re_types_core::Archetype for ForceLink { + type Indicator = ForceLinkIndicator; + + #[inline] + fn name() -> ::re_types_core::ArchetypeName { + "rerun.blueprint.archetypes.ForceLink".into() + } + + #[inline] + fn display_name() -> &'static str { + "Force link" + } + + #[inline] + fn indicator() -> ComponentBatchCowWithDescriptor<'static> { + static INDICATOR: ForceLinkIndicator = ForceLinkIndicator::DEFAULT; + ComponentBatchCowWithDescriptor::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) + } + + #[inline] + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + REQUIRED_COMPONENTS.as_slice().into() + } + + #[inline] + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + RECOMMENDED_COMPONENTS.as_slice().into() + } + + #[inline] + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + OPTIONAL_COMPONENTS.as_slice().into() + } + + #[inline] + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + ALL_COMPONENTS.as_slice().into() + } + + #[inline] + fn from_arrow2_components( + arrow_data: impl IntoIterator)>, + ) -> DeserializationResult { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data + .into_iter() + .map(|(name, array)| (name.full_name(), array)) + .collect(); + let enabled = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.Enabled") + { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForceLink#enabled")? + .into_iter() + .next() + .flatten() + } else { + None + }; + let distance = + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.ForceDistance") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForceLink#distance")? + .into_iter() + .next() + .flatten() + } else { + None + }; + let iterations = + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.ForceIterations") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForceLink#iterations")? + .into_iter() + .next() + .flatten() + } else { + None + }; + Ok(Self { + enabled, + distance, + iterations, + }) + } +} + +impl ::re_types_core::AsComponents for ForceLink { + fn as_component_batches(&self) -> Vec> { + re_tracing::profile_function!(); + use ::re_types_core::Archetype as _; + [ + Some(Self::indicator()), + (self + .enabled + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + archetype_field_name: Some(("enabled").into()), + component_name: ("rerun.blueprint.components.Enabled").into(), + }), + }), + (self + .distance + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + archetype_field_name: Some(("distance").into()), + component_name: ("rerun.blueprint.components.ForceDistance").into(), + }), + }), + (self + .iterations + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceLink".into()), + archetype_field_name: Some(("iterations").into()), + component_name: ("rerun.blueprint.components.ForceIterations").into(), + }), + }), + ] + .into_iter() + .flatten() + .collect() + } +} + +impl ::re_types_core::ArchetypeReflectionMarker for ForceLink {} + +impl ForceLink { + /// Create a new `ForceLink`. + #[inline] + pub fn new() -> Self { + Self { + enabled: None, + distance: None, + iterations: None, + } + } + + /// Whether the force is enabled. + #[inline] + pub fn with_enabled( + mut self, + enabled: impl Into, + ) -> Self { + self.enabled = Some(enabled.into()); + self + } + + /// The target distance between two nodes. + #[inline] + pub fn with_distance( + mut self, + distance: impl Into, + ) -> Self { + self.distance = Some(distance.into()); + self + } + + /// Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + #[inline] + pub fn with_iterations( + mut self, + iterations: impl Into, + ) -> Self { + self.iterations = Some(iterations.into()); + self + } +} + +impl ::re_types_core::SizeBytes for ForceLink { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.enabled.heap_size_bytes() + + self.distance.heap_size_bytes() + + self.iterations.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/force_many_body.rs b/crates/store/re_types/src/blueprint/archetypes/force_many_body.rs new file mode 100644 index 000000000000..9720ff5a4f17 --- /dev/null +++ b/crates/store/re_types/src/blueprint/archetypes/force_many_body.rs @@ -0,0 +1,248 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_many_body.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Archetype**: A force between each pair of nodes that ressembles an electrical charge. +/// +/// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. +#[derive(Clone, Debug)] +pub struct ForceManyBody { + /// Whether the force is enabled. + pub enabled: Option, + + /// The strength of the force. + /// + /// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. + pub strength: Option, +} + +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = + once_cell::sync::Lazy::new(|| []); + +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceManyBody".into()), + component_name: "rerun.blueprint.components.ForceManyBodyIndicator".into(), + archetype_field_name: None, + }] + }); + +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceManyBody".into()), + component_name: "rerun.blueprint.components.Enabled".into(), + archetype_field_name: Some("enabled".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceManyBody".into()), + component_name: "rerun.blueprint.components.ForceStrength".into(), + archetype_field_name: Some("strength".into()), + }, + ] + }); + +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceManyBody".into()), + component_name: "rerun.blueprint.components.ForceManyBodyIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceManyBody".into()), + component_name: "rerun.blueprint.components.Enabled".into(), + archetype_field_name: Some("enabled".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceManyBody".into()), + component_name: "rerun.blueprint.components.ForceStrength".into(), + archetype_field_name: Some("strength".into()), + }, + ] + }); + +impl ForceManyBody { + /// The total number of components in the archetype: 0 required, 1 recommended, 2 optional + pub const NUM_COMPONENTS: usize = 3usize; +} + +/// Indicator component for the [`ForceManyBody`] [`::re_types_core::Archetype`] +pub type ForceManyBodyIndicator = ::re_types_core::GenericIndicatorComponent; + +impl ::re_types_core::Archetype for ForceManyBody { + type Indicator = ForceManyBodyIndicator; + + #[inline] + fn name() -> ::re_types_core::ArchetypeName { + "rerun.blueprint.archetypes.ForceManyBody".into() + } + + #[inline] + fn display_name() -> &'static str { + "Force many body" + } + + #[inline] + fn indicator() -> ComponentBatchCowWithDescriptor<'static> { + static INDICATOR: ForceManyBodyIndicator = ForceManyBodyIndicator::DEFAULT; + ComponentBatchCowWithDescriptor::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) + } + + #[inline] + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + REQUIRED_COMPONENTS.as_slice().into() + } + + #[inline] + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + RECOMMENDED_COMPONENTS.as_slice().into() + } + + #[inline] + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + OPTIONAL_COMPONENTS.as_slice().into() + } + + #[inline] + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + ALL_COMPONENTS.as_slice().into() + } + + #[inline] + fn from_arrow2_components( + arrow_data: impl IntoIterator)>, + ) -> DeserializationResult { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data + .into_iter() + .map(|(name, array)| (name.full_name(), array)) + .collect(); + let enabled = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.Enabled") + { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForceManyBody#enabled")? + .into_iter() + .next() + .flatten() + } else { + None + }; + let strength = + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.ForceStrength") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForceManyBody#strength")? + .into_iter() + .next() + .flatten() + } else { + None + }; + Ok(Self { enabled, strength }) + } +} + +impl ::re_types_core::AsComponents for ForceManyBody { + fn as_component_batches(&self) -> Vec> { + re_tracing::profile_function!(); + use ::re_types_core::Archetype as _; + [ + Some(Self::indicator()), + (self + .enabled + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceManyBody".into()), + archetype_field_name: Some(("enabled").into()), + component_name: ("rerun.blueprint.components.Enabled").into(), + }), + }), + (self + .strength + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForceManyBody".into()), + archetype_field_name: Some(("strength").into()), + component_name: ("rerun.blueprint.components.ForceStrength").into(), + }), + }), + ] + .into_iter() + .flatten() + .collect() + } +} + +impl ::re_types_core::ArchetypeReflectionMarker for ForceManyBody {} + +impl ForceManyBody { + /// Create a new `ForceManyBody`. + #[inline] + pub fn new() -> Self { + Self { + enabled: None, + strength: None, + } + } + + /// Whether the force is enabled. + #[inline] + pub fn with_enabled( + mut self, + enabled: impl Into, + ) -> Self { + self.enabled = Some(enabled.into()); + self + } + + /// The strength of the force. + /// + /// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. + #[inline] + pub fn with_strength( + mut self, + strength: impl Into, + ) -> Self { + self.strength = Some(strength.into()); + self + } +} + +impl ::re_types_core::SizeBytes for ForceManyBody { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.enabled.heap_size_bytes() + self.strength.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/force_position.rs b/crates/store/re_types/src/blueprint/archetypes/force_position.rs new file mode 100644 index 000000000000..e106a452c2a2 --- /dev/null +++ b/crates/store/re_types/src/blueprint/archetypes/force_position.rs @@ -0,0 +1,291 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_position.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Archetype**: Similar to gravity, this force pulls nodes towards a specific position. +#[derive(Clone, Debug)] +pub struct ForcePosition { + /// Whether the force is enabled. + pub enabled: Option, + + /// The strength of the force. + pub strength: Option, + + /// The position where the nodes should be pulled towards. + pub position: Option, +} + +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = + once_cell::sync::Lazy::new(|| []); + +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + component_name: "rerun.blueprint.components.ForcePositionIndicator".into(), + archetype_field_name: None, + }] + }); + +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + component_name: "rerun.blueprint.components.Enabled".into(), + archetype_field_name: Some("enabled".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + component_name: "rerun.blueprint.components.ForceStrength".into(), + archetype_field_name: Some("strength".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + component_name: "rerun.components.Position2D".into(), + archetype_field_name: Some("position".into()), + }, + ] + }); + +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 4usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + component_name: "rerun.blueprint.components.ForcePositionIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + component_name: "rerun.blueprint.components.Enabled".into(), + archetype_field_name: Some("enabled".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + component_name: "rerun.blueprint.components.ForceStrength".into(), + archetype_field_name: Some("strength".into()), + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + component_name: "rerun.components.Position2D".into(), + archetype_field_name: Some("position".into()), + }, + ] + }); + +impl ForcePosition { + /// The total number of components in the archetype: 0 required, 1 recommended, 3 optional + pub const NUM_COMPONENTS: usize = 4usize; +} + +/// Indicator component for the [`ForcePosition`] [`::re_types_core::Archetype`] +pub type ForcePositionIndicator = ::re_types_core::GenericIndicatorComponent; + +impl ::re_types_core::Archetype for ForcePosition { + type Indicator = ForcePositionIndicator; + + #[inline] + fn name() -> ::re_types_core::ArchetypeName { + "rerun.blueprint.archetypes.ForcePosition".into() + } + + #[inline] + fn display_name() -> &'static str { + "Force position" + } + + #[inline] + fn indicator() -> ComponentBatchCowWithDescriptor<'static> { + static INDICATOR: ForcePositionIndicator = ForcePositionIndicator::DEFAULT; + ComponentBatchCowWithDescriptor::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) + } + + #[inline] + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + REQUIRED_COMPONENTS.as_slice().into() + } + + #[inline] + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + RECOMMENDED_COMPONENTS.as_slice().into() + } + + #[inline] + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + OPTIONAL_COMPONENTS.as_slice().into() + } + + #[inline] + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + ALL_COMPONENTS.as_slice().into() + } + + #[inline] + fn from_arrow2_components( + arrow_data: impl IntoIterator)>, + ) -> DeserializationResult { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data + .into_iter() + .map(|(name, array)| (name.full_name(), array)) + .collect(); + let enabled = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.Enabled") + { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForcePosition#enabled")? + .into_iter() + .next() + .flatten() + } else { + None + }; + let strength = + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.ForceStrength") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForcePosition#strength")? + .into_iter() + .next() + .flatten() + } else { + None + }; + let position = if let Some(array) = arrays_by_name.get("rerun.components.Position2D") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ForcePosition#position")? + .into_iter() + .next() + .flatten() + } else { + None + }; + Ok(Self { + enabled, + strength, + position, + }) + } +} + +impl ::re_types_core::AsComponents for ForcePosition { + fn as_component_batches(&self) -> Vec> { + re_tracing::profile_function!(); + use ::re_types_core::Archetype as _; + [ + Some(Self::indicator()), + (self + .enabled + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + archetype_field_name: Some(("enabled").into()), + component_name: ("rerun.blueprint.components.Enabled").into(), + }), + }), + (self + .strength + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + archetype_field_name: Some(("strength").into()), + component_name: ("rerun.blueprint.components.ForceStrength").into(), + }), + }), + (self + .position + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch))) + .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.ForcePosition".into()), + archetype_field_name: Some(("position").into()), + component_name: ("rerun.components.Position2D").into(), + }), + }), + ] + .into_iter() + .flatten() + .collect() + } +} + +impl ::re_types_core::ArchetypeReflectionMarker for ForcePosition {} + +impl ForcePosition { + /// Create a new `ForcePosition`. + #[inline] + pub fn new() -> Self { + Self { + enabled: None, + strength: None, + position: None, + } + } + + /// Whether the force is enabled. + #[inline] + pub fn with_enabled( + mut self, + enabled: impl Into, + ) -> Self { + self.enabled = Some(enabled.into()); + self + } + + /// The strength of the force. + #[inline] + pub fn with_strength( + mut self, + strength: impl Into, + ) -> Self { + self.strength = Some(strength.into()); + self + } + + /// The position where the nodes should be pulled towards. + #[inline] + pub fn with_position(mut self, position: impl Into) -> Self { + self.position = Some(position.into()); + self + } +} + +impl ::re_types_core::SizeBytes for ForcePosition { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.enabled.heap_size_bytes() + + self.strength.heap_size_bytes() + + self.position.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + >::is_pod() + && >::is_pod() + && >::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/mod.rs b/crates/store/re_types/src/blueprint/archetypes/mod.rs index 4b5aa896e251..24cd2e1518c5 100644 --- a/crates/store/re_types/src/blueprint/archetypes/mod.rs +++ b/crates/store/re_types/src/blueprint/archetypes/mod.rs @@ -2,6 +2,11 @@ mod background; mod dataframe_query; +mod force_center; +mod force_collision_radius; +mod force_link; +mod force_many_body; +mod force_position; mod line_grid3d; mod map_background; mod map_zoom; @@ -18,6 +23,11 @@ mod visual_bounds2d; pub use self::background::Background; pub use self::dataframe_query::DataframeQuery; +pub use self::force_center::ForceCenter; +pub use self::force_collision_radius::ForceCollisionRadius; +pub use self::force_link::ForceLink; +pub use self::force_many_body::ForceManyBody; +pub use self::force_position::ForcePosition; pub use self::line_grid3d::LineGrid3D; pub use self::map_background::MapBackground; pub use self::map_zoom::MapZoom; diff --git a/crates/store/re_types/src/blueprint/components/.gitattributes b/crates/store/re_types/src/blueprint/components/.gitattributes index 65eeb1377804..38cab9cb557b 100644 --- a/crates/store/re_types/src/blueprint/components/.gitattributes +++ b/crates/store/re_types/src/blueprint/components/.gitattributes @@ -7,8 +7,12 @@ background_kind.rs linguist-generated=true column_share.rs linguist-generated=true component_column_selector.rs linguist-generated=true corner2d.rs linguist-generated=true +enabled.rs linguist-generated=true filter_by_range.rs linguist-generated=true filter_is_not_null.rs linguist-generated=true +force_distance.rs linguist-generated=true +force_iterations.rs linguist-generated=true +force_strength.rs linguist-generated=true grid_spacing.rs linguist-generated=true included_content.rs linguist-generated=true interactive.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/components/enabled.rs b/crates/store/re_types/src/blueprint/components/enabled.rs new file mode 100644 index 000000000000..dc258abb03d2 --- /dev/null +++ b/crates/store/re_types/src/blueprint/components/enabled.rs @@ -0,0 +1,105 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/enabled.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: Whether a procedure is enabled. +#[derive(Clone, Debug, Copy, Default, PartialEq, Eq, PartialOrd, Ord)] +#[repr(transparent)] +pub struct Enabled(pub crate::datatypes::Bool); + +impl ::re_types_core::Component for Enabled { + #[inline] + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.Enabled") + } +} + +::re_types_core::macros::impl_into_cow!(Enabled); + +impl ::re_types_core::Loggable for Enabled { + #[inline] + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Bool::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Bool::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Bool::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + } +} + +impl> From for Enabled { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for Enabled { + #[inline] + fn borrow(&self) -> &crate::datatypes::Bool { + &self.0 + } +} + +impl std::ops::Deref for Enabled { + type Target = crate::datatypes::Bool; + + #[inline] + fn deref(&self) -> &crate::datatypes::Bool { + &self.0 + } +} + +impl std::ops::DerefMut for Enabled { + #[inline] + fn deref_mut(&mut self) -> &mut crate::datatypes::Bool { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for Enabled { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/components/enabled_ext.rs b/crates/store/re_types/src/blueprint/components/enabled_ext.rs new file mode 100644 index 000000000000..2865f1ca4b5b --- /dev/null +++ b/crates/store/re_types/src/blueprint/components/enabled_ext.rs @@ -0,0 +1,8 @@ +use super::Enabled; + +impl From for bool { + #[inline] + fn from(v: Enabled) -> Self { + v.0.into() + } +} diff --git a/crates/store/re_types/src/blueprint/components/force_distance.rs b/crates/store/re_types/src/blueprint/components/force_distance.rs new file mode 100644 index 000000000000..8a70ffc068f7 --- /dev/null +++ b/crates/store/re_types/src/blueprint/components/force_distance.rs @@ -0,0 +1,116 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/force_distance.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: The target distance between two nodes. +/// +/// This is helpful to scale the layout, for example if long labels are involved. +#[derive(Clone, Debug, Default, Copy, PartialEq)] +#[repr(transparent)] +pub struct ForceDistance(pub crate::datatypes::Float64); + +impl ::re_types_core::Component for ForceDistance { + #[inline] + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ForceDistance") + } +} + +::re_types_core::macros::impl_into_cow!(ForceDistance); + +impl ::re_types_core::Loggable for ForceDistance { + #[inline] + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Float64::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Float64::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Float64::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + } + + #[inline] + fn from_arrow2(arrow_data: &dyn arrow2::array::Array) -> DeserializationResult> + where + Self: Sized, + { + crate::datatypes::Float64::from_arrow2(arrow_data) + .map(|v| v.into_iter().map(Self).collect()) + } +} + +impl> From for ForceDistance { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ForceDistance { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float64 { + &self.0 + } +} + +impl std::ops::Deref for ForceDistance { + type Target = crate::datatypes::Float64; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float64 { + &self.0 + } +} + +impl std::ops::DerefMut for ForceDistance { + #[inline] + fn deref_mut(&mut self) -> &mut crate::datatypes::Float64 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for ForceDistance { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/components/force_iterations.rs b/crates/store/re_types/src/blueprint/components/force_iterations.rs new file mode 100644 index 000000000000..d91a043a615f --- /dev/null +++ b/crates/store/re_types/src/blueprint/components/force_iterations.rs @@ -0,0 +1,115 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/force_iterations.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: Specifies how often this force should be applied per iteration. +/// +/// Increasing this parameter can lead to better results at the cost of longer computation time. +#[derive(Clone, Debug, Default, Copy, PartialEq, Eq)] +#[repr(transparent)] +pub struct ForceIterations(pub crate::datatypes::UInt64); + +impl ::re_types_core::Component for ForceIterations { + #[inline] + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ForceIterations") + } +} + +::re_types_core::macros::impl_into_cow!(ForceIterations); + +impl ::re_types_core::Loggable for ForceIterations { + #[inline] + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::UInt64::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::UInt64::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::UInt64::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + } + + #[inline] + fn from_arrow2(arrow_data: &dyn arrow2::array::Array) -> DeserializationResult> + where + Self: Sized, + { + crate::datatypes::UInt64::from_arrow2(arrow_data).map(|v| v.into_iter().map(Self).collect()) + } +} + +impl> From for ForceIterations { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ForceIterations { + #[inline] + fn borrow(&self) -> &crate::datatypes::UInt64 { + &self.0 + } +} + +impl std::ops::Deref for ForceIterations { + type Target = crate::datatypes::UInt64; + + #[inline] + fn deref(&self) -> &crate::datatypes::UInt64 { + &self.0 + } +} + +impl std::ops::DerefMut for ForceIterations { + #[inline] + fn deref_mut(&mut self) -> &mut crate::datatypes::UInt64 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for ForceIterations { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/components/force_strength.rs b/crates/store/re_types/src/blueprint/components/force_strength.rs new file mode 100644 index 000000000000..d1efe60bbb4f --- /dev/null +++ b/crates/store/re_types/src/blueprint/components/force_strength.rs @@ -0,0 +1,116 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/force_strength.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: The strength of a given force. +/// +/// Allows to assign different weights to the individual forces, prioritizing one over the other. +#[derive(Clone, Debug, Default, Copy, PartialEq)] +#[repr(transparent)] +pub struct ForceStrength(pub crate::datatypes::Float64); + +impl ::re_types_core::Component for ForceStrength { + #[inline] + fn descriptor() -> ComponentDescriptor { + ComponentDescriptor::new("rerun.blueprint.components.ForceStrength") + } +} + +::re_types_core::macros::impl_into_cow!(ForceStrength); + +impl ::re_types_core::Loggable for ForceStrength { + #[inline] + fn arrow_datatype() -> arrow::datatypes::DataType { + crate::datatypes::Float64::arrow_datatype() + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult + where + Self: Clone + 'a, + { + crate::datatypes::Float64::to_arrow_opt(data.into_iter().map(|datum| { + datum.map(|datum| match datum.into() { + ::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), + ::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), + }) + })) + } + + fn from_arrow2_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + crate::datatypes::Float64::from_arrow2_opt(arrow_data) + .map(|v| v.into_iter().map(|v| v.map(Self)).collect()) + } + + #[inline] + fn from_arrow2(arrow_data: &dyn arrow2::array::Array) -> DeserializationResult> + where + Self: Sized, + { + crate::datatypes::Float64::from_arrow2(arrow_data) + .map(|v| v.into_iter().map(Self).collect()) + } +} + +impl> From for ForceStrength { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ForceStrength { + #[inline] + fn borrow(&self) -> &crate::datatypes::Float64 { + &self.0 + } +} + +impl std::ops::Deref for ForceStrength { + type Target = crate::datatypes::Float64; + + #[inline] + fn deref(&self) -> &crate::datatypes::Float64 { + &self.0 + } +} + +impl std::ops::DerefMut for ForceStrength { + #[inline] + fn deref_mut(&mut self) -> &mut crate::datatypes::Float64 { + &mut self.0 + } +} + +impl ::re_types_core::SizeBytes for ForceStrength { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.0.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/components/mod.rs b/crates/store/re_types/src/blueprint/components/mod.rs index 15647fbf1138..0fb6d14946dc 100644 --- a/crates/store/re_types/src/blueprint/components/mod.rs +++ b/crates/store/re_types/src/blueprint/components/mod.rs @@ -8,10 +8,15 @@ mod component_column_selector; mod component_column_selector_ext; mod corner2d; mod corner2d_ext; +mod enabled; +mod enabled_ext; mod filter_by_range; mod filter_by_range_ext; mod filter_is_not_null; mod filter_is_not_null_ext; +mod force_distance; +mod force_iterations; +mod force_strength; mod grid_spacing; mod grid_spacing_ext; mod included_content; @@ -50,8 +55,12 @@ pub use self::background_kind::BackgroundKind; pub use self::column_share::ColumnShare; pub use self::component_column_selector::ComponentColumnSelector; pub use self::corner2d::Corner2D; +pub use self::enabled::Enabled; pub use self::filter_by_range::FilterByRange; pub use self::filter_is_not_null::FilterIsNotNull; +pub use self::force_distance::ForceDistance; +pub use self::force_iterations::ForceIterations; +pub use self::force_strength::ForceStrength; pub use self::grid_spacing::GridSpacing; pub use self::included_content::IncludedContent; pub use self::interactive::Interactive; diff --git a/crates/store/re_types/src/blueprint/views/graph_view.rs b/crates/store/re_types/src/blueprint/views/graph_view.rs index 7eff672bef81..74e6771dc9b2 100644 --- a/crates/store/re_types/src/blueprint/views/graph_view.rs +++ b/crates/store/re_types/src/blueprint/views/graph_view.rs @@ -25,43 +25,27 @@ pub struct GraphView { /// /// Somethings outside of these bounds may also be visible due to letterboxing. pub visual_bounds: crate::blueprint::archetypes::VisualBounds2D, -} -impl ::re_types_core::View for GraphView { - #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { - "Graph".into() - } -} + /// Allows to control the interaction between two nodes connected by an edge. + pub force_link: crate::blueprint::archetypes::ForceLink, -impl> From for GraphView { - fn from(v: T) -> Self { - Self { - visual_bounds: v.into(), - } - } -} + /// A force between each pair of nodes that ressembles an electrical charge. + pub force_many_body: crate::blueprint::archetypes::ForceManyBody, -impl std::borrow::Borrow for GraphView { - #[inline] - fn borrow(&self) -> &crate::blueprint::archetypes::VisualBounds2D { - &self.visual_bounds - } -} + /// Similar to gravity, this force pulls nodes towards a specific position. + pub force_position: crate::blueprint::archetypes::ForcePosition, -impl std::ops::Deref for GraphView { - type Target = crate::blueprint::archetypes::VisualBounds2D; + /// Resolves collisions between the bounding spheres, according to the radius of the nodes. + pub force_collision_radius: crate::blueprint::archetypes::ForceCollisionRadius, - #[inline] - fn deref(&self) -> &crate::blueprint::archetypes::VisualBounds2D { - &self.visual_bounds - } + /// Tries to move the center of mass of the graph to the origin. + pub force_center: crate::blueprint::archetypes::ForceCenter, } -impl std::ops::DerefMut for GraphView { +impl ::re_types_core::View for GraphView { #[inline] - fn deref_mut(&mut self) -> &mut crate::blueprint::archetypes::VisualBounds2D { - &mut self.visual_bounds + fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + "Graph".into() } } @@ -69,10 +53,20 @@ impl ::re_types_core::SizeBytes for GraphView { #[inline] fn heap_size_bytes(&self) -> u64 { self.visual_bounds.heap_size_bytes() + + self.force_link.heap_size_bytes() + + self.force_many_body.heap_size_bytes() + + self.force_position.heap_size_bytes() + + self.force_collision_radius.heap_size_bytes() + + self.force_center.heap_size_bytes() } #[inline] fn is_pod() -> bool { ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() + && ::is_pod() } } diff --git a/crates/viewer/re_component_ui/src/datatype_uis/float_drag.rs b/crates/viewer/re_component_ui/src/datatype_uis/float_drag.rs index b9aa5fa87b9b..8964dd6cce4c 100644 --- a/crates/viewer/re_component_ui/src/datatype_uis/float_drag.rs +++ b/crates/viewer/re_component_ui/src/datatype_uis/float_drag.rs @@ -111,6 +111,42 @@ fn edit_f32_zero_to_one_raw(ui: &mut egui::Ui, value: &mut MaybeMutRef<'_, f32>) // --- +/// Generic editor for a [`re_types::datatypes::Float64`] value from zero to max float. +pub fn edit_f64_zero_to_max( + _ctx: &re_viewer_context::ViewerContext<'_>, + ui: &mut egui::Ui, + value: &mut MaybeMutRef<'_, impl std::ops::DerefMut>, +) -> egui::Response { + let mut value: MaybeMutRef<'_, f64> = match value { + MaybeMutRef::Ref(value) => MaybeMutRef::Ref(value), + MaybeMutRef::MutRef(value) => MaybeMutRef::MutRef(&mut value.deref_mut().0), + }; + edit_f64_float_raw_impl(ui, &mut value, 0.0..=f64::MAX) +} + +/// Generic editor for a [`re_types::datatypes::Float64`] value from min to max float. +pub fn edit_f64_min_to_max_float( + _ctx: &re_viewer_context::ViewerContext<'_>, + ui: &mut egui::Ui, + value: &mut MaybeMutRef<'_, impl std::ops::DerefMut>, +) -> egui::Response { + let mut value: MaybeMutRef<'_, f64> = match value { + MaybeMutRef::Ref(value) => MaybeMutRef::Ref(value), + MaybeMutRef::MutRef(value) => MaybeMutRef::MutRef(&mut value.deref_mut().0), + }; + edit_f64_float_raw_impl(ui, &mut value, f64::MIN..=f64::MAX) +} + +/// Non monomorphized implementation for f64 float editing. +pub fn edit_f64_float_raw_impl( + ui: &mut egui::Ui, + value: &mut MaybeMutRef<'_, f64>, + range: RangeInclusive, +) -> egui::Response { + let speed = (value.abs() * 0.01).at_least(0.001); + edit_f64_float_raw_with_speed_impl(ui, value, range, speed) +} + /// Non monomorphized implementation for f64 float editing with a given speed. pub fn edit_f64_float_raw_with_speed_impl( ui: &mut egui::Ui, diff --git a/crates/viewer/re_component_ui/src/datatype_uis/int_drag.rs b/crates/viewer/re_component_ui/src/datatype_uis/int_drag.rs new file mode 100644 index 000000000000..e92b3c91a39b --- /dev/null +++ b/crates/viewer/re_component_ui/src/datatype_uis/int_drag.rs @@ -0,0 +1,51 @@ +use std::ops::RangeInclusive; + +use egui::NumExt as _; +use re_types_core::datatypes; +use re_viewer_context::MaybeMutRef; + +/// Generic editor for a [`re_types::datatypes::UInt64`] values within a given range. +pub fn edit_u64_range( + _ctx: &re_viewer_context::ViewerContext<'_>, + ui: &mut egui::Ui, + value: &mut MaybeMutRef<'_, impl std::ops::DerefMut>, + range: RangeInclusive, +) -> egui::Response { + let mut value: MaybeMutRef<'_, u64> = match value { + MaybeMutRef::Ref(value) => MaybeMutRef::Ref(value), + MaybeMutRef::MutRef(value) => MaybeMutRef::MutRef(&mut value.deref_mut().0), + }; + edit_u64_raw(ui, &mut value, range, "") +} + +/// Non monomorphized implementation for u64 editing. +pub fn edit_u64_raw( + ui: &mut egui::Ui, + value: &mut MaybeMutRef<'_, u64>, + range: RangeInclusive, + suffix: &str, +) -> egui::Response { + let speed = (**value as f64 * 0.01).at_least(0.001); + edit_u64_raw_with_speed_impl(ui, value, range, speed, suffix) +} + +/// Non monomorphized implementation for u64 editing with a given speed. +pub fn edit_u64_raw_with_speed_impl( + ui: &mut egui::Ui, + value: &mut MaybeMutRef<'_, u64>, + range: RangeInclusive, + speed: f64, + suffix: &str, +) -> egui::Response { + if let Some(value) = value.as_mut() { + ui.add( + egui::DragValue::new(value) + .clamp_existing_to_range(false) + .range(range) + .speed(speed) + .suffix(suffix), + ) + } else { + ui.label(format!("{}{}", re_format::format_uint(**value), suffix)) + } +} diff --git a/crates/viewer/re_component_ui/src/datatype_uis/mod.rs b/crates/viewer/re_component_ui/src/datatype_uis/mod.rs index 5147a63dac32..b355a9e0aeae 100644 --- a/crates/viewer/re_component_ui/src/datatype_uis/mod.rs +++ b/crates/viewer/re_component_ui/src/datatype_uis/mod.rs @@ -1,6 +1,7 @@ mod bool_toggle; mod enum_combobox; mod float_drag; +mod int_drag; mod range1d; mod singleline_string; mod vec; @@ -14,8 +15,10 @@ pub use enum_combobox::{ }; pub use float_drag::{ edit_f32_float_raw, edit_f32_min_to_max_float, edit_f32_zero_to_max, edit_f32_zero_to_one, - edit_f64_float_raw_with_speed_impl, edit_ui_points, + edit_f64_float_raw_with_speed_impl, edit_f64_min_to_max_float, edit_f64_zero_to_max, + edit_ui_points, }; +pub use int_drag::edit_u64_range; pub use range1d::edit_view_range1d; pub use singleline_string::{ display_name_ui, display_text_ui, edit_multiline_string, edit_singleline_string, diff --git a/crates/viewer/re_component_ui/src/lib.rs b/crates/viewer/re_component_ui/src/lib.rs index abe649c8b3a7..3877b6648cff 100644 --- a/crates/viewer/re_component_ui/src/lib.rs +++ b/crates/viewer/re_component_ui/src/lib.rs @@ -28,15 +28,16 @@ mod zoom_level; use datatype_uis::{ display_name_ui, display_text_ui, edit_bool, edit_f32_min_to_max_float, edit_f32_zero_to_max, - edit_f32_zero_to_one, edit_multiline_string, edit_or_view_vec2d, edit_or_view_vec3d, - edit_singleline_string, edit_ui_points, edit_view_enum, edit_view_enum_with_variant_available, - edit_view_range1d, view_uuid, view_view_id, + edit_f32_zero_to_one, edit_f64_min_to_max_float, edit_f64_zero_to_max, edit_multiline_string, + edit_or_view_vec2d, edit_or_view_vec3d, edit_singleline_string, edit_u64_range, edit_ui_points, + edit_view_enum, edit_view_enum_with_variant_available, edit_view_range1d, view_uuid, + view_view_id, }; use re_types::{ blueprint::components::{ - BackgroundKind, Corner2D, GridSpacing, LockRangeDuringZoom, MapProvider, NearClipPlane, - ViewFit, Visible, + BackgroundKind, Corner2D, Enabled, ForceDistance, ForceIterations, ForceStrength, + GridSpacing, LockRangeDuringZoom, MapProvider, NearClipPlane, ViewFit, Visible, }, components::{ AggregationPolicy, AlbedoFactor, AxisLength, Color, DepthMeter, DrawOrder, FillMode, @@ -72,6 +73,7 @@ pub fn create_component_ui_registry() -> re_viewer_context::ComponentUiRegistry registry.add_singleline_edit_or_view::(edit_f32_zero_to_max); registry.add_singleline_edit_or_view::(edit_f32_zero_to_max); registry.add_singleline_edit_or_view::(edit_f32_zero_to_max); + registry.add_singleline_edit_or_view::(edit_f64_zero_to_max); registry.add_singleline_edit_or_view::(edit_f32_zero_to_max); registry.add_singleline_edit_or_view::(edit_f32_zero_to_max); registry.add_singleline_edit_or_view::(edit_f32_zero_to_max); @@ -81,12 +83,18 @@ pub fn create_component_ui_registry() -> re_viewer_context::ComponentUiRegistry // float min-max components: registry.add_singleline_edit_or_view::(edit_f32_min_to_max_float); + registry.add_singleline_edit_or_view::(edit_f64_min_to_max_float); // float 0-1 components: registry.add_singleline_edit_or_view::(edit_f32_zero_to_one); + // integer range components: + registry.add_singleline_edit_or_view::(|ctx, ui, value| { + edit_u64_range(ctx, ui, value, 1..=5) + }); + // Bool components: - registry.add_singleline_edit_or_view::(edit_bool); + registry.add_singleline_edit_or_view::(edit_bool); registry.add_singleline_edit_or_view::(edit_bool); registry.add_singleline_edit_or_view::(edit_bool); registry.add_singleline_edit_or_view::(edit_bool); @@ -154,11 +162,6 @@ pub fn create_component_ui_registry() -> re_viewer_context::ComponentUiRegistry registry.add_singleline_edit_or_view(radius::edit_radius_ui); registry.add_singleline_edit_or_view(marker_shape::edit_marker_shape_ui); - registry.add_multiline_edit_or_view(visual_bounds2d::multiline_edit_visual_bounds2d); - registry.add_singleline_edit_or_view(visual_bounds2d::singleline_edit_visual_bounds2d); - registry.add_multiline_edit_or_view(visual_bounds2d::multiline_edit_visual_bounds2d); - registry.add_singleline_edit_or_view(visual_bounds2d::singleline_edit_visual_bounds2d); - registry.add_singleline_edit_or_view(pinhole::singleline_view_pinhole); registry.add_multiline_edit_or_view(pinhole::multiline_view_pinhole); diff --git a/crates/viewer/re_space_view_graph/Cargo.toml b/crates/viewer/re_space_view_graph/Cargo.toml index 136dbbbb2ad3..6ba3f933edb0 100644 --- a/crates/viewer/re_space_view_graph/Cargo.toml +++ b/crates/viewer/re_space_view_graph/Cargo.toml @@ -23,6 +23,7 @@ re_data_ui.workspace = true re_chunk.workspace = true re_entity_db.workspace = true re_format.workspace = true +re_log.workspace = true re_log_types.workspace = true re_query.workspace = true re_renderer.workspace = true diff --git a/crates/viewer/re_space_view_graph/src/layout/mod.rs b/crates/viewer/re_space_view_graph/src/layout/mod.rs index a06d3748be2f..52cbf8fa094b 100644 --- a/crates/viewer/re_space_view_graph/src/layout/mod.rs +++ b/crates/viewer/re_space_view_graph/src/layout/mod.rs @@ -1,10 +1,12 @@ mod geometry; +mod params; mod provider; mod request; mod result; mod slots; pub use geometry::{EdgeGeometry, PathGeometry}; +pub use params::ForceLayoutParams; pub use provider::ForceLayoutProvider; pub use request::{EdgeTemplate, LayoutRequest}; pub use result::Layout; diff --git a/crates/viewer/re_space_view_graph/src/layout/params.rs b/crates/viewer/re_space_view_graph/src/layout/params.rs new file mode 100644 index 000000000000..14192d905c26 --- /dev/null +++ b/crates/viewer/re_space_view_graph/src/layout/params.rs @@ -0,0 +1,109 @@ +use re_types::{ + blueprint::{ + archetypes::{ForceCenter, ForceCollisionRadius, ForceLink, ForceManyBody, ForcePosition}, + components::{Enabled, ForceDistance, ForceIterations, ForceStrength}, + }, + components::Position2D, + Archetype, Component, +}; +use re_viewer_context::{ComponentFallbackProvider, SpaceViewState, ViewQuery, ViewerContext}; +use re_viewport_blueprint::{ViewProperty, ViewPropertyQueryError}; + +#[derive(Debug, PartialEq)] +pub struct ForceLayoutParams { + // Link + pub(super) force_link_enabled: Enabled, + pub(super) force_link_distance: ForceDistance, + pub(super) force_link_iterations: ForceIterations, + // Many body + pub(super) force_many_body_enabled: Enabled, + pub(super) force_many_body_strength: ForceStrength, + // Position + pub(super) force_position_enabled: Enabled, + pub(super) force_position_strength: ForceStrength, + pub(super) force_position_pos: Position2D, + // Center + pub(super) force_center_enabled: Enabled, + pub(super) force_center_strength: ForceStrength, + // Collision + pub(super) force_collision_enabled: Enabled, + pub(super) force_collision_strength: ForceStrength, + pub(super) force_collision_iterations: ForceIterations, +} + +/// Convenience struct for querying the components of a blueprint archetype or its fallbacks. +struct QueryArchetype<'a, T> { + ctx: &'a ViewerContext<'a>, + provider: &'a dyn ComponentFallbackProvider, + view_state: &'a dyn SpaceViewState, + property: ViewProperty, + _marker: std::marker::PhantomData, +} + +impl<'a, T: Archetype> QueryArchetype<'a, T> { + fn new( + ctx: &'a ViewerContext<'a>, + query: &'a ViewQuery<'a>, + provider: &'a dyn ComponentFallbackProvider, + view_state: &'a dyn SpaceViewState, + ) -> Self { + let property = ViewProperty::from_archetype::( + ctx.blueprint_db(), + ctx.blueprint_query, + query.space_view_id, + ); + Self { + ctx, + provider, + view_state, + property, + _marker: Default::default(), + } + } + + fn get(&self) -> Result + where + R: Component + Default, + { + self.property + .component_or_fallback(self.ctx, self.provider, self.view_state) + } +} + +impl ForceLayoutParams { + pub fn get( + ctx: &ViewerContext<'_>, + query: &ViewQuery<'_>, + provider: &dyn ComponentFallbackProvider, + view_state: &dyn SpaceViewState, + ) -> Result { + // Query the components for the archetype + let force_link = QueryArchetype::::new(ctx, query, provider, view_state); + let force_many = QueryArchetype::::new(ctx, query, provider, view_state); + let force_position = QueryArchetype::::new(ctx, query, provider, view_state); + let force_center = QueryArchetype::::new(ctx, query, provider, view_state); + let force_collision = + QueryArchetype::::new(ctx, query, provider, view_state); + + Ok(Self { + // Link + force_link_enabled: force_link.get()?, + force_link_distance: force_link.get()?, + force_link_iterations: force_link.get()?, + // Many body + force_many_body_enabled: force_many.get()?, + force_many_body_strength: force_many.get()?, + // Position + force_position_enabled: force_position.get()?, + force_position_strength: force_position.get()?, + force_position_pos: force_position.get()?, + // Center + force_center_enabled: force_center.get()?, + force_center_strength: force_center.get()?, + // Collision + force_collision_enabled: force_collision.get()?, + force_collision_strength: force_collision.get()?, + force_collision_iterations: force_collision.get()?, + }) + } +} diff --git a/crates/viewer/re_space_view_graph/src/layout/provider.rs b/crates/viewer/re_space_view_graph/src/layout/provider.rs index f4af4f5409d5..72c6b7a31f17 100644 --- a/crates/viewer/re_space_view_graph/src/layout/provider.rs +++ b/crates/viewer/re_space_view_graph/src/layout/provider.rs @@ -6,11 +6,12 @@ // layouts, such as `dot` from `graphviz`. use egui::{Pos2, Rect, Vec2}; -use fjadra::{self as fj}; +use fjadra::{self as fj, Simulation}; use crate::graph::{EdgeId, NodeId}; use super::{ + params::ForceLayoutParams, request::NodeTemplate, slots::{slotted_edges, Slot, SlotKind}, EdgeGeometry, EdgeTemplate, Layout, LayoutRequest, PathGeometry, @@ -25,6 +26,77 @@ impl<'a> From<&'a NodeTemplate> for fj::Node { } } +// TODO(grtlr): Do this more efficiently, as this currently rebuilds all helper functions. +pub fn update_simulation( + mut simulation: fj::Simulation, + params: &ForceLayoutParams, + edges: Vec<(usize, usize)>, + radii: Vec, +) -> Simulation { + // We destructure here to get compiler warnings if we add new parameters. + let &ForceLayoutParams { + force_link_enabled, + force_link_distance, + force_link_iterations, + force_many_body_enabled, + force_many_body_strength, + force_position_enabled, + force_position_strength, + force_position_pos, + force_center_enabled, + force_center_strength, + force_collision_enabled, + force_collision_strength, + force_collision_iterations, + } = params; + + if **force_link_enabled { + simulation = simulation.add_force( + "link", + fj::Link::new(edges) + .distance(**force_link_distance) + .iterations(**force_link_iterations as usize), + ); + } + if **force_many_body_enabled { + simulation = simulation.add_force( + "charge", + fj::ManyBody::new().strength(**force_many_body_strength), + ); + } + if **force_position_enabled { + simulation = simulation + .add_force( + "x", + fj::PositionX::new() + .strength(**force_position_strength) + .x(force_position_pos[0].into()), + ) + .add_force( + "y", + fj::PositionY::new() + .strength(**force_position_strength) + .y(force_position_pos[1].into()), + ); + } + if **force_collision_enabled { + simulation = simulation.add_force( + "collision", + fj::Collide::new() + .radius(move |i| radii[i]) + .iterations(**force_collision_iterations as usize) + .strength(**force_collision_strength), + ); + } + if **force_center_enabled { + simulation = simulation.add_force( + "center", + fj::Center::new().strength(**force_center_strength), + ); + } + simulation +} + pub struct ForceLayoutProvider { simulation: fj::Simulation, pub request: LayoutRequest, @@ -44,19 +116,17 @@ fn considered_edges(request: &LayoutRequest) -> Vec<(usize, usize)> { } impl ForceLayoutProvider { - pub fn new(request: LayoutRequest) -> Self { + pub fn new(request: LayoutRequest, params: &ForceLayoutParams) -> Self { let nodes = request.all_nodes().map(|(_, v)| fj::Node::from(v)); + let radii = request + .all_nodes() + .map(|(_, v)| v.size.max_elem() as f64 / 2.0) + .collect::>(); let edges = considered_edges(&request); - // TODO(grtlr): Currently we guesstimate good forces. Eventually these should be exposed as blueprints. - let simulation = fj::SimulationBuilder::default() - .with_alpha_decay(0.01) // TODO(grtlr): slows down the simulation for demo - .build(nodes) - .add_force("link", fj::Link::new(edges).distance(50.0).iterations(2)) - .add_force("charge", fj::ManyBody::new()) - // TODO(grtlr): This is a small stop-gap until we have blueprints to prevent nodes from flying away. - .add_force("x", fj::PositionX::new().strength(0.01)) - .add_force("y", fj::PositionY::new().strength(0.01)); + let simulation = fj::SimulationBuilder::default().build(nodes); + + let simulation = update_simulation(simulation, params, edges, radii); Self { simulation, @@ -64,7 +134,11 @@ impl ForceLayoutProvider { } } - pub fn new_with_previous(request: LayoutRequest, layout: &Layout) -> Self { + pub fn new_with_previous( + request: LayoutRequest, + layout: &Layout, + params: &ForceLayoutParams, + ) -> Self { let nodes = request.all_nodes().map(|(id, v)| { if let Some(rect) = layout.get_node(&id) { let pos = rect.center(); @@ -73,17 +147,14 @@ impl ForceLayoutProvider { fj::Node::from(v) } }); + let radii = request + .all_nodes() + .map(|(_, v)| v.size.max_elem() as f64 / 2.0) + .collect::>(); let edges = considered_edges(&request); - // TODO(grtlr): Currently we guesstimate good forces. Eventually these should be exposed as blueprints. - let simulation = fj::SimulationBuilder::default() - .with_alpha_decay(0.01) // TODO(grtlr): slows down the simulation for demo - .build(nodes) - .add_force("link", fj::Link::new(edges).distance(50.0).iterations(2)) - .add_force("charge", fj::ManyBody::new()) - // TODO(grtlr): This is a small stop-gap until we have blueprints to prevent nodes from flying away. - .add_force("x", fj::PositionX::new().strength(0.01)) - .add_force("y", fj::PositionY::new().strength(0.01)); + let simulation = fj::SimulationBuilder::default().build(nodes); + let simulation = update_simulation(simulation, params, edges, radii); Self { simulation, @@ -229,7 +300,7 @@ impl ForceLayoutProvider { } pub fn is_finished(&self) -> bool { - self.simulation.finished() + self.simulation.is_finished() } } diff --git a/crates/viewer/re_space_view_graph/src/properties.rs b/crates/viewer/re_space_view_graph/src/properties.rs index de6b0255f0ca..402831a223a8 100644 --- a/crates/viewer/re_space_view_graph/src/properties.rs +++ b/crates/viewer/re_space_view_graph/src/properties.rs @@ -1,4 +1,11 @@ -use re_types::blueprint::components::VisualBounds2D; +use re_types::{ + blueprint::{ + archetypes, + components::{Enabled, ForceDistance, ForceIterations, ForceStrength, VisualBounds2D}, + }, + components::Position2D, + Archetype as _, +}; use re_viewer_context::{SpaceViewStateExt as _, TypedComponentFallbackProvider}; use crate::{ui::GraphSpaceViewState, GraphSpaceView}; @@ -20,4 +27,47 @@ impl TypedComponentFallbackProvider for GraphSpaceView { } } -re_viewer_context::impl_component_fallback_provider!(GraphSpaceView => [VisualBounds2D]); +impl TypedComponentFallbackProvider for GraphSpaceView { + fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> Enabled { + match ctx.archetype_name { + Some(name) if name == archetypes::ForceLink::name() => true.into(), + Some(name) if name == archetypes::ForceManyBody::name() => true.into(), + Some(name) if name == archetypes::ForcePosition::name() => true.into(), + _ => false.into(), + } + } +} + +impl TypedComponentFallbackProvider for GraphSpaceView { + fn fallback_for(&self, _ctx: &re_viewer_context::QueryContext<'_>) -> ForceDistance { + (60.).into() + } +} + +impl TypedComponentFallbackProvider for GraphSpaceView { + fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> ForceStrength { + match ctx.archetype_name { + Some(name) if name == archetypes::ForceManyBody::name() => (-60.).into(), + Some(name) if name == archetypes::ForcePosition::name() => (0.01).into(), + _ => (1.0).into(), + } + } +} + +impl TypedComponentFallbackProvider for GraphSpaceView { + fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> ForceIterations { + match ctx.archetype_name { + Some(name) if name == archetypes::ForceLink::name() => 3.into(), + Some(name) if name == archetypes::ForceCollisionRadius::name() => 1.into(), + _ => Default::default(), + } + } +} + +impl TypedComponentFallbackProvider for GraphSpaceView { + fn fallback_for(&self, _ctx: &re_viewer_context::QueryContext<'_>) -> Position2D { + Default::default() + } +} + +re_viewer_context::impl_component_fallback_provider!(GraphSpaceView => [VisualBounds2D, Enabled, ForceDistance, ForceStrength, ForceIterations, Position2D]); diff --git a/crates/viewer/re_space_view_graph/src/ui/draw.rs b/crates/viewer/re_space_view_graph/src/ui/draw.rs index 21ab773bafa0..0379e9de5518 100644 --- a/crates/viewer/re_space_view_graph/src/ui/draw.rs +++ b/crates/viewer/re_space_view_graph/src/ui/draw.rs @@ -89,9 +89,11 @@ impl DrawableLabel { fn draw_circle_label( ui: &mut Ui, label: &CircleLabel, - _highlight: InteractionHighlight, + highlight: InteractionHighlight, ) -> Response { let &CircleLabel { radius, color } = label; + let visuals = &ui.style().visuals.clone(); + let (resp, painter) = ui.allocate_painter(Vec2::splat(radius * 2.0), Sense::click()); painter.circle( resp.rect.center(), @@ -99,6 +101,16 @@ fn draw_circle_label( color.unwrap_or_else(|| ui.style().visuals.text_color()), Stroke::NONE, ); + + if highlight.selection == SelectionHighlight::Selection { + painter.circle( + resp.rect.center(), + radius - 2.0, + Color32::TRANSPARENT, + Stroke::new(2.0, visuals.selection.stroke.color), + ); + } + resp } diff --git a/crates/viewer/re_space_view_graph/src/ui/mod.rs b/crates/viewer/re_space_view_graph/src/ui/mod.rs index 57c7974e5b72..876b32ffb8ac 100644 --- a/crates/viewer/re_space_view_graph/src/ui/mod.rs +++ b/crates/viewer/re_space_view_graph/src/ui/mod.rs @@ -1,5 +1,7 @@ mod draw; +mod selection; mod state; pub use draw::{draw_debug, draw_graph, DrawableLabel}; +pub use selection::view_property_force_ui; pub use state::GraphSpaceViewState; diff --git a/crates/viewer/re_space_view_graph/src/ui/selection.rs b/crates/viewer/re_space_view_graph/src/ui/selection.rs new file mode 100644 index 000000000000..3b67eeef116f --- /dev/null +++ b/crates/viewer/re_space_view_graph/src/ui/selection.rs @@ -0,0 +1,90 @@ +use re_space_view::{view_property_component_ui, view_property_component_ui_custom}; +use re_types::{ + blueprint::components::Enabled, Archetype, ArchetypeReflectionMarker, Component as _, +}; +use re_viewer_context::{ComponentFallbackProvider, SpaceViewId, SpaceViewState, ViewerContext}; +use re_viewport_blueprint::ViewProperty; + +/// This function is similar to [`view_property_component_ui`], but it always +/// picks the [`Enabled`] component for the single-line edit UI. +/// Also, it will always show the single-line edit UI (and not only if there is +/// a single property per archetype). +pub fn view_property_force_ui( + ctx: &ViewerContext<'_>, + ui: &mut egui::Ui, + view_id: SpaceViewId, + fallback_provider: &dyn ComponentFallbackProvider, + view_state: &dyn SpaceViewState, +) { + let property = + ViewProperty::from_archetype::(ctx.blueprint_db(), ctx.blueprint_query, view_id); + + let Some(reflection) = ctx.reflection.archetypes.get(&property.archetype_name) else { + // The `ArchetypeReflectionMarker` bound should make this impossible. + re_log::warn_once!( + "Missing reflection data for archetype {:?}.", + property.archetype_name + ); + return; + }; + + let query_ctx = property.query_context(ctx, view_state); + + if reflection.fields.len() == 1 { + let field = &reflection.fields[0]; + + view_property_component_ui( + &query_ctx, + ui, + &property, + reflection.display_name, + field, + fallback_provider, + ); + } else { + let sub_prop_ui = |ui: &mut egui::Ui| { + for field in &reflection.fields { + view_property_component_ui( + &query_ctx, + ui, + &property, + field.display_name, + field, + fallback_provider, + ); + } + }; + + let field = reflection + .fields + .iter() + .find(|field| field.component_name == Enabled::name()) + .expect("forces are required to have an `Enabled` component"); + + let component_array = property.component_raw(field.component_name); + let row_id = property.component_row_id(field.component_name); + + let singleline_ui: &dyn Fn(&mut egui::Ui) = &|ui| { + ctx.component_ui_registry.singleline_edit_ui( + &query_ctx, + ui, + ctx.blueprint_db(), + query_ctx.target_entity_path, + field.component_name, + row_id, + component_array.as_deref(), + fallback_provider, + ); + }; + + view_property_component_ui_custom( + &query_ctx, + ui, + &property, + reflection.display_name, + field, + singleline_ui, + Some(&sub_prop_ui), + ); + } +} diff --git a/crates/viewer/re_space_view_graph/src/ui/state.rs b/crates/viewer/re_space_view_graph/src/ui/state.rs index 4f22ca995c53..60f901a3c160 100644 --- a/crates/viewer/re_space_view_graph/src/ui/state.rs +++ b/crates/viewer/re_space_view_graph/src/ui/state.rs @@ -4,7 +4,7 @@ use re_types::blueprint::components::VisualBounds2D; use re_ui::UiExt; use re_viewer_context::SpaceViewState; -use crate::layout::{ForceLayoutProvider, Layout, LayoutRequest}; +use crate::layout::{ForceLayoutParams, ForceLayoutProvider, Layout, LayoutRequest}; /// Space view state for the custom space view. /// @@ -67,10 +67,12 @@ pub enum LayoutState { InProgress { layout: Layout, provider: ForceLayoutProvider, + params: ForceLayoutParams, }, Finished { layout: Layout, provider: ForceLayoutProvider, + params: ForceLayoutParams, }, } @@ -97,48 +99,83 @@ impl LayoutState { } /// A simple state machine that keeps track of the different stages and if the layout needs to be recomputed. - fn update(self, new_request: LayoutRequest) -> Self { + fn update(self, new_request: LayoutRequest, new_params: ForceLayoutParams) -> Self { match self { // Layout is up to date, nothing to do here. - Self::Finished { ref provider, .. } if provider.request == new_request => { + Self::Finished { + ref provider, + ref params, + .. + } if (provider.request == new_request) && (params == &new_params) => { self // no op } // We need to recompute the layout. Self::None => { - let mut provider = ForceLayoutProvider::new(new_request); + let mut provider = ForceLayoutProvider::new(new_request, &new_params); let layout = provider.tick(); - Self::InProgress { layout, provider } + Self::InProgress { + layout, + provider, + params: new_params, + } } Self::Finished { layout, .. } => { - let mut provider = ForceLayoutProvider::new_with_previous(new_request, &layout); + let mut provider = + ForceLayoutProvider::new_with_previous(new_request, &layout, &new_params); let layout = provider.tick(); - Self::InProgress { layout, provider } + Self::InProgress { + layout, + provider, + params: new_params, + } } Self::InProgress { layout, provider, .. } if provider.request != new_request => { - let mut provider = ForceLayoutProvider::new_with_previous(new_request, &layout); + let mut provider = + ForceLayoutProvider::new_with_previous(new_request, &layout, &new_params); let layout = provider.tick(); - Self::InProgress { layout, provider } + Self::InProgress { + layout, + provider, + params: new_params, + } } // We keep iterating on the layout until it is stable. Self::InProgress { mut provider, layout, - } => match provider.is_finished() { - true => Self::Finished { layout, provider }, - false => Self::InProgress { + params: old_params, + } => match (provider.is_finished(), new_params == old_params) { + (true, true) => Self::Finished { + layout, + provider, + params: new_params, + }, + (false, true) => Self::InProgress { layout: provider.tick(), provider, + params: new_params, }, + _ => { + let mut provider = + ForceLayoutProvider::new_with_previous(new_request, &layout, &new_params); + let layout = provider.tick(); + + Self::InProgress { + layout, + provider, + params: new_params, + } + } }, } } /// This method is lazy. A new layout is only computed if the current timestamp requires it. - pub fn get(&mut self, request: LayoutRequest) -> &mut Layout { - *self = std::mem::take(self).update(request); + pub fn get(&mut self, request: LayoutRequest, params: ForceLayoutParams) -> &mut Layout { + *self = std::mem::take(self).update(request, params); match self { Self::Finished { layout, .. } | Self::InProgress { layout, .. } => layout, diff --git a/crates/viewer/re_space_view_graph/src/view.rs b/crates/viewer/re_space_view_graph/src/view.rs index 6539892a1447..dc84ead92cc3 100644 --- a/crates/viewer/re_space_view_graph/src/view.rs +++ b/crates/viewer/re_space_view_graph/src/view.rs @@ -4,7 +4,13 @@ use re_space_view::{ view_property_ui, }; use re_types::{ - blueprint::{self, archetypes::VisualBounds2D}, + blueprint::{ + self, + archetypes::{ + ForceCenter, ForceCollisionRadius, ForceLink, ForceManyBody, ForcePosition, + VisualBounds2D, + }, + }, SpaceViewClassIdentifier, }; use re_ui::{ @@ -22,8 +28,8 @@ use re_viewport_blueprint::ViewProperty; use crate::{ graph::Graph, - layout::LayoutRequest, - ui::{draw_debug, draw_graph, GraphSpaceViewState}, + layout::{ForceLayoutParams, LayoutRequest}, + ui::{draw_debug, draw_graph, view_property_force_ui, GraphSpaceViewState}, visualizers::{merge, EdgesVisualizer, NodeVisualizer}, }; @@ -129,7 +135,14 @@ Display a graph of nodes and edges. state.debug_ui(ui); }); - view_property_ui::(ctx, ui, space_view_id, self, state); + re_ui::list_item::list_item_scope(ui, "graph_selection_ui", |ui| { + view_property_ui::(ctx, ui, space_view_id, self, state); + view_property_force_ui::(ctx, ui, space_view_id, self, state); + view_property_force_ui::(ctx, ui, space_view_id, self, state); + view_property_force_ui::(ctx, ui, space_view_id, self, state); + view_property_force_ui::(ctx, ui, space_view_id, self, state); + view_property_force_ui::(ctx, ui, space_view_id, self, state); + }); Ok(()) } @@ -164,11 +177,13 @@ Display a graph of nodes and edges. let rect_in_scene: blueprint::components::VisualBounds2D = bounds_property.component_or_fallback(ctx, self, state)?; + let params = ForceLayoutParams::get(ctx, query, self, state)?; + let rect_in_ui = ui.max_rect(); let request = LayoutRequest::from_graphs(graphs.iter()); let layout_was_empty = state.layout_state.is_none(); - let layout = state.layout_state.get(request); + let layout = state.layout_state.get(request, params); let mut ui_from_world = fit_to_rect_in_scene(rect_in_ui, rect_in_scene.into()); diff --git a/crates/viewer/re_space_view_spatial/src/view_3d_properties.rs b/crates/viewer/re_space_view_spatial/src/view_3d_properties.rs index 60721a944df4..3c9ddac728b9 100644 --- a/crates/viewer/re_space_view_spatial/src/view_3d_properties.rs +++ b/crates/viewer/re_space_view_spatial/src/view_3d_properties.rs @@ -4,7 +4,7 @@ use re_types::{ components::BackgroundKind, }, components::{Color, Plane3D, StrokeWidth}, - Archetype, + Archetype as _, }; use re_viewer_context::{SpaceViewStateExt as _, TypedComponentFallbackProvider}; diff --git a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs index e2ffaf50eb40..0e307fbc746b 100644 --- a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs +++ b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs @@ -7,8 +7,12 @@ pub use re_types::blueprint::components::BackgroundKind; pub use re_types::blueprint::components::ColumnShare; pub use re_types::blueprint::components::ComponentColumnSelector; pub use re_types::blueprint::components::Corner2D; +pub use re_types::blueprint::components::Enabled; pub use re_types::blueprint::components::FilterByRange; pub use re_types::blueprint::components::FilterIsNotNull; +pub use re_types::blueprint::components::ForceDistance; +pub use re_types::blueprint::components::ForceIterations; +pub use re_types::blueprint::components::ForceStrength; pub use re_types::blueprint::components::GridSpacing; pub use re_types::blueprint::components::IncludedContent; pub use re_types::blueprint::components::Interactive; @@ -50,8 +54,12 @@ pub fn is_valid_blueprint(blueprint: &EntityDb) -> bool { && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) + && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) + && validate_component::(blueprint) + && validate_component::(blueprint) + && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) diff --git a/crates/viewer/re_viewer/src/reflection/mod.rs b/crates/viewer/re_viewer/src/reflection/mod.rs index 2a4902df555e..72dd45c8db17 100644 --- a/crates/viewer/re_viewer/src/reflection/mod.rs +++ b/crates/viewer/re_viewer/src/reflection/mod.rs @@ -108,6 +108,14 @@ fn generate_component_reflection() -> Result::name(), + ComponentReflection { + docstring_md: "Whether a procedure is enabled.", + custom_placeholder: Some(Enabled::default().to_arrow2()?), + datatype: Enabled::arrow2_datatype(), + }, + ), ( ::name(), ComponentReflection { @@ -124,6 +132,30 @@ fn generate_component_reflection() -> Result::name(), + ComponentReflection { + docstring_md: "The target distance between two nodes.\n\nThis is helpful to scale the layout, for example if long labels are involved.", + custom_placeholder: Some(ForceDistance::default().to_arrow2()?), + datatype: ForceDistance::arrow2_datatype(), + }, + ), + ( + ::name(), + ComponentReflection { + docstring_md: "Specifies how often this force should be applied per iteration.\n\nIncreasing this parameter can lead to better results at the cost of longer computation time.", + custom_placeholder: Some(ForceIterations::default().to_arrow2()?), + datatype: ForceIterations::arrow2_datatype(), + }, + ), + ( + ::name(), + ComponentReflection { + docstring_md: "The strength of a given force.\n\nAllows to assign different weights to the individual forces, prioritizing one over the other.", + custom_placeholder: Some(ForceStrength::default().to_arrow2()?), + datatype: ForceStrength::arrow2_datatype(), + }, + ), ( ::name(), ComponentReflection { @@ -1954,6 +1986,99 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ], }, ), + ( + ArchetypeName::new("rerun.blueprint.archetypes.ForceCenter"), + ArchetypeReflection { + display_name: "Force center", + view_types: &[], + fields: vec![ + ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.Enabled".into(), display_name : + "Enabled", docstring_md : "Whether the force is enabled.", + is_required : false, }, ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.ForceStrength".into(), display_name : + "Strength", docstring_md : "The strength of the force.", is_required + : false, }, + ], + }, + ), + ( + ArchetypeName::new("rerun.blueprint.archetypes.ForceCollisionRadius"), + ArchetypeReflection { + display_name: "Force collision radius", + view_types: &[], + fields: vec![ + ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.Enabled".into(), display_name : + "Enabled", docstring_md : "Whether the force is enabled.", + is_required : false, }, ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.ForceStrength".into(), display_name : + "Strength", docstring_md : "The strength of the force.", is_required + : false, }, ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.ForceIterations".into(), display_name : + "Iterations", docstring_md : + "Specifies how often this force should be applied per iteration.\n\nIncreasing this parameter can lead to better results at the cost of longer computation time.", + is_required : false, }, + ], + }, + ), + ( + ArchetypeName::new("rerun.blueprint.archetypes.ForceLink"), + ArchetypeReflection { + display_name: "Force link", + view_types: &[], + fields: vec![ + ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.Enabled".into(), display_name : + "Enabled", docstring_md : "Whether the force is enabled.", + is_required : false, }, ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.ForceDistance".into(), display_name : + "Distance", docstring_md : "The target distance between two nodes.", + is_required : false, }, ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.ForceIterations".into(), display_name : + "Iterations", docstring_md : + "Specifies how often this force should be applied per iteration.\n\nIncreasing this parameter can lead to better results at the cost of longer computation time.", + is_required : false, }, + ], + }, + ), + ( + ArchetypeName::new("rerun.blueprint.archetypes.ForceManyBody"), + ArchetypeReflection { + display_name: "Force many body", + view_types: &[], + fields: vec![ + ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.Enabled".into(), display_name : + "Enabled", docstring_md : "Whether the force is enabled.", + is_required : false, }, ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.ForceStrength".into(), display_name : + "Strength", docstring_md : + "The strength of the force.\n\nIf `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together.", + is_required : false, }, + ], + }, + ), + ( + ArchetypeName::new("rerun.blueprint.archetypes.ForcePosition"), + ArchetypeReflection { + display_name: "Force position", + view_types: &[], + fields: vec![ + ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.Enabled".into(), display_name : + "Enabled", docstring_md : "Whether the force is enabled.", + is_required : false, }, ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.ForceStrength".into(), display_name : + "Strength", docstring_md : "The strength of the force.", is_required + : false, }, ArchetypeFieldReflection { component_name : + "rerun.components.Position2D".into(), display_name : "Position", + docstring_md : + "The position where the nodes should be pulled towards.", is_required + : false, }, + ], + }, + ), ( ArchetypeName::new("rerun.blueprint.archetypes.LineGrid3D"), ArchetypeReflection { diff --git a/docs/content/reference/types/views/graph_view.md b/docs/content/reference/types/views/graph_view.md index 58432cb123b8..4b483c3fda87 100644 --- a/docs/content/reference/types/views/graph_view.md +++ b/docs/content/reference/types/views/graph_view.md @@ -14,6 +14,34 @@ Somethings outside of these bounds may also be visible due to letterboxing. * `range`: Controls the visible range of a 2D view. * `near_clip_plane`: Controls the distance to the near clip plane in 3D scene units. +### `force_link` +Allows to control the interaction between two nodes connected by an edge. + +* `enabled`: Whether the force is enabled. +* `distance`: The target distance between two nodes. +* `iterations`: Specifies how often this force should be applied per iteration. +### `force_many_body` +A force between each pair of nodes that ressembles an electrical charge. + +* `enabled`: Whether the force is enabled. +* `strength`: The strength of the force. +### `force_position` +Similar to gravity, this force pulls nodes towards a specific position. + +* `enabled`: Whether the force is enabled. +* `strength`: The strength of the force. +* `position`: The position where the nodes should be pulled towards. +### `force_collision_radius` +Resolves collisions between the bounding spheres, according to the radius of the nodes. + +* `enabled`: Whether the force is enabled. +* `strength`: The strength of the force. +* `iterations`: Specifies how often this force should be applied per iteration. +### `force_center` +Tries to move the center of mass of the graph to the origin. + +* `enabled`: Whether the force is enabled. +* `strength`: The strength of the force. ## API reference links * 🐍 [Python API docs for `GraphView`](https://ref.rerun.io/docs/python/stable/common/blueprint_views?speculative-link#rerun.blueprint.views.GraphView) diff --git a/rerun_cpp/src/rerun/blueprint/archetypes.hpp b/rerun_cpp/src/rerun/blueprint/archetypes.hpp index 09042a682126..75ec3053e31b 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes.hpp @@ -5,6 +5,11 @@ #include "blueprint/archetypes/background.hpp" #include "blueprint/archetypes/container_blueprint.hpp" #include "blueprint/archetypes/dataframe_query.hpp" +#include "blueprint/archetypes/force_center.hpp" +#include "blueprint/archetypes/force_collision_radius.hpp" +#include "blueprint/archetypes/force_link.hpp" +#include "blueprint/archetypes/force_many_body.hpp" +#include "blueprint/archetypes/force_position.hpp" #include "blueprint/archetypes/line_grid3d.hpp" #include "blueprint/archetypes/map_background.hpp" #include "blueprint/archetypes/map_zoom.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes index ec736e25d263..e2e5fc6eb05e 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes @@ -7,6 +7,16 @@ container_blueprint.cpp linguist-generated=true container_blueprint.hpp linguist-generated=true dataframe_query.cpp linguist-generated=true dataframe_query.hpp linguist-generated=true +force_center.cpp linguist-generated=true +force_center.hpp linguist-generated=true +force_collision_radius.cpp linguist-generated=true +force_collision_radius.hpp linguist-generated=true +force_link.cpp linguist-generated=true +force_link.hpp linguist-generated=true +force_many_body.cpp linguist-generated=true +force_many_body.hpp linguist-generated=true +force_position.cpp linguist-generated=true +force_position.hpp linguist-generated=true line_grid3d.cpp linguist-generated=true line_grid3d.hpp linguist-generated=true map_background.cpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/force_center.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/force_center.cpp new file mode 100644 index 000000000000..a05527d07e18 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/force_center.cpp @@ -0,0 +1,52 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_center.fbs". + +#include "force_center.hpp" + +#include "../../collection_adapter_builtins.hpp" + +namespace rerun::blueprint::archetypes {} + +namespace rerun { + + Result> AsComponents::serialize( + const blueprint::archetypes::ForceCenter& archetype + ) { + using namespace blueprint::archetypes; + std::vector cells; + cells.reserve(3); + + if (archetype.enabled.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.enabled.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForceCenter", + "enabled", + "rerun.blueprint.components.Enabled" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + if (archetype.strength.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.strength.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForceCenter", + "strength", + "rerun.blueprint.components.ForceStrength" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + { + auto indicator = ForceCenter::IndicatorComponent(); + auto result = ComponentBatch::from_loggable(indicator); + RR_RETURN_NOT_OK(result.error); + cells.emplace_back(std::move(result.value)); + } + + return cells; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/force_center.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/force_center.hpp new file mode 100644 index 000000000000..8c3854765b91 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/force_center.hpp @@ -0,0 +1,69 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_center.fbs". + +#pragma once + +#include "../../blueprint/components/enabled.hpp" +#include "../../blueprint/components/force_strength.hpp" +#include "../../collection.hpp" +#include "../../compiler_utils.hpp" +#include "../../component_batch.hpp" +#include "../../indicator_component.hpp" +#include "../../result.hpp" + +#include +#include +#include +#include + +namespace rerun::blueprint::archetypes { + /// **Archetype**: Tries to move the center of mass of the graph to the origin. + struct ForceCenter { + /// Whether the force is enabled. + std::optional enabled; + + /// The strength of the force. + std::optional strength; + + public: + static constexpr const char IndicatorComponentName[] = + "rerun.blueprint.components.ForceCenterIndicator"; + + /// Indicator component, used to identify the archetype when converting to a list of components. + using IndicatorComponent = rerun::components::IndicatorComponent; + + public: + ForceCenter() = default; + ForceCenter(ForceCenter&& other) = default; + + /// Whether the force is enabled. + ForceCenter with_enabled(rerun::blueprint::components::Enabled _enabled) && { + enabled = std::move(_enabled); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + + /// The strength of the force. + ForceCenter with_strength(rerun::blueprint::components::ForceStrength _strength) && { + strength = std::move(_strength); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + }; + +} // namespace rerun::blueprint::archetypes + +namespace rerun { + /// \private + template + struct AsComponents; + + /// \private + template <> + struct AsComponents { + /// Serialize all set component batches. + static Result> serialize( + const blueprint::archetypes::ForceCenter& archetype + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/force_collision_radius.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/force_collision_radius.cpp new file mode 100644 index 000000000000..1fd8539d8a54 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/force_collision_radius.cpp @@ -0,0 +1,65 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_collision_radius.fbs". + +#include "force_collision_radius.hpp" + +#include "../../collection_adapter_builtins.hpp" + +namespace rerun::blueprint::archetypes {} + +namespace rerun { + + Result> + AsComponents::serialize( + const blueprint::archetypes::ForceCollisionRadius& archetype + ) { + using namespace blueprint::archetypes; + std::vector cells; + cells.reserve(4); + + if (archetype.enabled.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.enabled.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForceCollisionRadius", + "enabled", + "rerun.blueprint.components.Enabled" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + if (archetype.strength.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.strength.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForceCollisionRadius", + "strength", + "rerun.blueprint.components.ForceStrength" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + if (archetype.iterations.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.iterations.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForceCollisionRadius", + "iterations", + "rerun.blueprint.components.ForceIterations" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + { + auto indicator = ForceCollisionRadius::IndicatorComponent(); + auto result = ComponentBatch::from_loggable(indicator); + RR_RETURN_NOT_OK(result.error); + cells.emplace_back(std::move(result.value)); + } + + return cells; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/force_collision_radius.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/force_collision_radius.hpp new file mode 100644 index 000000000000..5b8ff3d1d511 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/force_collision_radius.hpp @@ -0,0 +1,87 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_collision_radius.fbs". + +#pragma once + +#include "../../blueprint/components/enabled.hpp" +#include "../../blueprint/components/force_iterations.hpp" +#include "../../blueprint/components/force_strength.hpp" +#include "../../collection.hpp" +#include "../../compiler_utils.hpp" +#include "../../component_batch.hpp" +#include "../../indicator_component.hpp" +#include "../../result.hpp" + +#include +#include +#include +#include + +namespace rerun::blueprint::archetypes { + /// **Archetype**: Resolves collisions between the bounding spheres, according to the radius of the nodes. + struct ForceCollisionRadius { + /// Whether the force is enabled. + std::optional enabled; + + /// The strength of the force. + std::optional strength; + + /// Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + std::optional iterations; + + public: + static constexpr const char IndicatorComponentName[] = + "rerun.blueprint.components.ForceCollisionRadiusIndicator"; + + /// Indicator component, used to identify the archetype when converting to a list of components. + using IndicatorComponent = rerun::components::IndicatorComponent; + + public: + ForceCollisionRadius() = default; + ForceCollisionRadius(ForceCollisionRadius&& other) = default; + + /// Whether the force is enabled. + ForceCollisionRadius with_enabled(rerun::blueprint::components::Enabled _enabled) && { + enabled = std::move(_enabled); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + + /// The strength of the force. + ForceCollisionRadius with_strength(rerun::blueprint::components::ForceStrength _strength + ) && { + strength = std::move(_strength); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + + /// Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + ForceCollisionRadius with_iterations( + rerun::blueprint::components::ForceIterations _iterations + ) && { + iterations = std::move(_iterations); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + }; + +} // namespace rerun::blueprint::archetypes + +namespace rerun { + /// \private + template + struct AsComponents; + + /// \private + template <> + struct AsComponents { + /// Serialize all set component batches. + static Result> serialize( + const blueprint::archetypes::ForceCollisionRadius& archetype + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/force_link.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/force_link.cpp new file mode 100644 index 000000000000..7cda317fa91b --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/force_link.cpp @@ -0,0 +1,64 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_link.fbs". + +#include "force_link.hpp" + +#include "../../collection_adapter_builtins.hpp" + +namespace rerun::blueprint::archetypes {} + +namespace rerun { + + Result> AsComponents::serialize( + const blueprint::archetypes::ForceLink& archetype + ) { + using namespace blueprint::archetypes; + std::vector cells; + cells.reserve(4); + + if (archetype.enabled.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.enabled.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForceLink", + "enabled", + "rerun.blueprint.components.Enabled" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + if (archetype.distance.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.distance.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForceLink", + "distance", + "rerun.blueprint.components.ForceDistance" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + if (archetype.iterations.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.iterations.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForceLink", + "iterations", + "rerun.blueprint.components.ForceIterations" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + { + auto indicator = ForceLink::IndicatorComponent(); + auto result = ComponentBatch::from_loggable(indicator); + RR_RETURN_NOT_OK(result.error); + cells.emplace_back(std::move(result.value)); + } + + return cells; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/force_link.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/force_link.hpp new file mode 100644 index 000000000000..0d88538bc59b --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/force_link.hpp @@ -0,0 +1,84 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_link.fbs". + +#pragma once + +#include "../../blueprint/components/enabled.hpp" +#include "../../blueprint/components/force_distance.hpp" +#include "../../blueprint/components/force_iterations.hpp" +#include "../../collection.hpp" +#include "../../compiler_utils.hpp" +#include "../../component_batch.hpp" +#include "../../indicator_component.hpp" +#include "../../result.hpp" + +#include +#include +#include +#include + +namespace rerun::blueprint::archetypes { + /// **Archetype**: Aims to achieve a target distance between two nodes that are connected by an edge. + struct ForceLink { + /// Whether the force is enabled. + std::optional enabled; + + /// The target distance between two nodes. + std::optional distance; + + /// Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + std::optional iterations; + + public: + static constexpr const char IndicatorComponentName[] = + "rerun.blueprint.components.ForceLinkIndicator"; + + /// Indicator component, used to identify the archetype when converting to a list of components. + using IndicatorComponent = rerun::components::IndicatorComponent; + + public: + ForceLink() = default; + ForceLink(ForceLink&& other) = default; + + /// Whether the force is enabled. + ForceLink with_enabled(rerun::blueprint::components::Enabled _enabled) && { + enabled = std::move(_enabled); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + + /// The target distance between two nodes. + ForceLink with_distance(rerun::blueprint::components::ForceDistance _distance) && { + distance = std::move(_distance); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + + /// Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + ForceLink with_iterations(rerun::blueprint::components::ForceIterations _iterations) && { + iterations = std::move(_iterations); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + }; + +} // namespace rerun::blueprint::archetypes + +namespace rerun { + /// \private + template + struct AsComponents; + + /// \private + template <> + struct AsComponents { + /// Serialize all set component batches. + static Result> serialize( + const blueprint::archetypes::ForceLink& archetype + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/force_many_body.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/force_many_body.cpp new file mode 100644 index 000000000000..58a115516b29 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/force_many_body.cpp @@ -0,0 +1,53 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_many_body.fbs". + +#include "force_many_body.hpp" + +#include "../../collection_adapter_builtins.hpp" + +namespace rerun::blueprint::archetypes {} + +namespace rerun { + + Result> + AsComponents::serialize( + const blueprint::archetypes::ForceManyBody& archetype + ) { + using namespace blueprint::archetypes; + std::vector cells; + cells.reserve(3); + + if (archetype.enabled.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.enabled.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForceManyBody", + "enabled", + "rerun.blueprint.components.Enabled" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + if (archetype.strength.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.strength.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForceManyBody", + "strength", + "rerun.blueprint.components.ForceStrength" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + { + auto indicator = ForceManyBody::IndicatorComponent(); + auto result = ComponentBatch::from_loggable(indicator); + RR_RETURN_NOT_OK(result.error); + cells.emplace_back(std::move(result.value)); + } + + return cells; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/force_many_body.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/force_many_body.hpp new file mode 100644 index 000000000000..c5267b3cf692 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/force_many_body.hpp @@ -0,0 +1,75 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_many_body.fbs". + +#pragma once + +#include "../../blueprint/components/enabled.hpp" +#include "../../blueprint/components/force_strength.hpp" +#include "../../collection.hpp" +#include "../../compiler_utils.hpp" +#include "../../component_batch.hpp" +#include "../../indicator_component.hpp" +#include "../../result.hpp" + +#include +#include +#include +#include + +namespace rerun::blueprint::archetypes { + /// **Archetype**: A force between each pair of nodes that ressembles an electrical charge. + /// + /// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. + struct ForceManyBody { + /// Whether the force is enabled. + std::optional enabled; + + /// The strength of the force. + /// + /// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. + std::optional strength; + + public: + static constexpr const char IndicatorComponentName[] = + "rerun.blueprint.components.ForceManyBodyIndicator"; + + /// Indicator component, used to identify the archetype when converting to a list of components. + using IndicatorComponent = rerun::components::IndicatorComponent; + + public: + ForceManyBody() = default; + ForceManyBody(ForceManyBody&& other) = default; + + /// Whether the force is enabled. + ForceManyBody with_enabled(rerun::blueprint::components::Enabled _enabled) && { + enabled = std::move(_enabled); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + + /// The strength of the force. + /// + /// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. + ForceManyBody with_strength(rerun::blueprint::components::ForceStrength _strength) && { + strength = std::move(_strength); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + }; + +} // namespace rerun::blueprint::archetypes + +namespace rerun { + /// \private + template + struct AsComponents; + + /// \private + template <> + struct AsComponents { + /// Serialize all set component batches. + static Result> serialize( + const blueprint::archetypes::ForceManyBody& archetype + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/force_position.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/force_position.cpp new file mode 100644 index 000000000000..d30542673513 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/force_position.cpp @@ -0,0 +1,65 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_position.fbs". + +#include "force_position.hpp" + +#include "../../collection_adapter_builtins.hpp" + +namespace rerun::blueprint::archetypes {} + +namespace rerun { + + Result> + AsComponents::serialize( + const blueprint::archetypes::ForcePosition& archetype + ) { + using namespace blueprint::archetypes; + std::vector cells; + cells.reserve(4); + + if (archetype.enabled.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.enabled.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForcePosition", + "enabled", + "rerun.blueprint.components.Enabled" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + if (archetype.strength.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.strength.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForcePosition", + "strength", + "rerun.blueprint.components.ForceStrength" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + if (archetype.position.has_value()) { + auto result = ComponentBatch::from_loggable( + archetype.position.value(), + ComponentDescriptor( + "rerun.blueprint.archetypes.ForcePosition", + "position", + "rerun.components.Position2D" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + { + auto indicator = ForcePosition::IndicatorComponent(); + auto result = ComponentBatch::from_loggable(indicator); + RR_RETURN_NOT_OK(result.error); + cells.emplace_back(std::move(result.value)); + } + + return cells; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/force_position.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/force_position.hpp new file mode 100644 index 000000000000..36d740ce7393 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/force_position.hpp @@ -0,0 +1,80 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_position.fbs". + +#pragma once + +#include "../../blueprint/components/enabled.hpp" +#include "../../blueprint/components/force_strength.hpp" +#include "../../collection.hpp" +#include "../../compiler_utils.hpp" +#include "../../component_batch.hpp" +#include "../../components/position2d.hpp" +#include "../../indicator_component.hpp" +#include "../../result.hpp" + +#include +#include +#include +#include + +namespace rerun::blueprint::archetypes { + /// **Archetype**: Similar to gravity, this force pulls nodes towards a specific position. + struct ForcePosition { + /// Whether the force is enabled. + std::optional enabled; + + /// The strength of the force. + std::optional strength; + + /// The position where the nodes should be pulled towards. + std::optional position; + + public: + static constexpr const char IndicatorComponentName[] = + "rerun.blueprint.components.ForcePositionIndicator"; + + /// Indicator component, used to identify the archetype when converting to a list of components. + using IndicatorComponent = rerun::components::IndicatorComponent; + + public: + ForcePosition() = default; + ForcePosition(ForcePosition&& other) = default; + + /// Whether the force is enabled. + ForcePosition with_enabled(rerun::blueprint::components::Enabled _enabled) && { + enabled = std::move(_enabled); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + + /// The strength of the force. + ForcePosition with_strength(rerun::blueprint::components::ForceStrength _strength) && { + strength = std::move(_strength); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + + /// The position where the nodes should be pulled towards. + ForcePosition with_position(rerun::components::Position2D _position) && { + position = std::move(_position); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + }; + +} // namespace rerun::blueprint::archetypes + +namespace rerun { + /// \private + template + struct AsComponents; + + /// \private + template <> + struct AsComponents { + /// Serialize all set component batches. + static Result> serialize( + const blueprint::archetypes::ForcePosition& archetype + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components.hpp b/rerun_cpp/src/rerun/blueprint/components.hpp index e5ed33415971..9407110804f8 100644 --- a/rerun_cpp/src/rerun/blueprint/components.hpp +++ b/rerun_cpp/src/rerun/blueprint/components.hpp @@ -11,8 +11,12 @@ #include "blueprint/components/component_column_selector.hpp" #include "blueprint/components/container_kind.hpp" #include "blueprint/components/corner2d.hpp" +#include "blueprint/components/enabled.hpp" #include "blueprint/components/filter_by_range.hpp" #include "blueprint/components/filter_is_not_null.hpp" +#include "blueprint/components/force_distance.hpp" +#include "blueprint/components/force_iterations.hpp" +#include "blueprint/components/force_strength.hpp" #include "blueprint/components/grid_columns.hpp" #include "blueprint/components/grid_spacing.hpp" #include "blueprint/components/included_content.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/components/.gitattributes b/rerun_cpp/src/rerun/blueprint/components/.gitattributes index 01c332e58b9c..222d19806052 100644 --- a/rerun_cpp/src/rerun/blueprint/components/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/components/.gitattributes @@ -13,8 +13,12 @@ container_kind.cpp linguist-generated=true container_kind.hpp linguist-generated=true corner2d.cpp linguist-generated=true corner2d.hpp linguist-generated=true +enabled.hpp linguist-generated=true filter_by_range.hpp linguist-generated=true filter_is_not_null.hpp linguist-generated=true +force_distance.hpp linguist-generated=true +force_iterations.hpp linguist-generated=true +force_strength.hpp linguist-generated=true grid_columns.hpp linguist-generated=true grid_spacing.hpp linguist-generated=true included_content.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/components/enabled.hpp b/rerun_cpp/src/rerun/blueprint/components/enabled.hpp new file mode 100644 index 000000000000..c80c4f640189 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/enabled.hpp @@ -0,0 +1,74 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/enabled.fbs". + +#pragma once + +#include "../../component_descriptor.hpp" +#include "../../datatypes/bool.hpp" +#include "../../result.hpp" + +#include +#include + +namespace rerun::blueprint::components { + /// **Component**: Whether a procedure is enabled. + struct Enabled { + rerun::datatypes::Bool visible; + + public: + Enabled() = default; + + Enabled(rerun::datatypes::Bool visible_) : visible(visible_) {} + + Enabled& operator=(rerun::datatypes::Bool visible_) { + visible = visible_; + return *this; + } + + Enabled(bool value_) : visible(value_) {} + + Enabled& operator=(bool value_) { + visible = value_; + return *this; + } + + /// Cast to the underlying Bool datatype + operator rerun::datatypes::Bool() const { + return visible; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + static_assert(sizeof(rerun::datatypes::Bool) == sizeof(blueprint::components::Enabled)); + + /// \private + template <> + struct Loggable { + static constexpr ComponentDescriptor Descriptor = "rerun.blueprint.components.Enabled"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype() { + return Loggable::arrow_datatype(); + } + + /// Serializes an array of `rerun::blueprint:: components::Enabled` into an arrow array. + static Result> to_arrow( + const blueprint::components::Enabled* instances, size_t num_instances + ) { + if (num_instances == 0) { + return Loggable::to_arrow(nullptr, 0); + } else if (instances == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Passed array instances is null when num_elements> 0." + ); + } else { + return Loggable::to_arrow( + &instances->visible, + num_instances + ); + } + } + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/force_distance.hpp b/rerun_cpp/src/rerun/blueprint/components/force_distance.hpp new file mode 100644 index 000000000000..05b0b79dbeb1 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/force_distance.hpp @@ -0,0 +1,79 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/force_distance.fbs". + +#pragma once + +#include "../../component_descriptor.hpp" +#include "../../datatypes/float64.hpp" +#include "../../result.hpp" + +#include +#include + +namespace rerun::blueprint::components { + /// **Component**: The target distance between two nodes. + /// + /// This is helpful to scale the layout, for example if long labels are involved. + struct ForceDistance { + rerun::datatypes::Float64 distance; + + public: + ForceDistance() = default; + + ForceDistance(rerun::datatypes::Float64 distance_) : distance(distance_) {} + + ForceDistance& operator=(rerun::datatypes::Float64 distance_) { + distance = distance_; + return *this; + } + + ForceDistance(double value_) : distance(value_) {} + + ForceDistance& operator=(double value_) { + distance = value_; + return *this; + } + + /// Cast to the underlying Float64 datatype + operator rerun::datatypes::Float64() const { + return distance; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + static_assert( + sizeof(rerun::datatypes::Float64) == sizeof(blueprint::components::ForceDistance) + ); + + /// \private + template <> + struct Loggable { + static constexpr ComponentDescriptor Descriptor = + "rerun.blueprint.components.ForceDistance"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype() { + return Loggable::arrow_datatype(); + } + + /// Serializes an array of `rerun::blueprint:: components::ForceDistance` into an arrow array. + static Result> to_arrow( + const blueprint::components::ForceDistance* instances, size_t num_instances + ) { + if (num_instances == 0) { + return Loggable::to_arrow(nullptr, 0); + } else if (instances == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Passed array instances is null when num_elements> 0." + ); + } else { + return Loggable::to_arrow( + &instances->distance, + num_instances + ); + } + } + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/force_iterations.hpp b/rerun_cpp/src/rerun/blueprint/components/force_iterations.hpp new file mode 100644 index 000000000000..49f1ceef04ea --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/force_iterations.hpp @@ -0,0 +1,79 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/force_iterations.fbs". + +#pragma once + +#include "../../component_descriptor.hpp" +#include "../../datatypes/uint64.hpp" +#include "../../result.hpp" + +#include +#include + +namespace rerun::blueprint::components { + /// **Component**: Specifies how often this force should be applied per iteration. + /// + /// Increasing this parameter can lead to better results at the cost of longer computation time. + struct ForceIterations { + rerun::datatypes::UInt64 distance; + + public: + ForceIterations() = default; + + ForceIterations(rerun::datatypes::UInt64 distance_) : distance(distance_) {} + + ForceIterations& operator=(rerun::datatypes::UInt64 distance_) { + distance = distance_; + return *this; + } + + ForceIterations(uint64_t value_) : distance(value_) {} + + ForceIterations& operator=(uint64_t value_) { + distance = value_; + return *this; + } + + /// Cast to the underlying UInt64 datatype + operator rerun::datatypes::UInt64() const { + return distance; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + static_assert( + sizeof(rerun::datatypes::UInt64) == sizeof(blueprint::components::ForceIterations) + ); + + /// \private + template <> + struct Loggable { + static constexpr ComponentDescriptor Descriptor = + "rerun.blueprint.components.ForceIterations"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype() { + return Loggable::arrow_datatype(); + } + + /// Serializes an array of `rerun::blueprint:: components::ForceIterations` into an arrow array. + static Result> to_arrow( + const blueprint::components::ForceIterations* instances, size_t num_instances + ) { + if (num_instances == 0) { + return Loggable::to_arrow(nullptr, 0); + } else if (instances == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Passed array instances is null when num_elements> 0." + ); + } else { + return Loggable::to_arrow( + &instances->distance, + num_instances + ); + } + } + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/force_strength.hpp b/rerun_cpp/src/rerun/blueprint/components/force_strength.hpp new file mode 100644 index 000000000000..ebb49b44191b --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/force_strength.hpp @@ -0,0 +1,79 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/force_strength.fbs". + +#pragma once + +#include "../../component_descriptor.hpp" +#include "../../datatypes/float64.hpp" +#include "../../result.hpp" + +#include +#include + +namespace rerun::blueprint::components { + /// **Component**: The strength of a given force. + /// + /// Allows to assign different weights to the individual forces, prioritizing one over the other. + struct ForceStrength { + rerun::datatypes::Float64 distance; + + public: + ForceStrength() = default; + + ForceStrength(rerun::datatypes::Float64 distance_) : distance(distance_) {} + + ForceStrength& operator=(rerun::datatypes::Float64 distance_) { + distance = distance_; + return *this; + } + + ForceStrength(double value_) : distance(value_) {} + + ForceStrength& operator=(double value_) { + distance = value_; + return *this; + } + + /// Cast to the underlying Float64 datatype + operator rerun::datatypes::Float64() const { + return distance; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + static_assert( + sizeof(rerun::datatypes::Float64) == sizeof(blueprint::components::ForceStrength) + ); + + /// \private + template <> + struct Loggable { + static constexpr ComponentDescriptor Descriptor = + "rerun.blueprint.components.ForceStrength"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype() { + return Loggable::arrow_datatype(); + } + + /// Serializes an array of `rerun::blueprint:: components::ForceStrength` into an arrow array. + static Result> to_arrow( + const blueprint::components::ForceStrength* instances, size_t num_instances + ) { + if (num_instances == 0) { + return Loggable::to_arrow(nullptr, 0); + } else if (instances == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Passed array instances is null when num_elements> 0." + ); + } else { + return Loggable::to_arrow( + &instances->distance, + num_instances + ); + } + } + }; +} // namespace rerun diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes index 45d2c2e0e797..03a4f9d20824 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes @@ -5,6 +5,11 @@ __init__.py linguist-generated=true background.py linguist-generated=true container_blueprint.py linguist-generated=true dataframe_query.py linguist-generated=true +force_center.py linguist-generated=true +force_collision_radius.py linguist-generated=true +force_link.py linguist-generated=true +force_many_body.py linguist-generated=true +force_position.py linguist-generated=true line_grid3d.py linguist-generated=true map_background.py linguist-generated=true map_zoom.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py index de30db55093f..58d545a3f97a 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py @@ -5,6 +5,11 @@ from .background import Background from .container_blueprint import ContainerBlueprint from .dataframe_query import DataframeQuery +from .force_center import ForceCenter +from .force_collision_radius import ForceCollisionRadius +from .force_link import ForceLink +from .force_many_body import ForceManyBody +from .force_position import ForcePosition from .line_grid3d import LineGrid3D from .map_background import MapBackground from .map_zoom import MapZoom @@ -24,6 +29,11 @@ "Background", "ContainerBlueprint", "DataframeQuery", + "ForceCenter", + "ForceCollisionRadius", + "ForceLink", + "ForceManyBody", + "ForcePosition", "LineGrid3D", "MapBackground", "MapZoom", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_center.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_center.py new file mode 100644 index 000000000000..7d026c887d70 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_center.py @@ -0,0 +1,80 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_center.fbs". + +# You can extend this class by creating a "ForceCenterExt" class in "force_center_ext.py". + +from __future__ import annotations + +from typing import Any + +from attrs import define, field + +from ... import datatypes +from ..._baseclasses import ( + Archetype, +) +from ...blueprint import components as blueprint_components +from ...error_utils import catch_and_log_exceptions + +__all__ = ["ForceCenter"] + + +@define(str=False, repr=False, init=False) +class ForceCenter(Archetype): + """**Archetype**: Tries to move the center of mass of the graph to the origin.""" + + def __init__( + self: Any, *, enabled: datatypes.BoolLike | None = None, strength: datatypes.Float64Like | None = None + ): + """ + Create a new instance of the ForceCenter archetype. + + Parameters + ---------- + enabled: + Whether the force is enabled. + strength: + The strength of the force. + + """ + + # You can define your own __init__ function as a member of ForceCenterExt in force_center_ext.py + with catch_and_log_exceptions(context=self.__class__.__name__): + self.__attrs_init__(enabled=enabled, strength=strength) + return + self.__attrs_clear__() + + def __attrs_clear__(self) -> None: + """Convenience method for calling `__attrs_init__` with all `None`s.""" + self.__attrs_init__( + enabled=None, # type: ignore[arg-type] + strength=None, # type: ignore[arg-type] + ) + + @classmethod + def _clear(cls) -> ForceCenter: + """Produce an empty ForceCenter, bypassing `__init__`.""" + inst = cls.__new__(cls) + inst.__attrs_clear__() + return inst + + enabled: blueprint_components.EnabledBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.EnabledBatch._optional, # type: ignore[misc] + ) + # Whether the force is enabled. + # + # (Docstring intentionally commented out to hide this field from the docs) + + strength: blueprint_components.ForceStrengthBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.ForceStrengthBatch._optional, # type: ignore[misc] + ) + # The strength of the force. + # + # (Docstring intentionally commented out to hide this field from the docs) + + __str__ = Archetype.__str__ + __repr__ = Archetype.__repr__ # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_collision_radius.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_collision_radius.py new file mode 100644 index 000000000000..80464759b93f --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_collision_radius.py @@ -0,0 +1,100 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_collision_radius.fbs". + +# You can extend this class by creating a "ForceCollisionRadiusExt" class in "force_collision_radius_ext.py". + +from __future__ import annotations + +from typing import Any + +from attrs import define, field + +from ... import datatypes +from ..._baseclasses import ( + Archetype, +) +from ...blueprint import components as blueprint_components +from ...error_utils import catch_and_log_exceptions + +__all__ = ["ForceCollisionRadius"] + + +@define(str=False, repr=False, init=False) +class ForceCollisionRadius(Archetype): + """**Archetype**: Resolves collisions between the bounding spheres, according to the radius of the nodes.""" + + def __init__( + self: Any, + *, + enabled: datatypes.BoolLike | None = None, + strength: datatypes.Float64Like | None = None, + iterations: datatypes.UInt64Like | None = None, + ): + """ + Create a new instance of the ForceCollisionRadius archetype. + + Parameters + ---------- + enabled: + Whether the force is enabled. + strength: + The strength of the force. + iterations: + Specifies how often this force should be applied per iteration. + + Increasing this parameter can lead to better results at the cost of longer computation time. + + """ + + # You can define your own __init__ function as a member of ForceCollisionRadiusExt in force_collision_radius_ext.py + with catch_and_log_exceptions(context=self.__class__.__name__): + self.__attrs_init__(enabled=enabled, strength=strength, iterations=iterations) + return + self.__attrs_clear__() + + def __attrs_clear__(self) -> None: + """Convenience method for calling `__attrs_init__` with all `None`s.""" + self.__attrs_init__( + enabled=None, # type: ignore[arg-type] + strength=None, # type: ignore[arg-type] + iterations=None, # type: ignore[arg-type] + ) + + @classmethod + def _clear(cls) -> ForceCollisionRadius: + """Produce an empty ForceCollisionRadius, bypassing `__init__`.""" + inst = cls.__new__(cls) + inst.__attrs_clear__() + return inst + + enabled: blueprint_components.EnabledBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.EnabledBatch._optional, # type: ignore[misc] + ) + # Whether the force is enabled. + # + # (Docstring intentionally commented out to hide this field from the docs) + + strength: blueprint_components.ForceStrengthBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.ForceStrengthBatch._optional, # type: ignore[misc] + ) + # The strength of the force. + # + # (Docstring intentionally commented out to hide this field from the docs) + + iterations: blueprint_components.ForceIterationsBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.ForceIterationsBatch._optional, # type: ignore[misc] + ) + # Specifies how often this force should be applied per iteration. + # + # Increasing this parameter can lead to better results at the cost of longer computation time. + # + # (Docstring intentionally commented out to hide this field from the docs) + + __str__ = Archetype.__str__ + __repr__ = Archetype.__repr__ # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_link.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_link.py new file mode 100644 index 000000000000..bf24c7265d63 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_link.py @@ -0,0 +1,100 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_link.fbs". + +# You can extend this class by creating a "ForceLinkExt" class in "force_link_ext.py". + +from __future__ import annotations + +from typing import Any + +from attrs import define, field + +from ... import datatypes +from ..._baseclasses import ( + Archetype, +) +from ...blueprint import components as blueprint_components +from ...error_utils import catch_and_log_exceptions + +__all__ = ["ForceLink"] + + +@define(str=False, repr=False, init=False) +class ForceLink(Archetype): + """**Archetype**: Aims to achieve a target distance between two nodes that are connected by an edge.""" + + def __init__( + self: Any, + *, + enabled: datatypes.BoolLike | None = None, + distance: datatypes.Float64Like | None = None, + iterations: datatypes.UInt64Like | None = None, + ): + """ + Create a new instance of the ForceLink archetype. + + Parameters + ---------- + enabled: + Whether the force is enabled. + distance: + The target distance between two nodes. + iterations: + Specifies how often this force should be applied per iteration. + + Increasing this parameter can lead to better results at the cost of longer computation time. + + """ + + # You can define your own __init__ function as a member of ForceLinkExt in force_link_ext.py + with catch_and_log_exceptions(context=self.__class__.__name__): + self.__attrs_init__(enabled=enabled, distance=distance, iterations=iterations) + return + self.__attrs_clear__() + + def __attrs_clear__(self) -> None: + """Convenience method for calling `__attrs_init__` with all `None`s.""" + self.__attrs_init__( + enabled=None, # type: ignore[arg-type] + distance=None, # type: ignore[arg-type] + iterations=None, # type: ignore[arg-type] + ) + + @classmethod + def _clear(cls) -> ForceLink: + """Produce an empty ForceLink, bypassing `__init__`.""" + inst = cls.__new__(cls) + inst.__attrs_clear__() + return inst + + enabled: blueprint_components.EnabledBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.EnabledBatch._optional, # type: ignore[misc] + ) + # Whether the force is enabled. + # + # (Docstring intentionally commented out to hide this field from the docs) + + distance: blueprint_components.ForceDistanceBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.ForceDistanceBatch._optional, # type: ignore[misc] + ) + # The target distance between two nodes. + # + # (Docstring intentionally commented out to hide this field from the docs) + + iterations: blueprint_components.ForceIterationsBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.ForceIterationsBatch._optional, # type: ignore[misc] + ) + # Specifies how often this force should be applied per iteration. + # + # Increasing this parameter can lead to better results at the cost of longer computation time. + # + # (Docstring intentionally commented out to hide this field from the docs) + + __str__ = Archetype.__str__ + __repr__ = Archetype.__repr__ # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_many_body.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_many_body.py new file mode 100644 index 000000000000..4750ac834505 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_many_body.py @@ -0,0 +1,88 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_many_body.fbs". + +# You can extend this class by creating a "ForceManyBodyExt" class in "force_many_body_ext.py". + +from __future__ import annotations + +from typing import Any + +from attrs import define, field + +from ... import datatypes +from ..._baseclasses import ( + Archetype, +) +from ...blueprint import components as blueprint_components +from ...error_utils import catch_and_log_exceptions + +__all__ = ["ForceManyBody"] + + +@define(str=False, repr=False, init=False) +class ForceManyBody(Archetype): + """ + **Archetype**: A force between each pair of nodes that ressembles an electrical charge. + + If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. + """ + + def __init__( + self: Any, *, enabled: datatypes.BoolLike | None = None, strength: datatypes.Float64Like | None = None + ): + """ + Create a new instance of the ForceManyBody archetype. + + Parameters + ---------- + enabled: + Whether the force is enabled. + strength: + The strength of the force. + + If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. + + """ + + # You can define your own __init__ function as a member of ForceManyBodyExt in force_many_body_ext.py + with catch_and_log_exceptions(context=self.__class__.__name__): + self.__attrs_init__(enabled=enabled, strength=strength) + return + self.__attrs_clear__() + + def __attrs_clear__(self) -> None: + """Convenience method for calling `__attrs_init__` with all `None`s.""" + self.__attrs_init__( + enabled=None, # type: ignore[arg-type] + strength=None, # type: ignore[arg-type] + ) + + @classmethod + def _clear(cls) -> ForceManyBody: + """Produce an empty ForceManyBody, bypassing `__init__`.""" + inst = cls.__new__(cls) + inst.__attrs_clear__() + return inst + + enabled: blueprint_components.EnabledBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.EnabledBatch._optional, # type: ignore[misc] + ) + # Whether the force is enabled. + # + # (Docstring intentionally commented out to hide this field from the docs) + + strength: blueprint_components.ForceStrengthBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.ForceStrengthBatch._optional, # type: ignore[misc] + ) + # The strength of the force. + # + # If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together. + # + # (Docstring intentionally commented out to hide this field from the docs) + + __str__ = Archetype.__str__ + __repr__ = Archetype.__repr__ # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_position.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_position.py new file mode 100644 index 000000000000..61e63623c9c2 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/force_position.py @@ -0,0 +1,96 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/force_position.fbs". + +# You can extend this class by creating a "ForcePositionExt" class in "force_position_ext.py". + +from __future__ import annotations + +from typing import Any + +from attrs import define, field + +from ... import components, datatypes +from ..._baseclasses import ( + Archetype, +) +from ...blueprint import components as blueprint_components +from ...error_utils import catch_and_log_exceptions + +__all__ = ["ForcePosition"] + + +@define(str=False, repr=False, init=False) +class ForcePosition(Archetype): + """**Archetype**: Similar to gravity, this force pulls nodes towards a specific position.""" + + def __init__( + self: Any, + *, + enabled: datatypes.BoolLike | None = None, + strength: datatypes.Float64Like | None = None, + position: datatypes.Vec2DLike | None = None, + ): + """ + Create a new instance of the ForcePosition archetype. + + Parameters + ---------- + enabled: + Whether the force is enabled. + strength: + The strength of the force. + position: + The position where the nodes should be pulled towards. + + """ + + # You can define your own __init__ function as a member of ForcePositionExt in force_position_ext.py + with catch_and_log_exceptions(context=self.__class__.__name__): + self.__attrs_init__(enabled=enabled, strength=strength, position=position) + return + self.__attrs_clear__() + + def __attrs_clear__(self) -> None: + """Convenience method for calling `__attrs_init__` with all `None`s.""" + self.__attrs_init__( + enabled=None, # type: ignore[arg-type] + strength=None, # type: ignore[arg-type] + position=None, # type: ignore[arg-type] + ) + + @classmethod + def _clear(cls) -> ForcePosition: + """Produce an empty ForcePosition, bypassing `__init__`.""" + inst = cls.__new__(cls) + inst.__attrs_clear__() + return inst + + enabled: blueprint_components.EnabledBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.EnabledBatch._optional, # type: ignore[misc] + ) + # Whether the force is enabled. + # + # (Docstring intentionally commented out to hide this field from the docs) + + strength: blueprint_components.ForceStrengthBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.ForceStrengthBatch._optional, # type: ignore[misc] + ) + # The strength of the force. + # + # (Docstring intentionally commented out to hide this field from the docs) + + position: components.Position2DBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=components.Position2DBatch._optional, # type: ignore[misc] + ) + # The position where the nodes should be pulled towards. + # + # (Docstring intentionally commented out to hide this field from the docs) + + __str__ = Archetype.__str__ + __repr__ = Archetype.__repr__ # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes index 4fdcc51e8c50..6c5eeaa92aa6 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes @@ -11,8 +11,12 @@ column_share.py linguist-generated=true component_column_selector.py linguist-generated=true container_kind.py linguist-generated=true corner2d.py linguist-generated=true +enabled.py linguist-generated=true filter_by_range.py linguist-generated=true filter_is_not_null.py linguist-generated=true +force_distance.py linguist-generated=true +force_iterations.py linguist-generated=true +force_strength.py linguist-generated=true grid_columns.py linguist-generated=true grid_spacing.py linguist-generated=true included_content.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py index 18d213e617d7..d09f761a625d 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py @@ -11,8 +11,12 @@ from .component_column_selector import ComponentColumnSelector, ComponentColumnSelectorBatch from .container_kind import ContainerKind, ContainerKindArrayLike, ContainerKindBatch, ContainerKindLike from .corner2d import Corner2D, Corner2DArrayLike, Corner2DBatch, Corner2DLike +from .enabled import Enabled, EnabledBatch from .filter_by_range import FilterByRange, FilterByRangeBatch from .filter_is_not_null import FilterIsNotNull, FilterIsNotNullBatch +from .force_distance import ForceDistance, ForceDistanceBatch +from .force_iterations import ForceIterations, ForceIterationsBatch +from .force_strength import ForceStrength, ForceStrengthBatch from .grid_columns import GridColumns, GridColumnsBatch from .grid_spacing import GridSpacing, GridSpacingBatch from .included_content import IncludedContent, IncludedContentBatch @@ -63,10 +67,18 @@ "Corner2DArrayLike", "Corner2DBatch", "Corner2DLike", + "Enabled", + "EnabledBatch", "FilterByRange", "FilterByRangeBatch", "FilterIsNotNull", "FilterIsNotNullBatch", + "ForceDistance", + "ForceDistanceBatch", + "ForceIterations", + "ForceIterationsBatch", + "ForceStrength", + "ForceStrengthBatch", "GridColumns", "GridColumnsBatch", "GridSpacing", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/enabled.py b/rerun_py/rerun_sdk/rerun/blueprint/components/enabled.py new file mode 100644 index 000000000000..6487469df9bb --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/enabled.py @@ -0,0 +1,33 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/components/enabled.fbs". + +# You can extend this class by creating a "EnabledExt" class in "enabled_ext.py". + +from __future__ import annotations + +from ... import datatypes +from ..._baseclasses import ( + ComponentBatchMixin, + ComponentDescriptor, + ComponentMixin, +) + +__all__ = ["Enabled", "EnabledBatch"] + + +class Enabled(datatypes.Bool, ComponentMixin): + """**Component**: Whether a procedure is enabled.""" + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of EnabledExt in enabled_ext.py + + # Note: there are no fields here because Enabled delegates to datatypes.Bool + pass + + +class EnabledBatch(datatypes.BoolBatch, ComponentBatchMixin): + _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.Enabled") + + +# This is patched in late to avoid circular dependencies. +Enabled._BATCH_TYPE = EnabledBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/force_distance.py b/rerun_py/rerun_sdk/rerun/blueprint/components/force_distance.py new file mode 100644 index 000000000000..b0bb1069b160 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/force_distance.py @@ -0,0 +1,37 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/components/force_distance.fbs". + +# You can extend this class by creating a "ForceDistanceExt" class in "force_distance_ext.py". + +from __future__ import annotations + +from ... import datatypes +from ..._baseclasses import ( + ComponentBatchMixin, + ComponentDescriptor, + ComponentMixin, +) + +__all__ = ["ForceDistance", "ForceDistanceBatch"] + + +class ForceDistance(datatypes.Float64, ComponentMixin): + """ + **Component**: The target distance between two nodes. + + This is helpful to scale the layout, for example if long labels are involved. + """ + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of ForceDistanceExt in force_distance_ext.py + + # Note: there are no fields here because ForceDistance delegates to datatypes.Float64 + pass + + +class ForceDistanceBatch(datatypes.Float64Batch, ComponentBatchMixin): + _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.ForceDistance") + + +# This is patched in late to avoid circular dependencies. +ForceDistance._BATCH_TYPE = ForceDistanceBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/force_iterations.py b/rerun_py/rerun_sdk/rerun/blueprint/components/force_iterations.py new file mode 100644 index 000000000000..f9bf7f7a0e24 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/force_iterations.py @@ -0,0 +1,37 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/components/force_iterations.fbs". + +# You can extend this class by creating a "ForceIterationsExt" class in "force_iterations_ext.py". + +from __future__ import annotations + +from ... import datatypes +from ..._baseclasses import ( + ComponentBatchMixin, + ComponentDescriptor, + ComponentMixin, +) + +__all__ = ["ForceIterations", "ForceIterationsBatch"] + + +class ForceIterations(datatypes.UInt64, ComponentMixin): + """ + **Component**: Specifies how often this force should be applied per iteration. + + Increasing this parameter can lead to better results at the cost of longer computation time. + """ + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of ForceIterationsExt in force_iterations_ext.py + + # Note: there are no fields here because ForceIterations delegates to datatypes.UInt64 + pass + + +class ForceIterationsBatch(datatypes.UInt64Batch, ComponentBatchMixin): + _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.ForceIterations") + + +# This is patched in late to avoid circular dependencies. +ForceIterations._BATCH_TYPE = ForceIterationsBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/force_strength.py b/rerun_py/rerun_sdk/rerun/blueprint/components/force_strength.py new file mode 100644 index 000000000000..8a475f2d7bb4 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/force_strength.py @@ -0,0 +1,37 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/components/force_strength.fbs". + +# You can extend this class by creating a "ForceStrengthExt" class in "force_strength_ext.py". + +from __future__ import annotations + +from ... import datatypes +from ..._baseclasses import ( + ComponentBatchMixin, + ComponentDescriptor, + ComponentMixin, +) + +__all__ = ["ForceStrength", "ForceStrengthBatch"] + + +class ForceStrength(datatypes.Float64, ComponentMixin): + """ + **Component**: The strength of a given force. + + Allows to assign different weights to the individual forces, prioritizing one over the other. + """ + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of ForceStrengthExt in force_strength_ext.py + + # Note: there are no fields here because ForceStrength delegates to datatypes.Float64 + pass + + +class ForceStrengthBatch(datatypes.Float64Batch, ComponentBatchMixin): + _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.ForceStrength") + + +# This is patched in late to avoid circular dependencies. +ForceStrength._BATCH_TYPE = ForceStrengthBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/graph_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/graph_view.py index 4c43bc8e055d..753f74e416d1 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/graph_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/graph_view.py @@ -70,6 +70,11 @@ def __init__( defaults: list[Union[AsComponents, ComponentBatchLike]] = [], overrides: dict[EntityPathLike, list[ComponentBatchLike]] = {}, visual_bounds: blueprint_archetypes.VisualBounds2D | None = None, + force_link: blueprint_archetypes.ForceLink | None = None, + force_many_body: blueprint_archetypes.ForceManyBody | None = None, + force_position: blueprint_archetypes.ForcePosition | None = None, + force_collision_radius: blueprint_archetypes.ForceCollisionRadius | None = None, + force_center: blueprint_archetypes.ForceCenter | None = None, ) -> None: """ Construct a blueprint for a new GraphView view. @@ -104,6 +109,16 @@ def __init__( Everything within these bounds is guaranteed to be visible. Somethings outside of these bounds may also be visible due to letterboxing. + force_link: + Allows to control the interaction between two nodes connected by an edge. + force_many_body: + A force between each pair of nodes that ressembles an electrical charge. + force_position: + Similar to gravity, this force pulls nodes towards a specific position. + force_collision_radius: + Resolves collisions between the bounding spheres, according to the radius of the nodes. + force_center: + Tries to move the center of mass of the graph to the origin. """ @@ -113,6 +128,31 @@ def __init__( visual_bounds = blueprint_archetypes.VisualBounds2D(visual_bounds) properties["VisualBounds2D"] = visual_bounds + if force_link is not None: + if not isinstance(force_link, blueprint_archetypes.ForceLink): + force_link = blueprint_archetypes.ForceLink(force_link) + properties["ForceLink"] = force_link + + if force_many_body is not None: + if not isinstance(force_many_body, blueprint_archetypes.ForceManyBody): + force_many_body = blueprint_archetypes.ForceManyBody(force_many_body) + properties["ForceManyBody"] = force_many_body + + if force_position is not None: + if not isinstance(force_position, blueprint_archetypes.ForcePosition): + force_position = blueprint_archetypes.ForcePosition(force_position) + properties["ForcePosition"] = force_position + + if force_collision_radius is not None: + if not isinstance(force_collision_radius, blueprint_archetypes.ForceCollisionRadius): + force_collision_radius = blueprint_archetypes.ForceCollisionRadius(force_collision_radius) + properties["ForceCollisionRadius"] = force_collision_radius + + if force_center is not None: + if not isinstance(force_center, blueprint_archetypes.ForceCenter): + force_center = blueprint_archetypes.ForceCenter(force_center) + properties["ForceCenter"] = force_center + super().__init__( class_identifier="Graph", origin=origin, diff --git a/tests/python/release_checklist/check_graph_time_layout.py b/tests/python/release_checklist/check_graph_time_layout.py index 3d469e1b72c5..e10bde1053a5 100644 --- a/tests/python/release_checklist/check_graph_time_layout.py +++ b/tests/python/release_checklist/check_graph_time_layout.py @@ -1,5 +1,6 @@ from __future__ import annotations +# TODO(grtlr): Promote to example import os import random from argparse import Namespace @@ -8,6 +9,13 @@ import rerun as rr import rerun.blueprint as rrb +# TODO(grtlr): Clean up the exports +from rerun.blueprint.archetypes.force_collision_radius import ForceCollisionRadius +from rerun.blueprint.archetypes.force_link import ForceLink +from rerun.blueprint.archetypes.force_many_body import ForceManyBody +from rerun.components.color import Color +from rerun.components.show_labels import ShowLabels + README = """\ # Time-varying graph view @@ -18,6 +26,18 @@ * Scrub the timeline to see how the graph layout changes over time. """ +color_scheme = [ + Color([228, 26, 28]), # Red + Color([55, 126, 184]), # Blue + Color([77, 175, 74]), # Green + Color([152, 78, 163]), # Purple + Color([255, 127, 0]), # Orange + Color([255, 255, 51]), # Yellow + Color([166, 86, 40]), # Brown + Color([247, 129, 191]), # Pink + Color([153, 153, 153]), # Gray +] + def log_readme() -> None: rr.log("readme", rr.TextDocument(README, media_type=rr.MediaType.MARKDOWN), static=True) @@ -25,22 +45,50 @@ def log_readme() -> None: def log_graphs() -> None: nodes = ["root"] + radii = [42] + colors = [Color([81, 81, 81])] edges = [] + # We want reproducible results + random.seed(42) + # Randomly add nodes and edges to the graph for i in range(50): existing = random.choice(nodes) new_node = str(i) nodes.append(new_node) + radii.append(random.randint(10, 50)) + colors.append(random.choice(color_scheme)) edges.append((existing, new_node)) rr.set_time_sequence("frame", i) - rr.log("graph", rr.GraphNodes(nodes, labels=nodes), rr.GraphEdges(edges, graph_type=rr.GraphType.Directed)) + rr.log( + "node_link", + rr.GraphNodes(nodes, labels=nodes, radii=radii, colors=colors), + rr.GraphEdges(edges, graph_type=rr.GraphType.Directed), + ) + rr.log( + "bubble_chart", + rr.GraphNodes(nodes, labels=nodes, radii=radii, colors=colors), + ) rr.send_blueprint( rrb.Blueprint( rrb.Grid( - rrb.GraphView(origin="graph", name="Graph"), + rrb.GraphView( + origin="node_link", + name="Node-link diagram", + force_link=ForceLink(distance=60), + force_many_body=ForceManyBody(strength=-60), + ), + rrb.GraphView( + origin="bubble_chart", + name="Bubble chart", + force_link=ForceLink(enabled=False), + force_many_body=ForceManyBody(enabled=False), + force_collision_radius=ForceCollisionRadius(enabled=True), + defaults=[ShowLabels(False)], + ), rrb.TextDocumentView(origin="readme", name="Instructions"), ) ) From e67b84a1afb8daeb5dd5cbd054c5bfda175eabf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= Date: Tue, 10 Dec 2024 14:41:39 +0100 Subject: [PATCH 10/71] Untangle `re_protos` dependencies (#8381) --- Cargo.lock | 10 +- crates/build/re_protos_builder/README.md | 2 +- .../src/bin/build_re_remote_store_types.rs | 2 +- crates/build/re_protos_builder/src/lib.rs | 18 +- crates/store/re_chunk_store/Cargo.toml | 3 +- crates/store/re_chunk_store/src/dataframe.rs | 39 +- crates/store/re_chunk_store/src/lib.rs | 2 + .../src/protobuf_conversions.rs | 340 +++++++++++++ crates/store/re_grpc_client/Cargo.toml | 3 +- crates/store/re_grpc_client/src/lib.rs | 10 +- crates/store/re_log_encoding/Cargo.toml | 2 + crates/store/re_log_encoding/src/codec/mod.rs | 37 ++ .../src/codec/wire.rs} | 96 ++-- crates/store/re_log_encoding/src/lib.rs | 2 + crates/store/re_log_types/Cargo.toml | 2 + crates/store/re_log_types/src/lib.rs | 2 + .../re_log_types/src/protobuf_conversions.rs | 191 +++++++ crates/store/re_protos/Cargo.toml | 4 - crates/store/re_protos/README.md | 2 +- .../re_protos/proto/rerun/v0/common.proto | 30 +- .../proto/rerun/v0/remote_store.proto | 20 +- crates/store/re_protos/src/lib.rs | 473 ++---------------- .../store/re_protos/src/v0/rerun.common.v0.rs | 302 +++++++++++ .../re_protos/src/v0/rerun.remote_store.v0.rs | 272 +--------- crates/utils/re_tuid/Cargo.toml | 2 + crates/utils/re_tuid/src/lib.rs | 2 + .../utils/re_tuid/src/protobuf_conversions.rs | 17 + pixi.toml | 6 +- rerun_py/Cargo.toml | 1 + rerun_py/src/remote.rs | 10 +- scripts/lint.py | 2 +- 31 files changed, 1124 insertions(+), 780 deletions(-) create mode 100644 crates/store/re_chunk_store/src/protobuf_conversions.rs create mode 100644 crates/store/re_log_encoding/src/codec/mod.rs rename crates/store/{re_protos/src/codec.rs => re_log_encoding/src/codec/wire.rs} (74%) create mode 100644 crates/store/re_log_types/src/protobuf_conversions.rs create mode 100644 crates/store/re_protos/src/v0/rerun.common.v0.rs create mode 100644 crates/utils/re_tuid/src/protobuf_conversions.rs diff --git a/Cargo.lock b/Cargo.lock index f41c6edc923b..69fa505685e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5659,6 +5659,7 @@ dependencies = [ "re_log", "re_log_encoding", "re_log_types", + "re_protos", "re_tracing", "re_types", "re_types_core", @@ -5927,6 +5928,7 @@ dependencies = [ "re_chunk", "re_error", "re_log", + "re_log_encoding", "re_log_types", "re_protos", "re_smart_channel", @@ -5973,10 +5975,12 @@ dependencies = [ "lz4_flex", "mimalloc", "parking_lot", + "re_arrow2", "re_build_info", "re_chunk", "re_log", "re_log_types", + "re_protos", "re_smart_channel", "re_tracing", "re_types", @@ -6012,6 +6016,7 @@ dependencies = [ "re_build_info", "re_format", "re_log", + "re_protos", "re_string_interner", "re_tracing", "re_tuid", @@ -6077,9 +6082,6 @@ name = "re_protos" version = "0.21.0-alpha.1+dev" dependencies = [ "prost", - "re_arrow2", - "re_dataframe", - "re_log_types", "thiserror", "tonic", "tonic-web-wasm-client", @@ -6613,6 +6615,7 @@ dependencies = [ "document-features", "getrandom", "once_cell", + "re_protos", "serde", "web-time", ] @@ -7271,6 +7274,7 @@ dependencies = [ "re_chunk_store", "re_dataframe", "re_log", + "re_log_encoding", "re_log_types", "re_memory", "re_protos", diff --git a/crates/build/re_protos_builder/README.md b/crates/build/re_protos_builder/README.md index 25efb2a62361..a14aebe934e0 100644 --- a/crates/build/re_protos_builder/README.md +++ b/crates/build/re_protos_builder/README.md @@ -9,4 +9,4 @@ Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. Code generation for Rerun's Protobuf and gRPC definitions. -You can generate the code with `pixi run codegen-rstore`. +You can generate the code with `pixi run codegen-protos`. diff --git a/crates/build/re_protos_builder/src/bin/build_re_remote_store_types.rs b/crates/build/re_protos_builder/src/bin/build_re_remote_store_types.rs index 9afb8c37f9bf..cbb6b8fea943 100644 --- a/crates/build/re_protos_builder/src/bin/build_re_remote_store_types.rs +++ b/crates/build/re_protos_builder/src/bin/build_re_remote_store_types.rs @@ -1,6 +1,6 @@ //! This binary runs the remote store gRPC service codegen manually. //! -//! It is easiest to call this using `pixi run codegen-rstore`, +//! It is easiest to call this using `pixi run codegen-protos`, //! which will set up the necessary tools. #![allow(clippy::unwrap_used)] diff --git a/crates/build/re_protos_builder/src/lib.rs b/crates/build/re_protos_builder/src/lib.rs index 30315aa559ec..a1d2f744e1a0 100644 --- a/crates/build/re_protos_builder/src/lib.rs +++ b/crates/build/re_protos_builder/src/lib.rs @@ -3,24 +3,34 @@ //! definitions in the same file. //! -#![allow(clippy::unwrap_used)] +#![allow(clippy::unwrap_used, clippy::exit)] use std::path::Path; /// Generate rust from protobuf definitions. We rely on `tonic_build` to do the heavy lifting. /// `tonic_build` relies on `prost` which itself relies on `protoc`. /// -/// Note: make sure to invoke this via `pixi run codegen-rstore` in order to use the right `protoc` version. +/// Note: make sure to invoke this via `pixi run codegen-protos` in order to use the right `protoc` version. pub fn generate_rust_code( definitions_dir: impl AsRef, proto_paths: &[impl AsRef], output_dir: impl AsRef, ) { - tonic_build::configure() + if let Err(err) = tonic_build::configure() .out_dir(output_dir.as_ref()) .build_client(true) .build_server(true) .build_transport(false) // Small convenience, but doesn't work on web .compile_protos(proto_paths, &[definitions_dir]) - .unwrap(); + { + match err.kind() { + std::io::ErrorKind::Other => { + eprintln!("Failed to generate protobuf types:\n{err}"); + std::process::exit(1); + } + _ => { + panic!("{err:?}"); + } + } + } } diff --git a/crates/store/re_chunk_store/Cargo.toml b/crates/store/re_chunk_store/Cargo.toml index 4e9a6a9ab126..dde2529fa031 100644 --- a/crates/store/re_chunk_store/Cargo.toml +++ b/crates/store/re_chunk_store/Cargo.toml @@ -25,7 +25,6 @@ default = [] ## Enables `parking_lot`'s deadlock detection background thread. deadlock_detection = ["parking_lot/deadlock_detection"] - [dependencies] # Rerun dependencies: re_chunk.workspace = true @@ -33,9 +32,11 @@ re_format.workspace = true re_log = { workspace = true, features = ["setup"] } re_log_encoding = { workspace = true, features = ["decoder"] } re_log_types.workspace = true +re_protos.workspace = true re_tracing.workspace = true re_types_core.workspace = true + # External dependencies: ahash.workspace = true anyhow.workspace = true diff --git a/crates/store/re_chunk_store/src/dataframe.rs b/crates/store/re_chunk_store/src/dataframe.rs index d84ce2dc86f8..2075d14f878e 100644 --- a/crates/store/re_chunk_store/src/dataframe.rs +++ b/crates/store/re_chunk_store/src/dataframe.rs @@ -1,6 +1,8 @@ //! All the APIs used specifically for `re_dataframe`. use std::collections::{BTreeMap, BTreeSet}; +use std::ops::Deref; +use std::ops::DerefMut; use arrow2::{ array::ListArray as ArrowListArray, @@ -10,9 +12,7 @@ use itertools::Itertools; use re_chunk::TimelineName; use re_log_types::{ComponentPath, EntityPath, ResolvedTimeRange, TimeInt, Timeline}; -use re_types_core::{ - ArchetypeFieldName, ArchetypeName, ComponentDescriptor, ComponentName, ComponentNameSet, -}; +use re_types_core::{ArchetypeFieldName, ArchetypeName, ComponentDescriptor, ComponentName}; use crate::{ChunkStore, ColumnMetadata}; @@ -493,7 +493,38 @@ impl std::fmt::Display for SparseFillStrategy { /// // TODO(cmc): we need to be able to build that easily in a command-line context, otherwise it's just // very annoying. E.g. `--with /world/points:[rr.Position3D, rr.Radius] --with /cam:[rr.Pinhole]`. -pub type ViewContentsSelector = BTreeMap>; +#[derive(Default, Debug, Clone, PartialEq, Eq, Hash)] +pub struct ViewContentsSelector(pub BTreeMap>>); + +impl ViewContentsSelector { + pub fn into_inner(self) -> BTreeMap>> { + self.0 + } +} + +impl Deref for ViewContentsSelector { + type Target = BTreeMap>>; + + #[inline] + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl DerefMut for ViewContentsSelector { + #[inline] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +impl FromIterator<(EntityPath, Option>)> for ViewContentsSelector { + fn from_iter>)>>( + iter: T, + ) -> Self { + Self(iter.into_iter().collect()) + } +} // TODO(cmc): Ultimately, this shouldn't be hardcoded to `Timeline`, but to a generic `I: Index`. // `Index` in this case should also be implemented on tuples (`(I1, I2, ...)`). diff --git a/crates/store/re_chunk_store/src/lib.rs b/crates/store/re_chunk_store/src/lib.rs index d4c69adb3ae1..061a07818d4b 100644 --- a/crates/store/re_chunk_store/src/lib.rs +++ b/crates/store/re_chunk_store/src/lib.rs @@ -24,6 +24,8 @@ mod store; mod subscribers; mod writes; +mod protobuf_conversions; + pub use self::dataframe::{ ColumnDescriptor, ColumnSelector, ComponentColumnDescriptor, ComponentColumnSelector, Index, IndexRange, IndexValue, QueryExpression, SparseFillStrategy, TimeColumnDescriptor, diff --git a/crates/store/re_chunk_store/src/protobuf_conversions.rs b/crates/store/re_chunk_store/src/protobuf_conversions.rs new file mode 100644 index 000000000000..67ef038284e0 --- /dev/null +++ b/crates/store/re_chunk_store/src/protobuf_conversions.rs @@ -0,0 +1,340 @@ +use std::collections::BTreeMap; +use std::collections::BTreeSet; + +use re_protos::TypeConversionError; + +impl TryFrom for crate::ComponentColumnSelector { + type Error = TypeConversionError; + + fn try_from( + value: re_protos::common::v0::ComponentColumnSelector, + ) -> Result { + let entity_path = value + .entity_path + .ok_or(TypeConversionError::missing_field( + "rerun.common.v0.ComponentColumnSelector", + "entity_path", + ))? + .try_into()?; + + let component_name = value + .component + .ok_or(TypeConversionError::missing_field( + "rerun.common.v0.ComponentColumnSelector", + "component", + ))? + .name; + + Ok(Self { + entity_path, + component_name, + }) + } +} + +impl TryFrom for crate::TimeColumnSelector { + type Error = TypeConversionError; + + fn try_from(value: re_protos::common::v0::TimeColumnSelector) -> Result { + let timeline = value.timeline.ok_or(TypeConversionError::missing_field( + "rerun.common.v0.TimeColumnSelector", + "timeline", + ))?; + + Ok(Self { + timeline: timeline.name.into(), + }) + } +} + +impl TryFrom for crate::ColumnSelector { + type Error = TypeConversionError; + + fn try_from(value: re_protos::common::v0::ColumnSelector) -> Result { + match value + .selector_type + .ok_or(TypeConversionError::missing_field( + "rerun.common.v0.ColumnSelector", + "selector_type", + ))? { + re_protos::common::v0::column_selector::SelectorType::ComponentColumn( + component_column_selector, + ) => { + let selector: crate::ComponentColumnSelector = + component_column_selector.try_into()?; + Ok(selector.into()) + } + re_protos::common::v0::column_selector::SelectorType::TimeColumn( + time_column_selector, + ) => { + let selector: crate::TimeColumnSelector = time_column_selector.try_into()?; + + Ok(selector.into()) + } + } + } +} + +impl From for re_protos::common::v0::ColumnSelector { + fn from(value: crate::ColumnSelector) -> Self { + match value { + crate::ColumnSelector::Component(ccs) => Self { + selector_type: Some( + re_protos::common::v0::column_selector::SelectorType::ComponentColumn( + re_protos::common::v0::ComponentColumnSelector { + entity_path: Some(ccs.entity_path.into()), + component: Some(re_protos::common::v0::Component { + name: ccs.component_name, + }), + }, + ), + ), + }, + crate::ColumnSelector::Time(tcs) => Self { + selector_type: Some( + re_protos::common::v0::column_selector::SelectorType::TimeColumn( + re_protos::common::v0::TimeColumnSelector { + timeline: Some(re_protos::common::v0::Timeline { + name: tcs.timeline.to_string(), + }), + }, + ), + ), + }, + } + } +} + +impl TryFrom for crate::ViewContentsSelector { + type Error = TypeConversionError; + + fn try_from(value: re_protos::common::v0::ViewContents) -> Result { + value + .contents + .into_iter() + .map(|part| { + let entity_path: re_log_types::EntityPath = part + .path + .ok_or(TypeConversionError::missing_field( + "rerun.common.v0.ViewContentsPart", + "path", + ))? + .try_into()?; + let column_selector = part.components.map(|cs| { + cs.components + .into_iter() + .map(|c| re_chunk::ComponentName::new(&c.name)) + .collect::>() + }); + Ok((entity_path, column_selector)) + }) + .collect::, Self::Error>>() + .map(crate::ViewContentsSelector) + } +} + +impl TryFrom for crate::QueryExpression { + type Error = TypeConversionError; + + fn try_from(value: re_protos::common::v0::Query) -> Result { + let filtered_index = value + .filtered_index + .ok_or(TypeConversionError::missing_field( + "rerun.common.v0.Query", + "filtered_index", + ))? + .try_into()?; + + let selection = value + .column_selection + .map(|cs| { + cs.columns + .into_iter() + .map(crate::ColumnSelector::try_from) + .collect::, _>>() + }) + .transpose()?; + + let filtered_is_not_null = value + .filtered_is_not_null + .map(crate::ComponentColumnSelector::try_from) + .transpose()?; + + Ok(Self { + view_contents: value.view_contents.map(|vc| vc.try_into()).transpose()?, + include_semantically_empty_columns: value.include_semantically_empty_columns, + include_indicator_columns: value.include_indicator_columns, + include_tombstone_columns: value.include_tombstone_columns, + filtered_index: Some(filtered_index), + filtered_index_range: value + .filtered_index_range + .map(|ir| ir.try_into()) + .transpose()?, + filtered_index_values: value + .filtered_index_values + .map(|iv| iv.time_points.into_iter().map(|v| v.into()).collect()), + using_index_values: value + .using_index_values + .map(|uiv| uiv.time_points.into_iter().map(|v| v.into()).collect()), + filtered_is_not_null, + sparse_fill_strategy: crate::SparseFillStrategy::default(), // TODO(zehiko) implement support for sparse fill strategy + selection, + }) + } +} + +impl From for re_protos::common::v0::Query { + fn from(value: crate::QueryExpression) -> Self { + Self { + view_contents: value + .view_contents + .map(|vc| { + vc.into_inner() + .into_iter() + .map( + |(path, components)| re_protos::common::v0::ViewContentsPart { + path: Some(path.into()), + components: components.map(|cs| { + re_protos::common::v0::ComponentsSet { + components: cs + .into_iter() + .map(|c| re_protos::common::v0::Component { + name: c.to_string(), + }) + .collect(), + } + }), + }, + ) + .collect::>() + }) + .map(|cs| re_protos::common::v0::ViewContents { contents: cs }), + include_semantically_empty_columns: value.include_semantically_empty_columns, + include_indicator_columns: value.include_indicator_columns, + include_tombstone_columns: value.include_tombstone_columns, + filtered_index: value.filtered_index.map(|timeline| { + re_protos::common::v0::IndexColumnSelector { + timeline: Some(re_protos::common::v0::Timeline { + name: timeline.name().to_string(), + }), + } + }), + filtered_index_range: value.filtered_index_range.map(|ir| { + re_protos::common::v0::IndexRange { + time_range: Some(ir.into()), + } + }), + filtered_index_values: value.filtered_index_values.map(|iv| { + re_protos::common::v0::IndexValues { + time_points: iv + .into_iter() + // TODO(zehiko) is this desired behavior for TimeInt::STATIC? + .map(|v| re_protos::common::v0::TimeInt { time: v.as_i64() }) + .collect(), + } + }), + using_index_values: value.using_index_values.map(|uiv| { + re_protos::common::v0::IndexValues { + time_points: uiv + .into_iter() + .map(|v| re_protos::common::v0::TimeInt { time: v.as_i64() }) + .collect(), + } + }), + filtered_is_not_null: value.filtered_is_not_null.map(|cs| { + re_protos::common::v0::ComponentColumnSelector { + entity_path: Some(cs.entity_path.into()), + component: Some(re_protos::common::v0::Component { + name: cs.component_name, + }), + } + }), + column_selection: value + .selection + .map(|cs| re_protos::common::v0::ColumnSelection { + columns: cs.into_iter().map(|c| c.into()).collect(), + }), + sparse_fill_strategy: re_protos::common::v0::SparseFillStrategy::None.into(), // TODO(zehiko) implement + } + } +} + +#[cfg(test)] +mod tests { + use re_protos::common::v0::{ + column_selector::SelectorType, ColumnSelection, ColumnSelector, Component, + ComponentColumnSelector, ComponentsSet, EntityPath, IndexColumnSelector, IndexRange, + IndexValues, Query, SparseFillStrategy, TimeInt, TimeRange, Timeline, ViewContents, + ViewContentsPart, + }; + + #[test] + pub fn test_query_conversion() { + let grpc_query_before = Query { + view_contents: Some(ViewContents { + contents: vec![ViewContentsPart { + path: Some(EntityPath { + path: "/somepath".to_owned(), + }), + components: Some(ComponentsSet { + components: vec![Component { + name: "component".to_owned(), + }], + }), + }], + }), + include_indicator_columns: false, + include_semantically_empty_columns: true, + include_tombstone_columns: true, + filtered_index: Some(IndexColumnSelector { + timeline: Some(Timeline { + name: "log_time".to_owned(), + }), + }), + filtered_index_range: Some(IndexRange { + time_range: Some(TimeRange { start: 0, end: 100 }), + }), + filtered_index_values: Some(IndexValues { + time_points: vec![ + TimeInt { time: 0 }, + TimeInt { time: 1 }, + TimeInt { time: 2 }, + ], + }), + using_index_values: Some(IndexValues { + time_points: vec![ + TimeInt { time: 3 }, + TimeInt { time: 4 }, + TimeInt { time: 5 }, + ], + }), + filtered_is_not_null: Some(ComponentColumnSelector { + entity_path: Some(EntityPath { + path: "/somepath/c".to_owned(), + }), + component: Some(Component { + name: "component".to_owned(), + }), + }), + column_selection: Some(ColumnSelection { + columns: vec![ColumnSelector { + selector_type: Some(SelectorType::ComponentColumn(ComponentColumnSelector { + entity_path: Some(EntityPath { + path: "/somepath/c".to_owned(), + }), + component: Some(Component { + name: "component".to_owned(), + }), + })), + }], + }), + sparse_fill_strategy: SparseFillStrategy::None.into(), + }; + + let query_expression_native: crate::QueryExpression = + grpc_query_before.clone().try_into().unwrap(); + let grpc_query_after = query_expression_native.into(); + + assert_eq!(grpc_query_before, grpc_query_after); + } +} diff --git a/crates/store/re_grpc_client/Cargo.toml b/crates/store/re_grpc_client/Cargo.toml index 415007b9683e..665e7fc6faa9 100644 --- a/crates/store/re_grpc_client/Cargo.toml +++ b/crates/store/re_grpc_client/Cargo.toml @@ -22,8 +22,9 @@ all-features = true [dependencies] re_chunk.workspace = true re_error.workspace = true -re_log_types.workspace = true re_log.workspace = true +re_log_encoding.workspace = true +re_log_types.workspace = true re_protos.workspace = true re_smart_channel.workspace = true diff --git a/crates/store/re_grpc_client/src/lib.rs b/crates/store/re_grpc_client/src/lib.rs index 12a4ca5da1b3..478312bb6aaa 100644 --- a/crates/store/re_grpc_client/src/lib.rs +++ b/crates/store/re_grpc_client/src/lib.rs @@ -10,15 +10,13 @@ use url::Url; use std::error::Error; use re_chunk::Chunk; +use re_log_encoding::codec::{wire::decode, CodecError}; use re_log_types::{ ApplicationId, LogMsg, SetStoreInfo, StoreId, StoreInfo, StoreKind, StoreSource, Time, }; -use re_protos::{ - codec::{decode, CodecError}, - v0::{ - storage_node_client::StorageNodeClient, FetchRecordingRequest, QueryCatalogRequest, - RecordingId, - }, +use re_protos::common::v0::RecordingId; +use re_protos::remote_store::v0::{ + storage_node_client::StorageNodeClient, FetchRecordingRequest, QueryCatalogRequest, }; // ---------------------------------------------------------------------------- diff --git a/crates/store/re_log_encoding/Cargo.toml b/crates/store/re_log_encoding/Cargo.toml index 721b42462c08..5fd58ed1ae61 100644 --- a/crates/store/re_log_encoding/Cargo.toml +++ b/crates/store/re_log_encoding/Cargo.toml @@ -46,10 +46,12 @@ re_build_info.workspace = true re_chunk.workspace = true re_log_types.workspace = true re_log.workspace = true +re_protos.workspace = true re_smart_channel.workspace = true re_tracing.workspace = true # External: +arrow2.workspace = true parking_lot.workspace = true thiserror.workspace = true diff --git a/crates/store/re_log_encoding/src/codec/mod.rs b/crates/store/re_log_encoding/src/codec/mod.rs new file mode 100644 index 000000000000..c332217e0e04 --- /dev/null +++ b/crates/store/re_log_encoding/src/codec/mod.rs @@ -0,0 +1,37 @@ +pub mod wire; + +#[derive(Debug, thiserror::Error)] +pub enum CodecError { + #[error("Arrow serialization error: {0}")] + ArrowSerialization(arrow2::error::Error), + + #[error("Failed to decode message header {0}")] + HeaderDecoding(std::io::Error), + + #[error("Failed to encode message header {0}")] + HeaderEncoding(std::io::Error), + + #[error("Missing record batch")] + MissingRecordBatch, + + #[error("Unexpected stream state")] + UnexpectedStreamState, + + #[error("Unsupported encoding, expected Arrow IPC")] + UnsupportedEncoding, + + #[error("Invalid file header")] + InvalidFileHeader, + + #[error("Unknown message header")] + UnknownMessageHeader, + + #[error("Invalid message header")] + InvalidMessageHeader, + + #[error("Unknown message kind {0}")] + UnknownMessageKind(u8), + + #[error("Invalid argument: {0}")] + InvalidArgument(String), +} diff --git a/crates/store/re_protos/src/codec.rs b/crates/store/re_log_encoding/src/codec/wire.rs similarity index 74% rename from crates/store/re_protos/src/codec.rs rename to crates/store/re_log_encoding/src/codec/wire.rs index eca6c16ad0ae..e0b0daabd1d1 100644 --- a/crates/store/re_protos/src/codec.rs +++ b/crates/store/re_log_encoding/src/codec/wire.rs @@ -1,47 +1,22 @@ -use arrow2::array::Array as Arrow2Array; use arrow2::chunk::Chunk as Arrow2Chunk; use arrow2::datatypes::Schema as Arrow2Schema; -use arrow2::error::Error as Arrow2Error; -use arrow2::io::ipc::{read, write}; -use re_dataframe::TransportChunk; +use arrow2::io::ipc; +use re_chunk::Arrow2Array; +use re_chunk::TransportChunk; -use crate::v0::EncoderVersion; - -#[derive(Debug, thiserror::Error)] -pub enum CodecError { - #[error("Arrow serialization error: {0}")] - ArrowSerialization(Arrow2Error), - - #[error("Failed to decode message header {0}")] - HeaderDecoding(std::io::Error), - - #[error("Failed to encode message header {0}")] - HeaderEncoding(std::io::Error), - - #[error("Missing record batch")] - MissingRecordBatch, - - #[error("Unexpected stream state")] - UnexpectedStreamState, - - #[error("Unknown message header")] - UnknownMessageHeader, - - #[error("Invalid argument: {0}")] - InvalidArgument(String), -} +use super::CodecError; #[derive(Clone, Copy, PartialEq, Eq, Hash, Default)] -pub struct MessageHader(pub u8); +pub struct MessageHeader(pub u8); -impl MessageHader { +impl MessageHeader { pub const NO_DATA: Self = Self(1); pub const RECORD_BATCH: Self = Self(2); pub const SIZE_BYTES: usize = 1; } -impl MessageHader { +impl MessageHeader { fn decode(read: &mut impl std::io::Read) -> Result { let mut buffer = [0_u8; Self::SIZE_BYTES]; read.read_exact(&mut buffer) @@ -72,12 +47,12 @@ impl TransportMessageV0 { match self { Self::NoData => { let mut data: Vec = Vec::new(); - MessageHader::NO_DATA.encode(&mut data)?; + MessageHeader::NO_DATA.encode(&mut data)?; Ok(data) } Self::RecordBatch(chunk) => { let mut data: Vec = Vec::new(); - MessageHader::RECORD_BATCH.encode(&mut data)?; + MessageHeader::RECORD_BATCH.encode(&mut data)?; write_arrow_to_bytes(&mut data, &chunk.schema, &chunk.data)?; @@ -88,11 +63,11 @@ impl TransportMessageV0 { fn from_bytes(data: &[u8]) -> Result { let mut reader = std::io::Cursor::new(data); - let header = MessageHader::decode(&mut reader)?; + let header = MessageHeader::decode(&mut reader)?; match header { - MessageHader::NO_DATA => Ok(Self::NoData), - MessageHader::RECORD_BATCH => { + MessageHeader::NO_DATA => Ok(Self::NoData), + MessageHeader::RECORD_BATCH => { let (schema, data) = read_arrow_from_bytes(&mut reader)?; let tc = TransportChunk { @@ -111,24 +86,32 @@ impl TransportMessageV0 { // of sending schema in each transport message for the same stream of batches. This will require codec // to become stateful and keep track if schema was sent / received. /// Encode a transport chunk into a byte stream. -pub fn encode(version: EncoderVersion, chunk: TransportChunk) -> Result, CodecError> { +pub fn encode( + version: re_protos::common::v0::EncoderVersion, + chunk: TransportChunk, +) -> Result, CodecError> { match version { - EncoderVersion::V0 => TransportMessageV0::RecordBatch(chunk).to_bytes(), + re_protos::common::v0::EncoderVersion::V0 => { + TransportMessageV0::RecordBatch(chunk).to_bytes() + } } } /// Encode a `NoData` message into a byte stream. This can be used by the remote store /// (i.e. data producer) to signal back to the client that there's no data available. -pub fn no_data(version: EncoderVersion) -> Result, CodecError> { +pub fn no_data(version: re_protos::common::v0::EncoderVersion) -> Result, CodecError> { match version { - EncoderVersion::V0 => TransportMessageV0::NoData.to_bytes(), + re_protos::common::v0::EncoderVersion::V0 => TransportMessageV0::NoData.to_bytes(), } } /// Decode transport data from a byte stream - if there's a record batch present, return it, otherwise return `None`. -pub fn decode(version: EncoderVersion, data: &[u8]) -> Result, CodecError> { +pub fn decode( + version: re_protos::common::v0::EncoderVersion, + data: &[u8], +) -> Result, CodecError> { match version { - EncoderVersion::V0 => { + re_protos::common::v0::EncoderVersion::V0 => { let msg = TransportMessageV0::from_bytes(data)?; match msg { TransportMessageV0::RecordBatch(chunk) => Ok(Some(chunk)), @@ -140,13 +123,13 @@ pub fn decode(version: EncoderVersion, data: &[u8]) -> Result( +pub fn write_arrow_to_bytes( writer: &mut W, schema: &Arrow2Schema, data: &Arrow2Chunk>, ) -> Result<(), CodecError> { - let options = write::WriteOptions { compression: None }; - let mut sw = write::StreamWriter::new(writer, options); + let options = ipc::write::WriteOptions { compression: None }; + let mut sw = ipc::write::StreamWriter::new(writer, options); sw.start(schema, None) .map_err(CodecError::ArrowSerialization)?; @@ -159,11 +142,12 @@ fn write_arrow_to_bytes( /// Helper function that deserializes raw bytes into arrow schema and record batch /// using Arrow IPC format. -fn read_arrow_from_bytes( +pub fn read_arrow_from_bytes( reader: &mut R, ) -> Result<(Arrow2Schema, Arrow2Chunk>), CodecError> { - let metadata = read::read_stream_metadata(reader).map_err(CodecError::ArrowSerialization)?; - let mut stream = read::StreamReader::new(reader, metadata, None); + let metadata = + ipc::read::read_stream_metadata(reader).map_err(CodecError::ArrowSerialization)?; + let mut stream = ipc::read::StreamReader::new(reader, metadata, None); let schema = stream.schema().clone(); // there should be at least one record batch in the stream @@ -173,20 +157,20 @@ fn read_arrow_from_bytes( .map_err(CodecError::ArrowSerialization)?; match stream_state { - read::StreamState::Waiting => Err(CodecError::UnexpectedStreamState), - read::StreamState::Some(chunk) => Ok((schema, chunk)), + ipc::read::StreamState::Waiting => Err(CodecError::UnexpectedStreamState), + ipc::read::StreamState::Some(chunk) => Ok((schema, chunk)), } } #[cfg(test)] mod tests { - use re_dataframe::external::re_chunk::{Chunk, RowId}; - use re_log_types::{example_components::MyPoint, Timeline}; - use crate::{ - codec::{decode, encode, CodecError, TransportMessageV0}, - v0::EncoderVersion, + codec::wire::{decode, encode, TransportMessageV0}, + codec::CodecError, }; + use re_chunk::{Chunk, RowId}; + use re_log_types::{example_components::MyPoint, Timeline}; + use re_protos::common::v0::EncoderVersion; fn get_test_chunk() -> Chunk { let row_id1 = RowId::new(); diff --git a/crates/store/re_log_encoding/src/lib.rs b/crates/store/re_log_encoding/src/lib.rs index 2f62a6675d75..fb0cbbbfe5b7 100644 --- a/crates/store/re_log_encoding/src/lib.rs +++ b/crates/store/re_log_encoding/src/lib.rs @@ -5,6 +5,8 @@ pub mod decoder; #[cfg(feature = "encoder")] pub mod encoder; +pub mod codec; + #[cfg(feature = "encoder")] #[cfg(not(target_arch = "wasm32"))] mod file_sink; diff --git a/crates/store/re_log_types/Cargo.toml b/crates/store/re_log_types/Cargo.toml index 0fd6f76e837c..58c67788ff93 100644 --- a/crates/store/re_log_types/Cargo.toml +++ b/crates/store/re_log_types/Cargo.toml @@ -45,11 +45,13 @@ serde = [ re_build_info.workspace = true re_format.workspace = true re_log.workspace = true +re_protos.workspace = true re_string_interner.workspace = true re_tracing.workspace = true re_tuid.workspace = true re_types_core.workspace = true + # External ahash.workspace = true anyhow.workspace = true diff --git a/crates/store/re_log_types/src/lib.rs b/crates/store/re_log_types/src/lib.rs index 5c3f52b88b87..bdbf8bab6510 100644 --- a/crates/store/re_log_types/src/lib.rs +++ b/crates/store/re_log_types/src/lib.rs @@ -32,6 +32,8 @@ mod time; mod time_real; mod vec_deque_ext; +mod protobuf_conversions; + use std::sync::Arc; use re_build_info::CrateVersion; diff --git a/crates/store/re_log_types/src/protobuf_conversions.rs b/crates/store/re_log_types/src/protobuf_conversions.rs new file mode 100644 index 000000000000..80993323e529 --- /dev/null +++ b/crates/store/re_log_types/src/protobuf_conversions.rs @@ -0,0 +1,191 @@ +use std::sync::Arc; + +use re_protos::TypeConversionError; + +impl From for re_protos::common::v0::EntityPath { + fn from(value: crate::EntityPath) -> Self { + Self { + path: value.to_string(), + } + } +} + +impl TryFrom for crate::EntityPath { + type Error = TypeConversionError; + + fn try_from(value: re_protos::common::v0::EntityPath) -> Result { + Self::parse_strict(&value.path).map_err(|err| TypeConversionError::InvalidField { + type_name: "rerun.common.v0.EntityPath", + field_name: "path", + reason: err.to_string(), + }) + } +} + +impl From for crate::Time { + fn from(value: re_protos::common::v0::Time) -> Self { + Self::from_ns_since_epoch(value.nanos_since_epoch) + } +} + +impl From for re_protos::common::v0::Time { + fn from(value: crate::Time) -> Self { + Self { + nanos_since_epoch: value.nanos_since_epoch(), + } + } +} + +impl From for re_protos::common::v0::TimeInt { + fn from(value: crate::TimeInt) -> Self { + Self { + time: value.as_i64(), + } + } +} + +impl From for crate::TimeInt { + fn from(value: re_protos::common::v0::TimeInt) -> Self { + Self::new_temporal(value.time) + } +} + +impl From for re_protos::common::v0::TimeRange { + fn from(value: crate::ResolvedTimeRange) -> Self { + Self { + start: value.min().as_i64(), + end: value.max().as_i64(), + } + } +} + +impl From for crate::ResolvedTimeRange { + fn from(value: re_protos::common::v0::TimeRange) -> Self { + Self::new( + crate::TimeInt::new_temporal(value.start), + crate::TimeInt::new_temporal(value.end), + ) + } +} + +impl From for re_protos::common::v0::IndexRange { + fn from(value: crate::ResolvedTimeRange) -> Self { + Self { + time_range: Some(value.into()), + } + } +} + +impl TryFrom for crate::ResolvedTimeRange { + type Error = TypeConversionError; + + fn try_from(value: re_protos::common::v0::IndexRange) -> Result { + value + .time_range + .ok_or(TypeConversionError::missing_field( + "rerun.common.v0.IndexRange", + "time_range", + )) + .map(|time_range| Self::new(time_range.start, time_range.end)) + } +} + +impl TryFrom for crate::Timeline { + type Error = TypeConversionError; + + fn try_from(value: re_protos::common::v0::IndexColumnSelector) -> Result { + let timeline_name = value + .timeline + .ok_or(TypeConversionError::missing_field( + "rerun.common.v0.IndexColumnSelector", + "timeline", + ))? + .name; + + // TODO(cmc): QueryExpression::filtered_index gotta be a selector + #[allow(clippy::match_same_arms)] + let timeline = match timeline_name.as_str() { + "log_time" => Self::new_temporal(timeline_name), + "log_tick" => Self::new_sequence(timeline_name), + "frame" => Self::new_sequence(timeline_name), + "frame_nr" => Self::new_sequence(timeline_name), + _ => Self::new_temporal(timeline_name), + }; + + Ok(timeline) + } +} + +impl From for crate::ApplicationId { + #[inline] + fn from(value: re_protos::common::v0::ApplicationId) -> Self { + Self(value.id) + } +} + +impl From for re_protos::common::v0::ApplicationId { + #[inline] + fn from(value: crate::ApplicationId) -> Self { + Self { id: value.0 } + } +} + +impl From for crate::StoreKind { + #[inline] + fn from(value: re_protos::common::v0::StoreKind) -> Self { + match value { + re_protos::common::v0::StoreKind::Recording => Self::Recording, + re_protos::common::v0::StoreKind::Blueprint => Self::Blueprint, + } + } +} + +impl From for re_protos::common::v0::StoreKind { + #[inline] + fn from(value: crate::StoreKind) -> Self { + match value { + crate::StoreKind::Recording => Self::Recording, + crate::StoreKind::Blueprint => Self::Blueprint, + } + } +} + +impl From for crate::StoreId { + #[inline] + fn from(value: re_protos::common::v0::StoreId) -> Self { + Self { + kind: crate::StoreKind::Recording, + id: Arc::new(value.id), + } + } +} + +impl From for re_protos::common::v0::StoreId { + #[inline] + fn from(value: crate::StoreId) -> Self { + let kind: re_protos::common::v0::StoreKind = value.kind.into(); + Self { + kind: kind as i32, + id: String::clone(&*value.id), + } + } +} + +impl From for crate::StoreId { + #[inline] + fn from(value: re_protos::common::v0::RecordingId) -> Self { + Self { + kind: crate::StoreKind::Recording, + id: Arc::new(value.id), + } + } +} + +impl From for re_protos::common::v0::RecordingId { + #[inline] + fn from(value: crate::StoreId) -> Self { + Self { + id: String::clone(&*value.id), + } + } +} diff --git a/crates/store/re_protos/Cargo.toml b/crates/store/re_protos/Cargo.toml index 66cb898e1cc1..74a75d7759c4 100644 --- a/crates/store/re_protos/Cargo.toml +++ b/crates/store/re_protos/Cargo.toml @@ -13,11 +13,7 @@ rust-version.workspace = true version.workspace = true [dependencies] -re_log_types.workspace = true -re_dataframe.workspace = true - # External -arrow2 = { workspace = true, features = ["io_ipc"] } prost.workspace = true thiserror.workspace = true diff --git a/crates/store/re_protos/README.md b/crates/store/re_protos/README.md index 9e6a1c97637f..e96cb055def6 100644 --- a/crates/store/re_protos/README.md +++ b/crates/store/re_protos/README.md @@ -11,4 +11,4 @@ Rerun remote store node gRPC API service types (client and server). This crate includes both the language-agnostic definitions (protobuf) as well as the generated code. -The code is generated with `pixi run codegen-rstore`. +The code is generated with `pixi run codegen-protos`. diff --git a/crates/store/re_protos/proto/rerun/v0/common.proto b/crates/store/re_protos/proto/rerun/v0/common.proto index b8b930b441d9..47f77b7e6dd7 100644 --- a/crates/store/re_protos/proto/rerun/v0/common.proto +++ b/crates/store/re_protos/proto/rerun/v0/common.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package rerun.remote_store.v0; +package rerun.common.v0; // supported encoder versions for encoding data // See `RerunData` and `RerunChunkData` for its usage @@ -178,3 +178,31 @@ enum SparseFillStrategy { NONE = 0; LATEST_AT_GLOBAL = 1; } + +message ApplicationId { + string id = 1; +} + +enum StoreKind { + RECORDING = 0; + BLUEPRINT = 1; +} + +message StoreId { + StoreKind kind = 1; + string id = 2; +} + +// A date-time represented as nanoseconds since unix epoch +message Time { + int64 nanos_since_epoch = 1; +} + +message Tuid { + // Approximate nanoseconds since epoch. + fixed64 time_ns = 1; + + // Initialized to something random on each thread, + // then incremented for each new `Tuid` being allocated. + fixed64 inc = 2; +} diff --git a/crates/store/re_protos/proto/rerun/v0/remote_store.proto b/crates/store/re_protos/proto/rerun/v0/remote_store.proto index 30a91ebaddc4..2955f45b8b3c 100644 --- a/crates/store/re_protos/proto/rerun/v0/remote_store.proto +++ b/crates/store/re_protos/proto/rerun/v0/remote_store.proto @@ -7,7 +7,7 @@ import "rerun/v0/common.proto"; service StorageNode { // data API calls rpc Query(QueryRequest) returns (stream DataframePart) {} - rpc FetchRecording(FetchRecordingRequest) returns (stream RerunChunk) {} + rpc FetchRecording(FetchRecordingRequest) returns (stream rerun.common.v0.RerunChunk) {} // metadata API calls rpc QueryCatalog(QueryCatalogRequest) returns (stream DataframePart) {} @@ -16,13 +16,12 @@ service StorageNode { rpc RegisterRecording(RegisterRecordingRequest) returns (DataframePart) {} } - // ---------------- Common response message ------------------ // DataframePart is arrow IPC encoded RecordBatch message DataframePart { // encoder version used to encode the data - EncoderVersion encoder_version = 1; + rerun.common.v0.EncoderVersion encoder_version = 1; // Data payload is Arrow IPC encoded RecordBatch bytes payload = 1000; @@ -45,7 +44,7 @@ message RegisterRecordingRequest { // ---------------- UpdateCatalog ----------------- message UpdateCatalogRequest { - RecordingId recording_id = 1; + rerun.common.v0.RecordingId recording_id = 1; DataframePart metadata = 2; } @@ -55,12 +54,11 @@ message UpdateCatalogResponse {} message QueryRequest { // unique identifier of the recording - RecordingId recording_id = 1; + rerun.common.v0.RecordingId recording_id = 1; // query to execute - Query query = 3; + rerun.common.v0.Query query = 3; } - // ----------------- QueryCatalog ----------------- message QueryCatalogRequest { @@ -78,11 +76,11 @@ message ColumnProjection { message CatalogFilter { // Filtering is very simple right now, we can only select // recordings by their ids. - repeated RecordingId recording_ids = 1; + repeated rerun.common.v0.RecordingId recording_ids = 1; } message QueryCatalogResponse { - EncoderVersion encoder_version = 1; + rerun.common.v0.EncoderVersion encoder_version = 1; // raw bytes are TransportChunks (i.e. RecordBatches) encoded with the relevant codec bytes payload = 2; } @@ -94,7 +92,7 @@ enum RecordingType { // ----------------- FetchRecording ----------------- message FetchRecordingRequest { - RecordingId recording_id = 1; + rerun.common.v0.RecordingId recording_id = 1; } // TODO(jleibs): Eventually this becomes either query-mediated in some way, but for now @@ -103,7 +101,7 @@ message FetchRecordingResponse { // TODO(zehiko) we need to expand this to become something like 'encoder options' // as we will need to specify additional options like compression, including schema // in payload, etc. - EncoderVersion encoder_version = 1; + rerun.common.v0.EncoderVersion encoder_version = 1; // payload is raw bytes that the relevant codec can interpret bytes payload = 2; } diff --git a/crates/store/re_protos/src/lib.rs b/crates/store/re_protos/src/lib.rs index 49275482e736..35da3c09c82a 100644 --- a/crates/store/re_protos/src/lib.rs +++ b/crates/store/re_protos/src/lib.rs @@ -6,434 +6,71 @@ //! necessary conversion code (in the form of `From` and `TryFrom` traits) in this crate. //! -/// Codec for serializing and deserializing query response (record batch) data -pub mod codec; - -/// Generated types for the remote store gRPC service API v0. -pub mod v0 { - // Ignoring all warnings for the auto-generated code. - #[allow(clippy::doc_markdown)] - #[allow(clippy::derive_partial_eq_without_eq)] - #[allow(clippy::enum_variant_names)] - #[allow(clippy::unwrap_used)] - #[allow(clippy::wildcard_imports)] - #[allow(clippy::manual_is_variant_and)] - #[path = "../v0/rerun.remote_store.v0.rs"] - mod _v0; - - pub use self::_v0::*; - - // ==== below are all necessary transforms from internal rerun types to protobuf types ===== - - use std::{collections::BTreeSet, sync::Arc}; - - #[derive(Debug, thiserror::Error)] - pub enum TypeConversionError { - #[error("missing required field: {0}")] - MissingField(&'static str), - } - - impl From for re_log_types::StoreId { - #[inline] - fn from(value: RecordingId) -> Self { - Self { - kind: re_log_types::StoreKind::Recording, - id: Arc::new(value.id), - } - } - } - - impl From for RecordingId { - #[inline] - fn from(value: re_log_types::StoreId) -> Self { - Self { - id: value.id.to_string(), - } - } - } - - impl From for TimeRange { - fn from(time_range: re_log_types::ResolvedTimeRange) -> Self { - Self { - start: time_range.min().as_i64(), - end: time_range.max().as_i64(), - } - } - } - - impl TryFrom for re_dataframe::QueryExpression { - type Error = TypeConversionError; - - fn try_from(value: Query) -> Result { - let filtered_index = value - .filtered_index - .ok_or(TypeConversionError::MissingField("filtered_index"))? - .try_into()?; - - let selection = value - .column_selection - .map(|cs| { - cs.columns - .into_iter() - .map(re_dataframe::ColumnSelector::try_from) - .collect::, _>>() - }) - .transpose()?; - - let filtered_is_not_null = value - .filtered_is_not_null - .map(re_dataframe::ComponentColumnSelector::try_from) - .transpose()?; - - Ok(Self { - view_contents: value.view_contents.map(|vc| vc.into()), - include_semantically_empty_columns: value.include_semantically_empty_columns, - include_indicator_columns: value.include_indicator_columns, - include_tombstone_columns: value.include_tombstone_columns, - filtered_index: Some(filtered_index), - filtered_index_range: value - .filtered_index_range - .map(|ir| ir.try_into()) - .transpose()?, - filtered_index_values: value - .filtered_index_values - .map(|iv| iv.time_points.into_iter().map(|v| v.into()).collect()), - using_index_values: value - .using_index_values - .map(|uiv| uiv.time_points.into_iter().map(|v| v.into()).collect()), - filtered_is_not_null, - sparse_fill_strategy: re_dataframe::SparseFillStrategy::default(), // TODO(zehiko) implement support for sparse fill strategy - selection, - }) - } - } - - impl From for re_dataframe::ViewContentsSelector { - fn from(value: ViewContents) -> Self { - value - .contents - .into_iter() - .map(|part| { - #[allow(clippy::unwrap_used)] // TODO(zehiko) - let entity_path = Into::::into(part.path.unwrap()); - let column_selector = part.components.map(|cs| { - cs.components - .into_iter() - .map(|c| re_dataframe::external::re_chunk::ComponentName::new(&c.name)) - .collect::>() - }); - (entity_path, column_selector) - }) - .collect::() - } - } - - impl From for re_log_types::EntityPath { - fn from(value: EntityPath) -> Self { - Self::from(value.path) - } - } - - impl TryFrom for re_log_types::Timeline { - type Error = TypeConversionError; - - fn try_from(value: IndexColumnSelector) -> Result { - let timeline_name = value - .timeline - .ok_or(TypeConversionError::MissingField("timeline"))? - .name; - - // TODO(cmc): QueryExpression::filtered_index gotta be a selector - #[allow(clippy::match_same_arms)] - let timeline = match timeline_name.as_str() { - "log_time" => Self::new_temporal(timeline_name), - "log_tick" => Self::new_sequence(timeline_name), - "frame" => Self::new_sequence(timeline_name), - "frame_nr" => Self::new_sequence(timeline_name), - _ => Self::new_temporal(timeline_name), - }; - - Ok(timeline) - } - } - - impl TryFrom for re_dataframe::IndexRange { - type Error = TypeConversionError; - - fn try_from(value: IndexRange) -> Result { - let time_range = value - .time_range - .ok_or(TypeConversionError::MissingField("time_range"))?; - - Ok(Self::new(time_range.start, time_range.end)) - } - } - - impl From for re_log_types::TimeInt { - fn from(value: TimeInt) -> Self { - Self::new_temporal(value.time) - } - } - - impl TryFrom for re_dataframe::ComponentColumnSelector { - type Error = TypeConversionError; - - fn try_from(value: ComponentColumnSelector) -> Result { - let entity_path = value - .entity_path - .ok_or(TypeConversionError::MissingField("entity_path"))? - .into(); - - let component_name = value - .component - .ok_or(TypeConversionError::MissingField("component"))? - .name; - - Ok(Self { - entity_path, - component_name, - }) - } - } - - impl TryFrom for re_dataframe::TimeColumnSelector { - type Error = TypeConversionError; - - fn try_from(value: TimeColumnSelector) -> Result { - let timeline = value - .timeline - .ok_or(TypeConversionError::MissingField("timeline"))?; - - Ok(Self { - timeline: timeline.name.into(), - }) - } - } - - impl TryFrom for re_dataframe::ColumnSelector { - type Error = TypeConversionError; - - fn try_from(value: ColumnSelector) -> Result { - match value - .selector_type - .ok_or(TypeConversionError::MissingField("selector_type"))? - { - column_selector::SelectorType::ComponentColumn(component_column_selector) => { - let selector: re_dataframe::ComponentColumnSelector = - component_column_selector.try_into()?; - Ok(selector.into()) - } - column_selector::SelectorType::TimeColumn(time_column_selector) => { - let selector: re_dataframe::TimeColumnSelector = - time_column_selector.try_into()?; - - Ok(selector.into()) - } - } - } - } - - // ---- conversion from rerun's QueryExpression into protobuf Query ---- +pub mod external { + pub use prost; +} - impl From for Query { - fn from(value: re_dataframe::QueryExpression) -> Self { - let view_contents = value - .view_contents - .map(|vc| { - vc.into_iter() - .map(|(path, components)| ViewContentsPart { - path: Some(path.into()), - components: components.map(|cs| ComponentsSet { - components: cs - .into_iter() - .map(|c| Component { - name: c.to_string(), - }) - .collect(), - }), - }) - .collect::>() - }) - .map(|cs| ViewContents { contents: cs }); +// This extra module is needed, because of how imports from different packages are resolved. +// For example, `rerun.remote_store.v0.EncoderVersion` is resolved to `super::super::remote_store::v0::EncoderVersion`. +// We need an extra module in the path to `common` to make that work. +// Additionally, the `common` module itself has to exist with a `v0` module inside of it, +// which is the reason for the `common`, `log_msg`, `remote_store`, etc. modules below. - Self { - view_contents, - include_semantically_empty_columns: value.include_semantically_empty_columns, - include_indicator_columns: value.include_indicator_columns, - include_tombstone_columns: value.include_tombstone_columns, - filtered_index: value.filtered_index.map(|timeline| IndexColumnSelector { - timeline: Some(Timeline { - name: timeline.name().to_string(), - }), - }), - filtered_index_range: value.filtered_index_range.map(|ir| IndexRange { - time_range: Some(ir.into()), - }), - filtered_index_values: value.filtered_index_values.map(|iv| IndexValues { - time_points: iv - .into_iter() - // TODO(zehiko) is this desired behavior for TimeInt::STATIC? - .map(|v| TimeInt { time: v.as_i64() }) - .collect(), - }), - using_index_values: value.using_index_values.map(|uiv| IndexValues { - time_points: uiv - .into_iter() - .map(|v| TimeInt { time: v.as_i64() }) - .collect(), - }), - filtered_is_not_null: value.filtered_is_not_null.map(|cs| { - ComponentColumnSelector { - entity_path: Some(cs.entity_path.into()), - component: Some(Component { - name: cs.component_name, - }), - } - }), - column_selection: value.selection.map(|cs| ColumnSelection { - columns: cs.into_iter().map(|c| c.into()).collect(), - }), - sparse_fill_strategy: SparseFillStrategy::None.into(), // TODO(zehiko) implement - } - } - } - - impl From for EntityPath { - fn from(value: re_dataframe::EntityPath) -> Self { - Self { - path: value.to_string(), - } - } - } +// Note: Be careful with `#[path]` attributes: https://github.com/rust-lang/rust/issues/35016 +mod v0 { + // Note: `allow(clippy::all)` does NOT allow all lints + #![allow(clippy::all, clippy::pedantic, clippy::nursery)] - impl From for ColumnSelector { - fn from(value: re_dataframe::ColumnSelector) -> Self { - match value { - re_dataframe::ColumnSelector::Component(ccs) => Self { - selector_type: Some(column_selector::SelectorType::ComponentColumn( - ComponentColumnSelector { - entity_path: Some(ccs.entity_path.into()), - component: Some(Component { - name: ccs.component_name, - }), - }, - )), - }, - re_dataframe::ColumnSelector::Time(tcs) => Self { - selector_type: Some(column_selector::SelectorType::TimeColumn( - TimeColumnSelector { - timeline: Some(Timeline { - name: tcs.timeline.to_string(), - }), - }, - )), - }, - } - } - } + #[path = "./rerun.common.v0.rs"] + pub mod rerun_common_v0; - // ------- Application level errors ------- - impl std::error::Error for RemoteStoreError {} + #[path = "./rerun.remote_store.v0.rs"] + pub mod rerun_remote_store_v0; +} - impl std::fmt::Display for RemoteStoreError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_fmt(format_args!( - "Remote store error. Request identifier: {}, error msg: {}, error code: {}", - self.id, self.message, self.code - )) - } +pub mod common { + pub mod v0 { + pub use crate::v0::rerun_common_v0::*; } } -#[cfg(test)] -mod tests { - - use crate::v0::{ - column_selector::SelectorType, ColumnSelection, ColumnSelector, Component, - ComponentColumnSelector, ComponentsSet, EntityPath, IndexColumnSelector, IndexRange, - IndexValues, Query, RecordingId, SparseFillStrategy, TimeInt, TimeRange, Timeline, - ViewContents, ViewContentsPart, - }; - - #[test] - pub fn test_query_conversion() { - let grpc_query_before = Query { - view_contents: Some(ViewContents { - contents: vec![ViewContentsPart { - path: Some(EntityPath { - path: "/somepath".to_owned(), - }), - components: Some(ComponentsSet { - components: vec![Component { - name: "component".to_owned(), - }], - }), - }], - }), - include_indicator_columns: false, - include_semantically_empty_columns: true, - include_tombstone_columns: true, - filtered_index: Some(IndexColumnSelector { - timeline: Some(Timeline { - name: "log_time".to_owned(), - }), - }), - filtered_index_range: Some(IndexRange { - time_range: Some(TimeRange { start: 0, end: 100 }), - }), - filtered_index_values: Some(IndexValues { - time_points: vec![ - TimeInt { time: 0 }, - TimeInt { time: 1 }, - TimeInt { time: 2 }, - ], - }), - using_index_values: Some(IndexValues { - time_points: vec![ - TimeInt { time: 3 }, - TimeInt { time: 4 }, - TimeInt { time: 5 }, - ], - }), - filtered_is_not_null: Some(ComponentColumnSelector { - entity_path: Some(EntityPath { - path: "/somepath/c".to_owned(), - }), - component: Some(Component { - name: "component".to_owned(), - }), - }), - column_selection: Some(ColumnSelection { - columns: vec![ColumnSelector { - selector_type: Some(SelectorType::ComponentColumn(ComponentColumnSelector { - entity_path: Some(EntityPath { - path: "/somepath/c".to_owned(), - }), - component: Some(Component { - name: "component".to_owned(), - }), - })), - }], - }), - sparse_fill_strategy: SparseFillStrategy::None.into(), - }; - - let query_expression_native: re_dataframe::QueryExpression = - grpc_query_before.clone().try_into().unwrap(); - let grpc_query_after = query_expression_native.into(); - - assert_eq!(grpc_query_before, grpc_query_after); +/// Generated types for the remote store gRPC service API v0. +pub mod remote_store { + pub mod v0 { + pub use crate::v0::rerun_remote_store_v0::*; } +} - #[test] - fn test_recording_id_conversion() { - let recording_id = RecordingId { - id: "recording_id".to_owned(), - }; - - let store_id: re_log_types::StoreId = recording_id.clone().into(); - let recording_id_after: RecordingId = store_id.into(); +#[derive(Debug, thiserror::Error)] +pub enum TypeConversionError { + #[error("missing required field: {type_name}.{field_name}")] + MissingField { + type_name: &'static str, + field_name: &'static str, + }, + + #[error("invalid value for field {type_name}.{field_name}: {reason}")] + InvalidField { + type_name: &'static str, + field_name: &'static str, + reason: String, + }, + + #[error("failed to decode: {0}")] + DecodeError(#[from] prost::DecodeError), + + #[error("failed to encode: {0}")] + EncodeError(#[from] prost::EncodeError), + + #[error("{0}")] + UnknownEnumValue(#[from] prost::UnknownEnumValue), +} - assert_eq!(recording_id, recording_id_after); +impl TypeConversionError { + pub fn missing_field(type_name: &'static str, field_name: &'static str) -> Self { + Self::MissingField { + type_name, + field_name, + } } } diff --git a/crates/store/re_protos/src/v0/rerun.common.v0.rs b/crates/store/re_protos/src/v0/rerun.common.v0.rs new file mode 100644 index 000000000000..d06d839e0c65 --- /dev/null +++ b/crates/store/re_protos/src/v0/rerun.common.v0.rs @@ -0,0 +1,302 @@ +// This file is @generated by prost-build. +/// RerunChunk is arrow IPC encoded RecordBatch that has +/// rerun-specific semantic constraints and can be directly +/// converted to a Rerun Chunk (`re_chunk::Chunk`) +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RerunChunk { + /// encoder version used to encode the data + #[prost(enumeration = "EncoderVersion", tag = "1")] + pub encoder_version: i32, + /// Data payload is Arrow IPC encoded RecordBatch + #[prost(bytes = "vec", tag = "1000")] + pub payload: ::prost::alloc::vec::Vec, +} +/// unique recording identifier. At this point in time it is the same id as the ChunkStore's StoreId +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RecordingId { + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +/// A recording can have multiple timelines, each is identified by a name, for example `log_tick`, `log_time`, etc. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Timeline { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, +} +/// A time range between start and end time points. Each 64 bit number can represent different time point data +/// depending on the timeline it is associated with. Time range is inclusive for both start and end time points. +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct TimeRange { + #[prost(int64, tag = "1")] + pub start: i64, + #[prost(int64, tag = "2")] + pub end: i64, +} +/// arrow IPC serialized schema +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Schema { + #[prost(bytes = "vec", tag = "1")] + pub arrow_schema: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Query { + /// The subset of the database that the query will run on: a set of EntityPath(s) and their + /// associated Component(s) + #[prost(message, optional, tag = "1")] + pub view_contents: ::core::option::Option, + /// Whether the view_contents should ignore semantically empty columns + /// A semantically empty column is a column that either contains no data at all, or where all + /// values are either nulls or empty arrays (\[\]). + #[prost(bool, tag = "2")] + pub include_semantically_empty_columns: bool, + /// Whether the view_contents should ignore columns corresponding to indicator components + /// Indicator components are marker components, generally automatically inserted by Rerun, that + /// helps keep track of the original context in which a piece of data was logged/sent. + #[prost(bool, tag = "3")] + pub include_indicator_columns: bool, + /// Whether the view_contents should ignore columns corresponding to Clear-related components + #[prost(bool, tag = "4")] + pub include_tombstone_columns: bool, + /// The index used to filter out _rows_ from the view contents. + /// Only rows where at least 1 column contains non-null data at that index will be kept in the + /// final dataset. If left unspecified, the results will only contain static data. + #[prost(message, optional, tag = "5")] + pub filtered_index: ::core::option::Option, + /// The range of index values used to filter out _rows_ from the view contents + /// Only rows where at least 1 of the view-contents contains non-null data within that range will be kept in + /// the final dataset. + /// This has no effect if filtered_index isn't set. + /// This has no effect if using_index_values is set. + #[prost(message, optional, tag = "6")] + pub filtered_index_range: ::core::option::Option, + /// The specific index values used to filter out _rows_ from the view contents. + /// Only rows where at least 1 column contains non-null data at these specific values will be kept + /// in the final dataset. + /// This has no effect if filtered_index isn't set. + /// This has no effect if using_index_values is set. + #[prost(message, optional, tag = "7")] + pub filtered_index_values: ::core::option::Option, + /// The specific index values used to sample _rows_ from the view contents. + /// The final dataset will contain one row per sampled index value, regardless of whether data + /// existed for that index value in the view contents. + /// The semantics of the query are consistent with all other settings: the results will be + /// sorted on the filtered_index, and only contain unique index values. + /// + /// This has no effect if filtered_index isn't set. + /// If set, this overrides both filtered_index_range and filtered_index_values. + #[prost(message, optional, tag = "8")] + pub using_index_values: ::core::option::Option, + /// The component column used to filter out _rows_ from the view contents. + /// Only rows where this column contains non-null data be kept in the final dataset. + #[prost(message, optional, tag = "9")] + pub filtered_is_not_null: ::core::option::Option, + /// / The specific _columns_ to sample from the final view contents. + /// / The order of the samples will be respected in the final result. + /// / + /// / If unspecified, it means - everything. + #[prost(message, optional, tag = "10")] + pub column_selection: ::core::option::Option, + /// Specifies how null values should be filled in the returned dataframe. + #[prost(enumeration = "SparseFillStrategy", tag = "11")] + pub sparse_fill_strategy: i32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ColumnSelection { + #[prost(message, repeated, tag = "1")] + pub columns: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ColumnSelector { + #[prost(oneof = "column_selector::SelectorType", tags = "2, 3")] + pub selector_type: ::core::option::Option, +} +/// Nested message and enum types in `ColumnSelector`. +pub mod column_selector { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum SelectorType { + #[prost(message, tag = "2")] + ComponentColumn(super::ComponentColumnSelector), + #[prost(message, tag = "3")] + TimeColumn(super::TimeColumnSelector), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexColumnSelector { + /// TODO(zehiko) we need to add support for other types of index selectors + #[prost(message, optional, tag = "1")] + pub timeline: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct IndexRange { + /// TODO(zehiko) support for other ranges for other index selectors + #[prost(message, optional, tag = "1")] + pub time_range: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IndexValues { + /// TODO(zehiko) we need to add support for other types of index selectors + #[prost(message, repeated, tag = "1")] + pub time_points: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SampledIndexValues { + #[prost(message, repeated, tag = "1")] + pub sample_points: ::prost::alloc::vec::Vec, +} +/// A 64-bit number describing either nanoseconds, sequence numbers or fully static data. +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct TimeInt { + #[prost(int64, tag = "1")] + pub time: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ViewContents { + #[prost(message, repeated, tag = "1")] + pub contents: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ViewContentsPart { + #[prost(message, optional, tag = "1")] + pub path: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub components: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ComponentsSet { + #[prost(message, repeated, tag = "1")] + pub components: ::prost::alloc::vec::Vec, +} +/// The unique identifier of an entity, e.g. `camera/3/points` +/// See <> for more on entity paths. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EntityPath { + #[prost(string, tag = "1")] + pub path: ::prost::alloc::string::String, +} +/// Component describes semantic data that can be used by any number of rerun's archetypes. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Component { + /// component name needs to be a string as user can define their own component + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, +} +/// Used to telect a time column. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TimeColumnSelector { + #[prost(message, optional, tag = "1")] + pub timeline: ::core::option::Option, +} +/// Used to select a component based on its EntityPath and Component name. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ComponentColumnSelector { + #[prost(message, optional, tag = "1")] + pub entity_path: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub component: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ApplicationId { + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreId { + #[prost(enumeration = "StoreKind", tag = "1")] + pub kind: i32, + #[prost(string, tag = "2")] + pub id: ::prost::alloc::string::String, +} +/// A date-time represented as nanoseconds since unix epoch +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct Time { + #[prost(int64, tag = "1")] + pub nanos_since_epoch: i64, +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct Tuid { + /// Approximate nanoseconds since epoch. + #[prost(fixed64, tag = "1")] + pub time_ns: u64, + /// Initialized to something random on each thread, + /// then incremented for each new `Tuid` being allocated. + #[prost(fixed64, tag = "2")] + pub inc: u64, +} +/// supported encoder versions for encoding data +/// See `RerunData` and `RerunChunkData` for its usage +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum EncoderVersion { + V0 = 0, +} +impl EncoderVersion { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::V0 => "V0", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "V0" => Some(Self::V0), + _ => None, + } + } +} +/// Specifies how null values should be filled in the returned dataframe. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SparseFillStrategy { + None = 0, + LatestAtGlobal = 1, +} +impl SparseFillStrategy { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::None => "NONE", + Self::LatestAtGlobal => "LATEST_AT_GLOBAL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "NONE" => Some(Self::None), + "LATEST_AT_GLOBAL" => Some(Self::LatestAtGlobal), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum StoreKind { + Recording = 0, + Blueprint = 1, +} +impl StoreKind { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Recording => "RECORDING", + Self::Blueprint => "BLUEPRINT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "RECORDING" => Some(Self::Recording), + "BLUEPRINT" => Some(Self::Blueprint), + _ => None, + } + } +} diff --git a/crates/store/re_protos/src/v0/rerun.remote_store.v0.rs b/crates/store/re_protos/src/v0/rerun.remote_store.v0.rs index 50ba75d1d167..144ddc584ef7 100644 --- a/crates/store/re_protos/src/v0/rerun.remote_store.v0.rs +++ b/crates/store/re_protos/src/v0/rerun.remote_store.v0.rs @@ -1,256 +1,9 @@ // This file is @generated by prost-build. -/// RerunChunk is arrow IPC encoded RecordBatch that has -/// rerun-specific semantic constraints and can be directly -/// converted to a Rerun Chunk (`re_chunk::Chunk`) -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct RerunChunk { - /// encoder version used to encode the data - #[prost(enumeration = "EncoderVersion", tag = "1")] - pub encoder_version: i32, - /// Data payload is Arrow IPC encoded RecordBatch - #[prost(bytes = "vec", tag = "1000")] - pub payload: ::prost::alloc::vec::Vec, -} -/// unique recording identifier. At this point in time it is the same id as the ChunkStore's StoreId -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct RecordingId { - #[prost(string, tag = "1")] - pub id: ::prost::alloc::string::String, -} -/// A recording can have multiple timelines, each is identified by a name, for example `log_tick`, `log_time`, etc. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Timeline { - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, -} -/// A time range between start and end time points. Each 64 bit number can represent different time point data -/// depending on the timeline it is associated with. Time range is inclusive for both start and end time points. -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct TimeRange { - #[prost(int64, tag = "1")] - pub start: i64, - #[prost(int64, tag = "2")] - pub end: i64, -} -/// arrow IPC serialized schema -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Schema { - #[prost(bytes = "vec", tag = "1")] - pub arrow_schema: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Query { - /// The subset of the database that the query will run on: a set of EntityPath(s) and their - /// associated Component(s) - #[prost(message, optional, tag = "1")] - pub view_contents: ::core::option::Option, - /// Whether the view_contents should ignore semantically empty columns - /// A semantically empty column is a column that either contains no data at all, or where all - /// values are either nulls or empty arrays (\[\]). - #[prost(bool, tag = "2")] - pub include_semantically_empty_columns: bool, - /// Whether the view_contents should ignore columns corresponding to indicator components - /// Indicator components are marker components, generally automatically inserted by Rerun, that - /// helps keep track of the original context in which a piece of data was logged/sent. - #[prost(bool, tag = "3")] - pub include_indicator_columns: bool, - /// Whether the view_contents should ignore columns corresponding to Clear-related components - #[prost(bool, tag = "4")] - pub include_tombstone_columns: bool, - /// The index used to filter out _rows_ from the view contents. - /// Only rows where at least 1 column contains non-null data at that index will be kept in the - /// final dataset. If left unspecified, the results will only contain static data. - #[prost(message, optional, tag = "5")] - pub filtered_index: ::core::option::Option, - /// The range of index values used to filter out _rows_ from the view contents - /// Only rows where at least 1 of the view-contents contains non-null data within that range will be kept in - /// the final dataset. - /// This has no effect if filtered_index isn't set. - /// This has no effect if using_index_values is set. - #[prost(message, optional, tag = "6")] - pub filtered_index_range: ::core::option::Option, - /// The specific index values used to filter out _rows_ from the view contents. - /// Only rows where at least 1 column contains non-null data at these specific values will be kept - /// in the final dataset. - /// This has no effect if filtered_index isn't set. - /// This has no effect if using_index_values is set. - #[prost(message, optional, tag = "7")] - pub filtered_index_values: ::core::option::Option, - /// The specific index values used to sample _rows_ from the view contents. - /// The final dataset will contain one row per sampled index value, regardless of whether data - /// existed for that index value in the view contents. - /// The semantics of the query are consistent with all other settings: the results will be - /// sorted on the filtered_index, and only contain unique index values. - /// - /// This has no effect if filtered_index isn't set. - /// If set, this overrides both filtered_index_range and filtered_index_values. - #[prost(message, optional, tag = "8")] - pub using_index_values: ::core::option::Option, - /// The component column used to filter out _rows_ from the view contents. - /// Only rows where this column contains non-null data be kept in the final dataset. - #[prost(message, optional, tag = "9")] - pub filtered_is_not_null: ::core::option::Option, - /// / The specific _columns_ to sample from the final view contents. - /// / The order of the samples will be respected in the final result. - /// / - /// / If unspecified, it means - everything. - #[prost(message, optional, tag = "10")] - pub column_selection: ::core::option::Option, - /// Specifies how null values should be filled in the returned dataframe. - #[prost(enumeration = "SparseFillStrategy", tag = "11")] - pub sparse_fill_strategy: i32, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ColumnSelection { - #[prost(message, repeated, tag = "1")] - pub columns: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ColumnSelector { - #[prost(oneof = "column_selector::SelectorType", tags = "2, 3")] - pub selector_type: ::core::option::Option, -} -/// Nested message and enum types in `ColumnSelector`. -pub mod column_selector { - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum SelectorType { - #[prost(message, tag = "2")] - ComponentColumn(super::ComponentColumnSelector), - #[prost(message, tag = "3")] - TimeColumn(super::TimeColumnSelector), - } -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct IndexColumnSelector { - /// TODO(zehiko) we need to add support for other types of index selectors - #[prost(message, optional, tag = "1")] - pub timeline: ::core::option::Option, -} -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct IndexRange { - /// TODO(zehiko) support for other ranges for other index selectors - #[prost(message, optional, tag = "1")] - pub time_range: ::core::option::Option, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct IndexValues { - /// TODO(zehiko) we need to add support for other types of index selectors - #[prost(message, repeated, tag = "1")] - pub time_points: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SampledIndexValues { - #[prost(message, repeated, tag = "1")] - pub sample_points: ::prost::alloc::vec::Vec, -} -/// A 64-bit number describing either nanoseconds, sequence numbers or fully static data. -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct TimeInt { - #[prost(int64, tag = "1")] - pub time: i64, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ViewContents { - #[prost(message, repeated, tag = "1")] - pub contents: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ViewContentsPart { - #[prost(message, optional, tag = "1")] - pub path: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub components: ::core::option::Option, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ComponentsSet { - #[prost(message, repeated, tag = "1")] - pub components: ::prost::alloc::vec::Vec, -} -/// The unique identifier of an entity, e.g. `camera/3/points` -/// See <> for more on entity paths. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EntityPath { - #[prost(string, tag = "1")] - pub path: ::prost::alloc::string::String, -} -/// Component describes semantic data that can be used by any number of rerun's archetypes. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Component { - /// component name needs to be a string as user can define their own component - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, -} -/// Used to telect a time column. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TimeColumnSelector { - #[prost(message, optional, tag = "1")] - pub timeline: ::core::option::Option, -} -/// Used to select a component based on its EntityPath and Component name. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ComponentColumnSelector { - #[prost(message, optional, tag = "1")] - pub entity_path: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub component: ::core::option::Option, -} -/// supported encoder versions for encoding data -/// See `RerunData` and `RerunChunkData` for its usage -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum EncoderVersion { - V0 = 0, -} -impl EncoderVersion { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::V0 => "V0", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "V0" => Some(Self::V0), - _ => None, - } - } -} -/// Specifies how null values should be filled in the returned dataframe. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum SparseFillStrategy { - None = 0, - LatestAtGlobal = 1, -} -impl SparseFillStrategy { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::None => "NONE", - Self::LatestAtGlobal => "LATEST_AT_GLOBAL", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "NONE" => Some(Self::None), - "LATEST_AT_GLOBAL" => Some(Self::LatestAtGlobal), - _ => None, - } - } -} /// DataframePart is arrow IPC encoded RecordBatch #[derive(Clone, PartialEq, ::prost::Message)] pub struct DataframePart { /// encoder version used to encode the data - #[prost(enumeration = "EncoderVersion", tag = "1")] + #[prost(enumeration = "super::super::common::v0::EncoderVersion", tag = "1")] pub encoder_version: i32, /// Data payload is Arrow IPC encoded RecordBatch #[prost(bytes = "vec", tag = "1000")] @@ -275,7 +28,7 @@ pub struct RegisterRecordingRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpdateCatalogRequest { #[prost(message, optional, tag = "1")] - pub recording_id: ::core::option::Option, + pub recording_id: ::core::option::Option, #[prost(message, optional, tag = "2")] pub metadata: ::core::option::Option, } @@ -285,10 +38,10 @@ pub struct UpdateCatalogResponse {} pub struct QueryRequest { /// unique identifier of the recording #[prost(message, optional, tag = "1")] - pub recording_id: ::core::option::Option, + pub recording_id: ::core::option::Option, /// query to execute #[prost(message, optional, tag = "3")] - pub query: ::core::option::Option, + pub query: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryCatalogRequest { @@ -310,11 +63,11 @@ pub struct CatalogFilter { /// Filtering is very simple right now, we can only select /// recordings by their ids. #[prost(message, repeated, tag = "1")] - pub recording_ids: ::prost::alloc::vec::Vec, + pub recording_ids: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryCatalogResponse { - #[prost(enumeration = "EncoderVersion", tag = "1")] + #[prost(enumeration = "super::super::common::v0::EncoderVersion", tag = "1")] pub encoder_version: i32, /// raw bytes are TransportChunks (i.e. RecordBatches) encoded with the relevant codec #[prost(bytes = "vec", tag = "2")] @@ -323,7 +76,7 @@ pub struct QueryCatalogResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct FetchRecordingRequest { #[prost(message, optional, tag = "1")] - pub recording_id: ::core::option::Option, + pub recording_id: ::core::option::Option, } /// TODO(jleibs): Eventually this becomes either query-mediated in some way, but for now /// it's useful to be able to just get back the whole RRD somehow. @@ -332,7 +85,7 @@ pub struct FetchRecordingResponse { /// TODO(zehiko) we need to expand this to become something like 'encoder options' /// as we will need to specify additional options like compression, including schema /// in payload, etc. - #[prost(enumeration = "EncoderVersion", tag = "1")] + #[prost(enumeration = "super::super::common::v0::EncoderVersion", tag = "1")] pub encoder_version: i32, /// payload is raw bytes that the relevant codec can interpret #[prost(bytes = "vec", tag = "2")] @@ -515,7 +268,7 @@ pub mod storage_node_client { &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< - tonic::Response>, + tonic::Response>, tonic::Status, > { self.inner.ready().await.map_err(|e| { @@ -619,7 +372,10 @@ pub mod storage_node_server { ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the FetchRecording method. type FetchRecordingStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result, + Item = std::result::Result< + super::super::super::common::v0::RerunChunk, + tonic::Status, + >, > + std::marker::Send + 'static; async fn fetch_recording( @@ -766,7 +522,7 @@ pub mod storage_node_server { tonic::server::ServerStreamingService for FetchRecordingSvc { - type Response = super::RerunChunk; + type Response = super::super::super::common::v0::RerunChunk; type ResponseStream = T::FetchRecordingStream; type Future = BoxFuture, tonic::Status>; diff --git a/crates/utils/re_tuid/Cargo.toml b/crates/utils/re_tuid/Cargo.toml index 248f40c7b96f..3591c5e5c8ac 100644 --- a/crates/utils/re_tuid/Cargo.toml +++ b/crates/utils/re_tuid/Cargo.toml @@ -27,6 +27,8 @@ serde = ["dep:serde"] [dependencies] +re_protos.workspace = true + document-features.workspace = true getrandom.workspace = true once_cell.workspace = true diff --git a/crates/utils/re_tuid/src/lib.rs b/crates/utils/re_tuid/src/lib.rs index e50ed36c66ef..b95d8bd9fec9 100644 --- a/crates/utils/re_tuid/src/lib.rs +++ b/crates/utils/re_tuid/src/lib.rs @@ -6,6 +6,8 @@ #![doc = document_features::document_features!()] //! +mod protobuf_conversions; + #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Tuid { diff --git a/crates/utils/re_tuid/src/protobuf_conversions.rs b/crates/utils/re_tuid/src/protobuf_conversions.rs new file mode 100644 index 000000000000..2dfd04627d4b --- /dev/null +++ b/crates/utils/re_tuid/src/protobuf_conversions.rs @@ -0,0 +1,17 @@ +impl From for crate::Tuid { + fn from(value: re_protos::common::v0::Tuid) -> Self { + Self { + time_ns: value.time_ns, + inc: value.inc, + } + } +} + +impl From for re_protos::common::v0::Tuid { + fn from(value: crate::Tuid) -> Self { + Self { + time_ns: value.time_ns, + inc: value.inc, + } + } +} diff --git a/pixi.toml b/pixi.toml index 93d423976d6e..4448ca0b884a 100644 --- a/pixi.toml +++ b/pixi.toml @@ -125,10 +125,8 @@ check-env = "python scripts/check_env.py" # Run the codegen. Optionally pass `--profile` argument if you want. codegen = "cargo --quiet run --package re_types_builder -- " -# Deprecated: use `codegen-proto` instead. -codegen-rstore = "echo '⚠️ Deprecated: use `codegen-proto` instead ⚠️' ; pixi run codegen-proto" -# Run the codegen for our Protobuf/gRPC definitions. -codegen-proto = "cargo --quiet run --package re_protos_builder && pixi run -e cpp format" +# Run the codegen for protobuf types. +codegen-protos = "cargo --quiet run --package re_protos_builder && cargo fmt --all" # Generate the Rerun CLI manual. diff --git a/rerun_py/Cargo.toml b/rerun_py/Cargo.toml index 397434ddc986..b9c5db4e9840 100644 --- a/rerun_py/Cargo.toml +++ b/rerun_py/Cargo.toml @@ -62,6 +62,7 @@ re_chunk = { workspace = true, features = ["arrow"] } re_chunk_store.workspace = true re_dataframe.workspace = true re_log = { workspace = true, features = ["setup"] } +re_log_encoding = { workspace = true } re_log_types.workspace = true re_memory.workspace = true re_sdk = { workspace = true, features = ["data_loaders"] } diff --git a/rerun_py/src/remote.rs b/rerun_py/src/remote.rs index 2980df6e084f..b8af391dd922 100644 --- a/rerun_py/src/remote.rs +++ b/rerun_py/src/remote.rs @@ -9,13 +9,13 @@ use pyo3::{exceptions::PyRuntimeError, prelude::*, types::PyDict, Bound, PyResul use re_chunk::{Chunk, TransportChunk}; use re_chunk_store::ChunkStore; use re_dataframe::ChunkStoreHandle; +use re_log_encoding::codec::wire::{decode, encode}; use re_log_types::{StoreInfo, StoreSource}; use re_protos::{ - codec::{decode, encode}, - v0::{ - storage_node_client::StorageNodeClient, DataframePart, EncoderVersion, - FetchRecordingRequest, QueryCatalogRequest, RecordingId, RecordingType, - RegisterRecordingRequest, UpdateCatalogRequest, + common::v0::{EncoderVersion, RecordingId}, + remote_store::v0::{ + storage_node_client::StorageNodeClient, DataframePart, FetchRecordingRequest, + QueryCatalogRequest, RecordingType, RegisterRecordingRequest, UpdateCatalogRequest, }, }; use re_sdk::{ApplicationId, StoreId, StoreKind, Time}; diff --git a/scripts/lint.py b/scripts/lint.py index f60358192e93..6f703f647143 100755 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -1223,7 +1223,7 @@ def main() -> None: "./.pytest_cache", "./CODE_STYLE.md", "./crates/build/re_types_builder/src/reflection.rs", # auto-generated - "./crates/store/re_protos/src/v0/rerun.remote_store.v0.rs", # auto-generated + "./crates/store/re_protos/src/v0", # auto-generated "./docs/content/concepts/app-model.md", # this really needs custom letter casing "./docs/content/reference/cli.md", # auto-generated "./docs/snippets/all/tutorials/custom-application-id.cpp", # nuh-uh, I don't want rerun_example_ here From 120cf0a066dfda5ec36b694e4178a3337149c089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Tue, 10 Dec 2024 15:27:23 +0100 Subject: [PATCH 11/71] Add link to `+main`, `+nightly` manifest in CI bot comment (#8384) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What Title. (Check PR comment) --------- Co-authored-by: Jan Procházka --- .github/workflows/reusable_upload_web.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable_upload_web.yml b/.github/workflows/reusable_upload_web.yml index f7011908a850..54f21b14cc44 100644 --- a/.github/workflows/reusable_upload_web.yml +++ b/.github/workflows/reusable_upload_web.yml @@ -151,9 +151,9 @@ jobs: - [ ] I have tested the web viewer - | Result | Commit | Link | - | ------ | ------- | ----- | - | ✅ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | + | Result | Commit | Link | Manifest | + | ------ | ------- | ---- | -------- | + | ✅ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | [+nightly](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) [+main](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) | Note: This comment is updated whenever you push a commit. From a7fc56f633add3a0056e701b2f76229aa7564c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Tue, 10 Dec 2024 16:25:20 +0100 Subject: [PATCH 12/71] Add manifest links to other bot comments for consistency (#8397) Also wraps each manifest in a `` tag for :sparkles:. ### Related * #8384. ### What Title. --- .github/workflows/reusable_build_web.yml | 12 ++++++------ .github/workflows/reusable_upload_web.yml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/reusable_build_web.yml b/.github/workflows/reusable_build_web.yml index 148bcd435e01..515f1aee6248 100644 --- a/.github/workflows/reusable_build_web.yml +++ b/.github/workflows/reusable_build_web.yml @@ -71,9 +71,9 @@ jobs: message: | Web viewer is being built. - | Result | Commit | Link | - | ------ | ------- | ----- | - | ⏳ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | + | Result | Commit | Link | Manifest | + | ------ | ------- | ----- | -------- | + | ⏳ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | [`+nightly`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) [`+main`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) | Note: This comment is updated whenever you push a commit. @@ -125,8 +125,8 @@ jobs: message: | Web viewer failed to build. - | Result | Commit | Link | - | ------ | ------- | ----- | - | ❌ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | + | Result | Commit | Link | Manifest | + | ------ | ------- | ----- | -------- | + | ❌ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | [`+nightly`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) [`+main`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) | Note: This comment is updated whenever you push a commit. diff --git a/.github/workflows/reusable_upload_web.yml b/.github/workflows/reusable_upload_web.yml index 54f21b14cc44..17718064f748 100644 --- a/.github/workflows/reusable_upload_web.yml +++ b/.github/workflows/reusable_upload_web.yml @@ -153,7 +153,7 @@ jobs: | Result | Commit | Link | Manifest | | ------ | ------- | ---- | -------- | - | ✅ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | [+nightly](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) [+main](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) | + | ✅ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | [`+nightly`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) [`+main`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) | Note: This comment is updated whenever you push a commit. @@ -167,8 +167,8 @@ jobs: message: | Web viewer failed to build. - | Result | Commit | Link | + | Result | Commit | Link | Manifest | | ------ | ------- | ----- | - | ❌ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | + | ❌ | ${{ steps.get-sha.outputs.sha }} | https://rerun.io/viewer/pr/${{ github.event.pull_request.number }} | [`+nightly`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) [`+main`](https://rerun.io/viewer/pr/${{ github.event.pull_request.number }}?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) | Note: This comment is updated whenever you push a commit. From 67515eedba76f9a05c78a36e9348a6160e9a5572 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Tue, 10 Dec 2024 16:50:52 +0100 Subject: [PATCH 13/71] Improved 'rrd print' (#8392) An improved `rrd print` that I had sitting in my stash, which coincidentally just helped me find the issue with https://github.com/rerun-io/rerun/issues/8389. ``` $ pixi run rerun rrd print --help Print the contents of one or more .rrd/.rbl files/streams. Reads from standard input if no paths are specified. Example: `rerun rrd print /my/recordings/*.rrd` Usage: rerun rrd print [OPTIONS] [PATH_TO_INPUT_RRDS]... Arguments: [PATH_TO_INPUT_RRDS]... Paths to read from. Reads from standard input if none are specified Options: -v, --verbose... If set, print out table contents. This can be specified more than once to toggle more and more verbose levels (e.g. -vvv): * default: summary with short names. * `-v`: summary with fully-qualified names. * `-vv`: show all chunk metadata headers, keep the data hidden. * `-vvv`: show all chunk metadata headers as well as the data itself. --continue-on-error If set, will try to proceed even in the face of IO and/or decoding errors in the input data -h, --help Print help (see a summary with '-h') ``` --- crates/top/rerun/src/commands/rrd/print.rs | 50 +++++++++++++++------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/crates/top/rerun/src/commands/rrd/print.rs b/crates/top/rerun/src/commands/rrd/print.rs index e1ec9ab64588..2d513c8fc091 100644 --- a/crates/top/rerun/src/commands/rrd/print.rs +++ b/crates/top/rerun/src/commands/rrd/print.rs @@ -1,5 +1,5 @@ use anyhow::Context; -use itertools::Itertools as _; +use itertools::Itertools; use re_log_types::{LogMsg, SetStoreInfo}; use re_sdk::log::Chunk; @@ -15,8 +15,18 @@ pub struct PrintCommand { path_to_input_rrds: Vec, /// If set, print out table contents. - #[clap(long, short, default_value_t = false)] - verbose: bool, + /// + /// This can be specified more than once to toggle more and more verbose levels (e.g. -vvv): + /// + /// * default: summary with short names. + /// + /// * `-v`: summary with fully-qualified names. + /// + /// * `-vv`: show all chunk metadata headers, keep the data hidden. + /// + /// * `-vvv`: show all chunk metadata headers as well as the data itself. + #[clap(long, short, action = clap::ArgAction::Count)] + verbose: u8, /// If set, will try to proceed even in the face of IO and/or decoding errors in the input data. #[clap(long = "continue-on-error", default_value_t = true)] @@ -63,7 +73,7 @@ impl PrintCommand { } } -fn print_msg(verbose: bool, msg: LogMsg) -> anyhow::Result<()> { +fn print_msg(verbose: u8, msg: LogMsg) -> anyhow::Result<()> { match msg { LogMsg::SetStoreInfo(msg) => { let SetStoreInfo { row_id: _, info } = msg; @@ -73,21 +83,31 @@ fn print_msg(verbose: bool, msg: LogMsg) -> anyhow::Result<()> { LogMsg::ArrowMsg(_row_id, arrow_msg) => { let chunk = Chunk::from_arrow_msg(&arrow_msg).context("skipped corrupt chunk")?; - if verbose { - println!("{chunk}"); - } else { + print!( + "Chunk({}) with {} rows ({}) - {:?} - ", + chunk.id(), + chunk.num_rows(), + re_format::format_bytes(chunk.total_size_bytes() as _), + chunk.entity_path(), + ); + + if verbose == 0 { let column_names = chunk .component_names() .map(|name| name.short_name()) .join(" "); - - println!( - "Chunk({}) with {} rows ({}) - {:?} - columns: [{column_names}]", - chunk.id(), - chunk.num_rows(), - re_format::format_bytes(chunk.total_size_bytes() as _), - chunk.entity_path(), - ); + println!("columns: [{column_names}]"); + } else if verbose == 1 { + let column_descriptors = chunk + .component_descriptors() + .map(|descr| descr.short_name()) + .collect_vec() + .join(" "); + println!("columns: [{column_descriptors}]",); + } else if verbose == 2 { + println!("\n{}", chunk.emptied()); // headers only + } else { + println!("\n{chunk}"); } } From a826845f06a09118f1d443e4cc022ee14103aa3e Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Tue, 10 Dec 2024 17:31:41 +0100 Subject: [PATCH 14/71] Store: only run the debug assertion against recordings (not blueprints) (#8393) I'd like to keep that assertion a bit longer, just in case. So for now just ignore blueprints, as they are problematic in that case. * Fixes #8389 --- crates/store/re_chunk_store/src/writes.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/crates/store/re_chunk_store/src/writes.rs b/crates/store/re_chunk_store/src/writes.rs index d3dd66f47776..eee187b16a4f 100644 --- a/crates/store/re_chunk_store/src/writes.rs +++ b/crates/store/re_chunk_store/src/writes.rs @@ -30,19 +30,26 @@ impl ChunkStore { pub fn insert_chunk(&mut self, chunk: &Arc) -> ChunkStoreResult> { if self.chunks_per_chunk_id.contains_key(&chunk.id()) { // We assume that chunk IDs are unique, and that reinserting a chunk has no effect. - re_log::warn_once!( + re_log::debug_once!( "Chunk #{} was inserted more than once (this has no effect)", chunk.id() ); return Ok(Vec::new()); } + // NOTE: It is very easy to end in a situation where one pulls an old blueprint from + // somewhere, and then modifies it at runtime, therefore ending with both tagged and + // untagged components in the data. + // I'd like to keep this debug assertion a tiny bit longer just in case, so for we just + // ignore blueprints. #[cfg(debug_assertions)] - for (component_name, per_desc) in chunk.components().iter() { - assert!( - per_desc.len() <= 1, - "Insert Chunk with multiple values for component named `{component_name}`: this is currently UB", - ); + if self.id.kind == re_log_types::StoreKind::Recording { + for (component_name, per_desc) in chunk.components().iter() { + assert!( + per_desc.len() <= 1, + "Insert Chunk with multiple values for component named `{component_name}`: this is currently UB", + ); + } } if !chunk.is_sorted() { From 17c007591907a701ea341fd47233e02f8a39f07d Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Tue, 10 Dec 2024 17:32:11 +0100 Subject: [PATCH 15/71] `codegen/docs/mod.rs` -> `codegen/docs/website.rs` (#8382) Pure refactor: migrate website docs to their own module, so that we can add new code generators later. --- .../re_types_builder/src/codegen/docs/mod.rs | 787 +----------------- .../src/codegen/docs/website.rs | 785 +++++++++++++++++ docs/content/reference/types/archetypes.md | 2 +- .../types/archetypes/annotation_context.md | 2 +- .../reference/types/archetypes/arrows2d.md | 2 +- .../reference/types/archetypes/arrows3d.md | 2 +- .../reference/types/archetypes/asset3d.md | 2 +- .../reference/types/archetypes/asset_video.md | 2 +- .../reference/types/archetypes/bar_chart.md | 2 +- .../reference/types/archetypes/boxes2d.md | 2 +- .../reference/types/archetypes/boxes3d.md | 2 +- .../reference/types/archetypes/capsules3d.md | 2 +- .../reference/types/archetypes/clear.md | 2 +- .../reference/types/archetypes/depth_image.md | 2 +- .../types/archetypes/disconnected_space.md | 2 +- .../types/archetypes/ellipsoids3d.md | 2 +- .../types/archetypes/encoded_image.md | 2 +- .../types/archetypes/geo_line_strings.md | 2 +- .../reference/types/archetypes/geo_points.md | 2 +- .../reference/types/archetypes/graph_edges.md | 2 +- .../reference/types/archetypes/graph_nodes.md | 2 +- .../reference/types/archetypes/image.md | 2 +- .../types/archetypes/instance_poses3d.md | 2 +- .../types/archetypes/line_strips2d.md | 2 +- .../types/archetypes/line_strips3d.md | 2 +- .../reference/types/archetypes/mesh3d.md | 2 +- .../reference/types/archetypes/pinhole.md | 2 +- .../reference/types/archetypes/points2d.md | 2 +- .../reference/types/archetypes/points3d.md | 2 +- .../reference/types/archetypes/scalar.md | 2 +- .../types/archetypes/segmentation_image.md | 2 +- .../reference/types/archetypes/series_line.md | 2 +- .../types/archetypes/series_point.md | 2 +- .../reference/types/archetypes/tensor.md | 2 +- .../types/archetypes/text_document.md | 2 +- .../reference/types/archetypes/text_log.md | 2 +- .../reference/types/archetypes/transform3d.md | 2 +- .../types/archetypes/video_frame_reference.md | 2 +- .../types/archetypes/view_coordinates.md | 2 +- docs/content/reference/types/components.md | 2 +- .../types/components/aggregation_policy.md | 2 +- .../types/components/albedo_factor.md | 2 +- .../types/components/annotation_context.md | 2 +- .../reference/types/components/axis_length.md | 2 +- .../reference/types/components/blob.md | 2 +- .../reference/types/components/class_id.md | 2 +- .../types/components/clear_is_recursive.md | 2 +- .../reference/types/components/color.md | 2 +- .../reference/types/components/colormap.md | 2 +- .../reference/types/components/depth_meter.md | 2 +- .../types/components/disconnected_space.md | 2 +- .../reference/types/components/draw_order.md | 2 +- .../reference/types/components/entity_path.md | 2 +- .../reference/types/components/fill_mode.md | 2 +- .../reference/types/components/fill_ratio.md | 2 +- .../types/components/gamma_correction.md | 2 +- .../types/components/geo_line_string.md | 2 +- .../reference/types/components/graph_edge.md | 2 +- .../reference/types/components/graph_node.md | 2 +- .../reference/types/components/graph_type.md | 2 +- .../reference/types/components/half_size2d.md | 2 +- .../reference/types/components/half_size3d.md | 2 +- .../types/components/image_buffer.md | 2 +- .../types/components/image_format.md | 2 +- .../types/components/image_plane_distance.md | 2 +- .../reference/types/components/keypoint_id.md | 2 +- .../reference/types/components/lat_lon.md | 2 +- .../reference/types/components/length.md | 2 +- .../types/components/line_strip2d.md | 2 +- .../types/components/line_strip3d.md | 2 +- .../types/components/magnification_filter.md | 2 +- .../types/components/marker_shape.md | 2 +- .../reference/types/components/marker_size.md | 2 +- .../reference/types/components/media_type.md | 2 +- .../reference/types/components/name.md | 2 +- .../reference/types/components/opacity.md | 2 +- .../types/components/pinhole_projection.md | 2 +- .../reference/types/components/plane3d.md | 2 +- .../components/pose_rotation_axis_angle.md | 2 +- .../types/components/pose_rotation_quat.md | 2 +- .../types/components/pose_scale3d.md | 2 +- .../types/components/pose_transform_mat3x3.md | 2 +- .../types/components/pose_translation3d.md | 2 +- .../reference/types/components/position2d.md | 2 +- .../reference/types/components/position3d.md | 2 +- .../reference/types/components/radius.md | 2 +- .../reference/types/components/range1d.md | 2 +- .../types/components/recording_uri.md | 2 +- .../reference/types/components/resolution.md | 2 +- .../types/components/rotation_axis_angle.md | 2 +- .../types/components/rotation_quat.md | 2 +- .../reference/types/components/scalar.md | 2 +- .../reference/types/components/scale3d.md | 2 +- .../reference/types/components/show_labels.md | 2 +- .../types/components/stroke_width.md | 2 +- .../reference/types/components/tensor_data.md | 2 +- .../tensor_dimension_index_selection.md | 2 +- .../components/tensor_height_dimension.md | 2 +- .../components/tensor_width_dimension.md | 2 +- .../reference/types/components/texcoord2d.md | 2 +- .../reference/types/components/text.md | 2 +- .../types/components/text_log_level.md | 2 +- .../types/components/transform_mat3x3.md | 2 +- .../types/components/transform_relation.md | 2 +- .../types/components/translation3d.md | 2 +- .../types/components/triangle_indices.md | 2 +- .../reference/types/components/value_range.md | 2 +- .../reference/types/components/vector2d.md | 2 +- .../reference/types/components/vector3d.md | 2 +- .../types/components/video_timestamp.md | 2 +- .../types/components/view_coordinates.md | 2 +- docs/content/reference/types/datatypes.md | 2 +- .../reference/types/datatypes/angle.md | 2 +- .../types/datatypes/annotation_info.md | 2 +- .../content/reference/types/datatypes/blob.md | 2 +- .../content/reference/types/datatypes/bool.md | 2 +- .../types/datatypes/channel_datatype.md | 2 +- .../types/datatypes/class_description.md | 2 +- .../datatypes/class_description_map_elem.md | 2 +- .../reference/types/datatypes/class_id.md | 2 +- .../reference/types/datatypes/color_model.md | 2 +- .../reference/types/datatypes/dvec2d.md | 2 +- .../reference/types/datatypes/entity_path.md | 2 +- .../reference/types/datatypes/float32.md | 2 +- .../reference/types/datatypes/float64.md | 2 +- .../reference/types/datatypes/image_format.md | 2 +- .../reference/types/datatypes/keypoint_id.md | 2 +- .../types/datatypes/keypoint_pair.md | 2 +- .../reference/types/datatypes/mat3x3.md | 2 +- .../reference/types/datatypes/mat4x4.md | 2 +- .../reference/types/datatypes/pixel_format.md | 2 +- .../reference/types/datatypes/plane3d.md | 2 +- .../reference/types/datatypes/quaternion.md | 2 +- .../reference/types/datatypes/range1d.md | 2 +- .../reference/types/datatypes/range2d.md | 2 +- .../reference/types/datatypes/rgba32.md | 2 +- .../types/datatypes/rotation_axis_angle.md | 2 +- .../types/datatypes/tensor_buffer.md | 2 +- .../reference/types/datatypes/tensor_data.md | 2 +- .../types/datatypes/tensor_dimension.md | 2 +- .../tensor_dimension_index_selection.md | 2 +- .../datatypes/tensor_dimension_selection.md | 2 +- .../reference/types/datatypes/time_int.md | 2 +- .../reference/types/datatypes/time_range.md | 2 +- .../types/datatypes/time_range_boundary.md | 2 +- .../reference/types/datatypes/uint16.md | 2 +- .../reference/types/datatypes/uint32.md | 2 +- .../reference/types/datatypes/uint64.md | 2 +- .../content/reference/types/datatypes/utf8.md | 2 +- .../reference/types/datatypes/utf8pair.md | 2 +- .../content/reference/types/datatypes/uuid.md | 2 +- .../reference/types/datatypes/uvec2d.md | 2 +- .../reference/types/datatypes/uvec3d.md | 2 +- .../reference/types/datatypes/uvec4d.md | 2 +- .../reference/types/datatypes/vec2d.md | 2 +- .../reference/types/datatypes/vec3d.md | 2 +- .../reference/types/datatypes/vec4d.md | 2 +- .../types/datatypes/video_timestamp.md | 2 +- .../types/datatypes/view_coordinates.md | 2 +- .../types/datatypes/visible_time_range.md | 2 +- docs/content/reference/types/views.md | 2 +- .../reference/types/views/bar_chart_view.md | 2 +- .../reference/types/views/dataframe_view.md | 2 +- .../reference/types/views/graph_view.md | 2 +- .../content/reference/types/views/map_view.md | 2 +- .../reference/types/views/spatial2d_view.md | 2 +- .../reference/types/views/spatial3d_view.md | 2 +- .../reference/types/views/tensor_view.md | 2 +- .../types/views/text_document_view.md | 2 +- .../reference/types/views/text_log_view.md | 2 +- .../reference/types/views/time_series_view.md | 2 +- 171 files changed, 956 insertions(+), 954 deletions(-) create mode 100644 crates/build/re_types_builder/src/codegen/docs/website.rs diff --git a/crates/build/re_types_builder/src/codegen/docs/mod.rs b/crates/build/re_types_builder/src/codegen/docs/mod.rs index b2ca29c0174f..e1ec8edeaa1e 100644 --- a/crates/build/re_types_builder/src/codegen/docs/mod.rs +++ b/crates/build/re_types_builder/src/codegen/docs/mod.rs @@ -1,787 +1,4 @@ -//! Generate the markdown files shown at . - mod arrow_datatype; +mod website; -use std::{collections::BTreeMap, fmt::Write}; - -use camino::Utf8PathBuf; -use itertools::Itertools; - -use crate::{ - codegen::{autogen_warning, common::ExampleInfo, Target}, - objects::{FieldKind, ViewReference}, - CodeGenerator, GeneratedFiles, Object, ObjectField, ObjectKind, Objects, Reporter, Type, -}; - -pub const DATAFRAME_VIEW_FQNAME: &str = "rerun.blueprint.views.DataframeView"; - -/// Like [`writeln!`], but without a [`Result`]. -macro_rules! putln { - ($o:ident) => ( { writeln!($o).ok(); } ); - ($o:ident, $($tt:tt)*) => ( { writeln!($o, $($tt)*).unwrap(); } ); -} - -pub struct DocsCodeGenerator { - docs_dir: Utf8PathBuf, -} - -impl DocsCodeGenerator { - pub fn new(docs_dir: impl Into) -> Self { - Self { - docs_dir: docs_dir.into(), - } - } -} - -type ViewsPerArchetype = BTreeMap>; - -impl CodeGenerator for DocsCodeGenerator { - fn generate( - &mut self, - reporter: &Reporter, - objects: &Objects, - arrow_registry: &crate::ArrowRegistry, - ) -> GeneratedFiles { - re_tracing::profile_function!(); - - let mut files_to_write = GeneratedFiles::default(); - - // Gather view type mapping per object. - let views_per_archetype = collect_view_types_per_archetype(objects); - - let (mut archetypes, mut components, mut datatypes, mut views) = - (Vec::new(), Vec::new(), Vec::new(), Vec::new()); - - for object in objects.values() { - // skip test-only archetypes - if object.is_testing() { - continue; - } - - // Skip blueprint stuff, too early - if object.scope() == Some("blueprint".to_owned()) && object.kind != ObjectKind::View { - continue; - } - - match object.kind { - ObjectKind::Datatype => datatypes.push(object), - ObjectKind::Component => components.push(object), - ObjectKind::Archetype => archetypes.push(object), - ObjectKind::View => views.push(object), - } - - let page = object_page( - reporter, - objects, - object, - arrow_registry, - &views_per_archetype, - ); - let path = self.docs_dir.join(format!( - "{}/{}.md", - object.kind.plural_snake_case(), - object.snake_case_name() - )); - files_to_write.insert(path, page); - } - - for (kind, order, prelude, kind_objects) in [ - ( - ObjectKind::Archetype, - 1, - r"Archetypes are bundles of components for which the Rerun viewer has first-class -built-in support. When logged, each archetype also includes an _indicator component_ which captures -the intent of the logging code and triggers the activation of the corresponding visualizers. See -[Entities and Components](../../concepts/entity-component.md) and -[Visualizers and Overrides](../../concepts/visualizers-and-overrides.md) for more information. - -This page lists all built-in archetypes.", - &archetypes, - ), - ( - ObjectKind::Component, - 2, - r"Components are the fundamental unit of logging in Rerun. This page lists all built-in components. - -An entity can only ever contain a single array of any given component type. -If you log the same component several times on an entity, the last value (or array of values) will overwrite the previous. - -For more information on the relationship between **archetypes** and **components**, check out the concept page -on [Entities and Components](../../concepts/entity-component.md).", - &components, - ), - ( - ObjectKind::Datatype, - 3, - r"Data types are the lowest layer of the data model hierarchy. They are re-usable types used by the components.", - &datatypes, - ), - ( - ObjectKind::View, - 4, - r"Views are the panels shown in the viewer's viewport and the primary means of inspecting & visualizing previously logged data. This page lists all built-in views.", - &views, - ), - ] { - let page = index_page(reporter, objects, kind, order, prelude, kind_objects); - let path = self - .docs_dir - .join(format!("{}.md", kind.plural_snake_case())); - files_to_write.insert(path, page); - } - - files_to_write - } -} - -fn collect_view_types_per_archetype(objects: &Objects) -> ViewsPerArchetype { - let mut view_types_per_object = ViewsPerArchetype::new(); - for object in objects.objects.values() { - if let Some(view_types) = object.archetype_view_types() { - view_types_per_object.insert(object.fqname.clone(), view_types); - } - } - - view_types_per_object -} - -fn index_page( - reporter: &Reporter, - all_objects: &Objects, - kind: ObjectKind, - order: u64, - prelude: &str, - objects: &[&Object], -) -> String { - let mut page = String::new(); - - write_frontmatter(&mut page, kind.plural_name(), Some(order)); - putln!(page); - putln!(page, "{prelude}"); - putln!(page); - - let mut any_category = false; - for (category, objects) in &objects - .iter() - .sorted_by(|a, b| { - // Put other category last. - if a.doc_category().is_none() { - std::cmp::Ordering::Greater - } else if b.doc_category().is_none() { - std::cmp::Ordering::Less - } else { - a.doc_category().cmp(&b.doc_category()) - } - }) - .chunk_by(|o| o.doc_category()) - { - if category.is_some() { - any_category = true; - } - if let Some(category) = category.or_else(|| { - if any_category { - Some("Other".to_owned()) - } else { - None - } - }) { - putln!(page, "## {category}"); - } - putln!(page); - - for object in objects.sorted_by_key(|object| &object.name) { - let deprecation_note = if object.deprecation_notice().is_some() { - "⚠️ _deprecated_ " - } else { - "" - }; - - putln!( - page, - "* {deprecation_note}[`{}`]({}/{}.md): {}", - object.name, - object.kind.plural_snake_case(), - object.snake_case_name(), - object - .docs - .first_line(reporter, all_objects, Target::WebDocsMarkdown) - .unwrap_or_default(), - ); - } - putln!(page); - } - - page -} - -fn object_page( - reporter: &Reporter, - objects: &Objects, - object: &Object, - arrow_registry: &crate::ArrowRegistry, - views_per_archetype: &ViewsPerArchetype, -) -> String { - let is_unreleased = object.is_attr_set(crate::ATTR_DOCS_UNRELEASED); - let is_experimental = object.is_experimental(); - - let top_level_docs = object - .docs - .lines_for(reporter, objects, Target::WebDocsMarkdown); - - if top_level_docs.is_empty() { - reporter.error(&object.virtpath, &object.fqname, "Undocumented object"); - } - - let examples = &object.docs.only_lines_tagged("example"); - let examples = examples - .iter() - .map(|line| ExampleInfo::parse(line)) - .collect::>(); - - let mut page = String::new(); - - let title = if object.deprecation_notice().is_some() { - format!("{} (deprecated)", object.name) - } else { - object.name.clone() - }; - - write_frontmatter(&mut page, &title, None); - putln!(page); - - if is_experimental { - putln!(page); - putln!( - page, - "⚠️ **This is an experimental API! It is not fully supported, and is likely to change significantly in future versions.**" - ); - putln!(page); - } - - if let Some(deprecation_notice) = object.deprecation_notice() { - putln!( - page, - "**⚠️ This type is deprecated and may be removed in future versions**" - ); - putln!(page, "{deprecation_notice}"); - putln!(page); - } - - for line in top_level_docs { - putln!(page, "{line}"); - } - putln!(page); - - match object.kind { - ObjectKind::Datatype | ObjectKind::Component => { - write_fields(reporter, objects, &mut page, object); - } - ObjectKind::Archetype => { - write_archetype_fields(objects, &mut page, object, views_per_archetype); - } - ObjectKind::View => { - write_view_properties(reporter, objects, &mut page, object); - } - } - - if matches!(object.kind, ObjectKind::Datatype | ObjectKind::Component) { - let datatype = &arrow_registry.get(&object.fqname); - putln!(page); - putln!(page, "## Arrow datatype"); - putln!(page, "```"); - arrow_datatype::arrow2_datatype_docs(&mut page, datatype); - putln!(page); - putln!(page, "```"); - } - - putln!(page); - putln!(page, "## API reference links"); - list_links(is_unreleased, &mut page, object); - - putln!(page); - write_example_list(&mut page, &examples); - - match object.kind { - ObjectKind::Datatype | ObjectKind::Component => { - putln!(page); - write_used_by(&mut page, reporter, objects, object); - } - ObjectKind::Archetype => { - if examples.is_empty() { - if object.virtpath.starts_with("//testing") { - // do nothing - } else if object.virtpath.starts_with("//archetypes") { - // actual public archetypes: hard error - reporter.error(&object.virtpath, &object.fqname, "No examples"); - } else { - // everything else (including experimental blueprint stuff): simple warning - reporter.warn(&object.virtpath, &object.fqname, "No examples"); - } - } - } - ObjectKind::View => { - putln!(page); - write_visualized_archetypes(reporter, objects, &mut page, object, views_per_archetype); - } - } - - page -} - -fn list_links(is_unreleased: bool, page: &mut String, object: &Object) { - let speculative_marker = if is_unreleased { - "?speculative-link" - } else { - "" - }; - - if object.kind == ObjectKind::View { - // More complicated link due to scope - putln!( - page, - " * 🐍 [Python API docs for `{}`](https://ref.rerun.io/docs/python/stable/common/{}_{}{}#rerun.{}.{}.{})", - object.name, - object.scope().unwrap_or_default(), - object.kind.plural_snake_case(), - speculative_marker, - object.scope().unwrap_or_default(), - object.kind.plural_snake_case(), - object.name - ); - } else { - let cpp_link = if object.is_enum() { - // Can't link to enums directly 🤷 - format!( - "https://ref.rerun.io/docs/cpp/stable/namespacererun_1_1{}.html", - object.kind.plural_snake_case() - ) - } else { - // `_1` is doxygen's replacement for ':' - // https://github.com/doxygen/doxygen/blob/Release_1_9_8/src/util.cpp#L3532 - format!( - "https://ref.rerun.io/docs/cpp/stable/structrerun_1_1{}_1_1{}.html", - object.kind.plural_snake_case(), - object.name - ) - }; - - // In alphabetical order by language. - putln!( - page, - " * 🌊 [C++ API docs for `{}`]({cpp_link}{speculative_marker})", - object.name, - ); - - putln!( - page, - " * 🐍 [Python API docs for `{}`](https://ref.rerun.io/docs/python/stable/common/{}{}#rerun.{}.{})", - object.name, - object.module_name().replace('/', "_"), // E.g. `blueprint_archetypes` - speculative_marker, - object.module_name().replace('/', "."), // E.g. `blueprint.archetypes` - object.name - ); - - putln!( - page, - " * 🦀 [Rust API docs for `{}`](https://docs.rs/rerun/latest/rerun/{}/{}.{}.html{speculative_marker})", - object.name, - object.kind.plural_snake_case(), - if object.is_struct() { "struct" } else { "enum" }, - object.name, - ); - } -} - -fn write_frontmatter(o: &mut String, title: &str, order: Option) { - putln!(o, "---"); - putln!(o, "title: {title:?}"); - if let Some(order) = order { - // The order is used to sort `rerun.io/docs` side navigation - putln!(o, "order: {order}"); - } - putln!(o, "---"); - // Can't put the autogen warning before the frontmatter, stuff breaks down then. - putln!(o, "", autogen_warning!()); -} - -fn write_fields(reporter: &Reporter, objects: &Objects, o: &mut String, object: &Object) { - if object.fields.is_empty() { - return; - } - - fn type_info(objects: &Objects, ty: &Type) -> String { - fn atomic(name: &str) -> String { - format!("`{name}`") - } - - match ty { - Type::Unit => unreachable!("Should be handled elsewhere"), - - // We use explicit, arrow-like names: - Type::UInt8 => atomic("uint8"), - Type::UInt16 => atomic("uint16"), - Type::UInt32 => atomic("uint32"), - Type::UInt64 => atomic("uint64"), - Type::Int8 => atomic("int8"), - Type::Int16 => atomic("int16"), - Type::Int32 => atomic("int32"), - Type::Int64 => atomic("int64"), - Type::Bool => atomic("boolean"), - Type::Float16 => atomic("float16"), - Type::Float32 => atomic("float32"), - Type::Float64 => atomic("float64"), - Type::String => atomic("utf8"), - - Type::Array { elem_type, length } => { - format!( - "{length}x {}", - type_info(objects, &Type::from(elem_type.clone())) - ) - } - Type::Vector { elem_type } => { - format!( - "List of {}", - type_info(objects, &Type::from(elem_type.clone())) - ) - } - Type::Object(fqname) => { - let ty = objects.get(fqname).unwrap(); - format!( - "[`{}`](../{}/{}.md)", - ty.name, - ty.kind.plural_snake_case(), - ty.snake_case_name() - ) - } - } - } - - if object.is_arrow_transparent() { - assert!(object.is_struct()); - assert_eq!(object.fields.len(), 1); - let field_type = &object.fields[0].typ; - if object.kind == ObjectKind::Component && matches!(field_type, Type::Object(_)) { - putln!(o, "## Rerun datatype"); - putln!(o, "{}", type_info(objects, field_type)); - putln!(o); - } else { - // The arrow datatype section covers it - } - return; // This is just a wrapper type, so don't show the "Fields" section - } - - let mut fields = Vec::new(); - for field in &object.fields { - let mut field_string = format!("#### `{}`", field.name); - - if let Some(enum_value) = field.enum_value { - field_string.push_str(&format!(" = {enum_value}")); - } - field_string.push('\n'); - - if !object.is_enum() { - field_string.push_str("Type: "); - if field.typ == Type::Unit { - field_string.push_str("`null`"); - } else { - if field.is_nullable { - field_string.push_str("nullable "); - } - field_string.push_str(&type_info(objects, &field.typ)); - } - field_string.push('\n'); - field_string.push('\n'); - } - - for line in field - .docs - .lines_for(reporter, objects, Target::WebDocsMarkdown) - { - field_string.push_str(&line); - field_string.push('\n'); - } - - fields.push(field_string); - } - - if !fields.is_empty() { - let heading = match object.class { - crate::ObjectClass::Struct => "## Fields", - crate::ObjectClass::Enum | crate::ObjectClass::Union => "## Variants", - }; - putln!(o, "{heading}"); - for field in fields { - putln!(o, "{field}"); - } - } -} - -fn write_used_by(o: &mut String, reporter: &Reporter, objects: &Objects, object: &Object) { - let mut used_by = Vec::new(); - for ty in objects.values() { - // Since blueprints are being skipped there used-by links should also be skipped - if ty.scope() == Some("blueprint".to_owned()) { - continue; - } - for field in &ty.fields { - if field.typ.fqname() == Some(object.fqname.as_str()) { - let is_unreleased = ty.is_attr_set(crate::ATTR_DOCS_UNRELEASED); - let speculative_marker = if is_unreleased { - "?speculative-link" - } else { - "" - }; - used_by.push(format!( - "* [`{}`](../{}/{}.md{})", - ty.name, - ty.kind.plural_snake_case(), - ty.snake_case_name(), - speculative_marker - )); - } - } - } - used_by.sort(); - used_by.dedup(); // The same datatype can be used multiple times by the same component - - if used_by.is_empty() { - // NOTE: there are some false positives here, because unions can only - // reference other tables, but they are unwrapped in the codegen. - // So for instance: `union Angle` uses `rerun.datatypes.Float32` in - // `angle.fbs`, but in the generated code that datatype is unused. - if false { - reporter.warn(&object.virtpath, &object.fqname, "Unused object"); - } - } else { - putln!(o, "## Used by"); - putln!(o); - for ty in used_by { - putln!(o, "{ty}"); - } - } -} - -fn write_archetype_fields( - objects: &Objects, - page: &mut String, - object: &Object, - view_per_archetype: &ViewsPerArchetype, -) { - if object.fields.is_empty() { - return; - } - - // collect names of field _components_ by their `FieldKind` - let (mut required, mut recommended, mut optional) = (Vec::new(), Vec::new(), Vec::new()); - for field in &object.fields { - let Some(fqname) = field.typ.fqname() else { - continue; - }; - let Some(ty) = objects.get(fqname) else { - continue; - }; - let target = match field.kind() { - Some(FieldKind::Required) => &mut required, - Some(FieldKind::Recommended) => &mut recommended, - Some(FieldKind::Optional) => &mut optional, - _ => continue, - }; - target.push(format!( - "[`{}`](../{}/{}.md)", - ty.name, - ty.kind.plural_snake_case(), - ty.snake_case_name() - )); - } - - if required.is_empty() && recommended.is_empty() && optional.is_empty() { - return; - } - - putln!(page, "## Components"); - if !required.is_empty() { - putln!(page); - putln!(page, "**Required**: {}", required.join(", ")); - } - if !recommended.is_empty() { - putln!(page); - putln!(page, "**Recommended**: {}", recommended.join(", ")); - } - if !optional.is_empty() { - putln!(page); - putln!(page, "**Optional**: {}", optional.join(", ")); - } - - putln!(page); - putln!(page, "## Shown in"); - - if let Some(view_types) = view_per_archetype.get(&object.fqname) { - for ViewReference { - view_name, - explanation, - } in view_types - { - page.push_str(&format!( - "* [{view_name}](../views/{}.md)", - re_case::to_snake_case(view_name) - )); - if let Some(explanation) = explanation { - page.push_str(&format!(" ({explanation})")); - } - putln!(page); - } - } - - // Special case for dataframe view: it can display anything. - putln!(page, "* [DataframeView](../views/dataframe_view.md)"); -} - -fn write_visualized_archetypes( - reporter: &Reporter, - objects: &Objects, - page: &mut String, - view: &Object, - views_per_archetype: &ViewsPerArchetype, -) { - let mut archetype_fqnames = Vec::new(); - for (fqname, reference) in views_per_archetype { - for ViewReference { - view_name, - explanation, - } in reference - { - if view_name == &view.name { - archetype_fqnames.push((fqname.clone(), explanation)); - } - } - } - - if archetype_fqnames.is_empty() && view.fqname != DATAFRAME_VIEW_FQNAME { - reporter.error(&view.virtpath, &view.fqname, "No archetypes use this view."); - return; - } - - // Put the archetypes in alphabetical order but put the ones with extra explanation last. - archetype_fqnames.sort_by_key(|(fqname, explanation)| (explanation.is_some(), fqname.clone())); - - putln!(page, "## Visualized archetypes"); - putln!(page); - - // special case for dataframe view - if view.fqname == DATAFRAME_VIEW_FQNAME { - putln!(page, "Any data can be displayed by the Dataframe view."); - } else { - for (fqname, explanation) in archetype_fqnames { - let object = &objects[&fqname]; - page.push_str(&format!( - "* [`{}`](../{}/{}.md)", - object.name, - object.kind.plural_snake_case(), - object.snake_case_name() - )); - if let Some(explanation) = explanation { - page.push_str(&format!(" ({explanation})")); - } - putln!(page); - } - } - putln!(page); -} - -fn write_view_properties(reporter: &Reporter, objects: &Objects, page: &mut String, view: &Object) { - if view.fields.is_empty() { - return; - } - - putln!(page, "## Properties"); - putln!(page); - - // Each field in a view should be a property - for field in &view.fields { - write_view_property(reporter, objects, page, field); - } -} - -fn write_view_property( - reporter: &Reporter, - objects: &Objects, - o: &mut String, - field: &ObjectField, -) { - putln!(o, "### `{}`", field.name); - - let top_level_docs = field - .docs - .lines_for(reporter, objects, Target::WebDocsMarkdown); - - if top_level_docs.is_empty() { - reporter.error(&field.virtpath, &field.fqname, "Undocumented view property"); - } - - for line in top_level_docs { - putln!(o, "{line}"); - } - - // If there's more than one fields on this type, list them: - let Some(field_fqname) = field.typ.fqname() else { - return; - }; - let object = &objects[field_fqname]; - - let mut fields = Vec::new(); - for field in &object.fields { - fields.push(format!( - "* `{}`: {}", - field.name, - field - .docs - .first_line(reporter, objects, Target::WebDocsMarkdown) - .unwrap_or_default() - )); - } - - if fields.len() > 1 { - putln!(o); - for field in fields { - putln!(o, "{field}"); - } - } - - // Note that we don't list links to reference docs for this type since this causes a lot of clutter. -} - -fn write_example_list(o: &mut String, examples: &[ExampleInfo<'_>]) { - if examples.is_empty() { - return; - } - - if examples.len() > 1 { - putln!(o, "## Examples"); - } else { - putln!(o, "## Example"); - }; - putln!(o); - - for ExampleInfo { - path, - name, - title, - image, - exclude_from_api_docs: _, - missing_extensions: _, - } in examples - { - let title = title.unwrap_or(name); - putln!(o, "### {title}"); - putln!(o); - putln!(o, "snippet: {path}"); - if let Some(image_url) = image { - putln!(o); - for line in image_url.image_stack().snippet_id(name).finish() { - putln!(o, "{line}"); - } - } - putln!(o); - } -} +pub use self::website::DocsCodeGenerator; diff --git a/crates/build/re_types_builder/src/codegen/docs/website.rs b/crates/build/re_types_builder/src/codegen/docs/website.rs new file mode 100644 index 000000000000..80191b4d6499 --- /dev/null +++ b/crates/build/re_types_builder/src/codegen/docs/website.rs @@ -0,0 +1,785 @@ +//! Generate the markdown files shown at . + +use std::{collections::BTreeMap, fmt::Write}; + +use camino::Utf8PathBuf; +use itertools::Itertools; + +use crate::{ + codegen::{autogen_warning, common::ExampleInfo, Target}, + objects::{FieldKind, ViewReference}, + CodeGenerator, GeneratedFiles, Object, ObjectField, ObjectKind, Objects, Reporter, Type, +}; + +pub const DATAFRAME_VIEW_FQNAME: &str = "rerun.blueprint.views.DataframeView"; + +/// Like [`writeln!`], but without a [`Result`]. +macro_rules! putln { + ($o:ident) => ( { writeln!($o).ok(); } ); + ($o:ident, $($tt:tt)*) => ( { writeln!($o, $($tt)*).unwrap(); } ); +} + +pub struct DocsCodeGenerator { + docs_dir: Utf8PathBuf, +} + +impl DocsCodeGenerator { + pub fn new(docs_dir: impl Into) -> Self { + Self { + docs_dir: docs_dir.into(), + } + } +} + +type ViewsPerArchetype = BTreeMap>; + +impl CodeGenerator for DocsCodeGenerator { + fn generate( + &mut self, + reporter: &Reporter, + objects: &Objects, + arrow_registry: &crate::ArrowRegistry, + ) -> GeneratedFiles { + re_tracing::profile_function!(); + + let mut files_to_write = GeneratedFiles::default(); + + // Gather view type mapping per object. + let views_per_archetype = collect_view_types_per_archetype(objects); + + let (mut archetypes, mut components, mut datatypes, mut views) = + (Vec::new(), Vec::new(), Vec::new(), Vec::new()); + + for object in objects.values() { + // skip test-only archetypes + if object.is_testing() { + continue; + } + + // Skip blueprint stuff, too early + if object.scope() == Some("blueprint".to_owned()) && object.kind != ObjectKind::View { + continue; + } + + match object.kind { + ObjectKind::Datatype => datatypes.push(object), + ObjectKind::Component => components.push(object), + ObjectKind::Archetype => archetypes.push(object), + ObjectKind::View => views.push(object), + } + + let page = object_page( + reporter, + objects, + object, + arrow_registry, + &views_per_archetype, + ); + let path = self.docs_dir.join(format!( + "{}/{}.md", + object.kind.plural_snake_case(), + object.snake_case_name() + )); + files_to_write.insert(path, page); + } + + for (kind, order, prelude, kind_objects) in [ + ( + ObjectKind::Archetype, + 1, + r"Archetypes are bundles of components for which the Rerun viewer has first-class +built-in support. When logged, each archetype also includes an _indicator component_ which captures +the intent of the logging code and triggers the activation of the corresponding visualizers. See +[Entities and Components](../../concepts/entity-component.md) and +[Visualizers and Overrides](../../concepts/visualizers-and-overrides.md) for more information. + +This page lists all built-in archetypes.", + &archetypes, + ), + ( + ObjectKind::Component, + 2, + r"Components are the fundamental unit of logging in Rerun. This page lists all built-in components. + +An entity can only ever contain a single array of any given component type. +If you log the same component several times on an entity, the last value (or array of values) will overwrite the previous. + +For more information on the relationship between **archetypes** and **components**, check out the concept page +on [Entities and Components](../../concepts/entity-component.md).", + &components, + ), + ( + ObjectKind::Datatype, + 3, + r"Data types are the lowest layer of the data model hierarchy. They are re-usable types used by the components.", + &datatypes, + ), + ( + ObjectKind::View, + 4, + r"Views are the panels shown in the viewer's viewport and the primary means of inspecting & visualizing previously logged data. This page lists all built-in views.", + &views, + ), + ] { + let page = index_page(reporter, objects, kind, order, prelude, kind_objects); + let path = self + .docs_dir + .join(format!("{}.md", kind.plural_snake_case())); + files_to_write.insert(path, page); + } + + files_to_write + } +} + +fn collect_view_types_per_archetype(objects: &Objects) -> ViewsPerArchetype { + let mut view_types_per_object = ViewsPerArchetype::new(); + for object in objects.objects.values() { + if let Some(view_types) = object.archetype_view_types() { + view_types_per_object.insert(object.fqname.clone(), view_types); + } + } + + view_types_per_object +} + +fn index_page( + reporter: &Reporter, + all_objects: &Objects, + kind: ObjectKind, + order: u64, + prelude: &str, + objects: &[&Object], +) -> String { + let mut page = String::new(); + + write_frontmatter(&mut page, kind.plural_name(), Some(order)); + putln!(page); + putln!(page, "{prelude}"); + putln!(page); + + let mut any_category = false; + for (category, objects) in &objects + .iter() + .sorted_by(|a, b| { + // Put other category last. + if a.doc_category().is_none() { + std::cmp::Ordering::Greater + } else if b.doc_category().is_none() { + std::cmp::Ordering::Less + } else { + a.doc_category().cmp(&b.doc_category()) + } + }) + .chunk_by(|o| o.doc_category()) + { + if category.is_some() { + any_category = true; + } + if let Some(category) = category.or_else(|| { + if any_category { + Some("Other".to_owned()) + } else { + None + } + }) { + putln!(page, "## {category}"); + } + putln!(page); + + for object in objects.sorted_by_key(|object| &object.name) { + let deprecation_note = if object.deprecation_notice().is_some() { + "⚠️ _deprecated_ " + } else { + "" + }; + + putln!( + page, + "* {deprecation_note}[`{}`]({}/{}.md): {}", + object.name, + object.kind.plural_snake_case(), + object.snake_case_name(), + object + .docs + .first_line(reporter, all_objects, Target::WebDocsMarkdown) + .unwrap_or_default(), + ); + } + putln!(page); + } + + page +} + +fn object_page( + reporter: &Reporter, + objects: &Objects, + object: &Object, + arrow_registry: &crate::ArrowRegistry, + views_per_archetype: &ViewsPerArchetype, +) -> String { + let is_unreleased = object.is_attr_set(crate::ATTR_DOCS_UNRELEASED); + let is_experimental = object.is_experimental(); + + let top_level_docs = object + .docs + .lines_for(reporter, objects, Target::WebDocsMarkdown); + + if top_level_docs.is_empty() { + reporter.error(&object.virtpath, &object.fqname, "Undocumented object"); + } + + let examples = &object.docs.only_lines_tagged("example"); + let examples = examples + .iter() + .map(|line| ExampleInfo::parse(line)) + .collect::>(); + + let mut page = String::new(); + + let title = if object.deprecation_notice().is_some() { + format!("{} (deprecated)", object.name) + } else { + object.name.clone() + }; + + write_frontmatter(&mut page, &title, None); + putln!(page); + + if is_experimental { + putln!(page); + putln!( + page, + "⚠️ **This is an experimental API! It is not fully supported, and is likely to change significantly in future versions.**" + ); + putln!(page); + } + + if let Some(deprecation_notice) = object.deprecation_notice() { + putln!( + page, + "**⚠️ This type is deprecated and may be removed in future versions**" + ); + putln!(page, "{deprecation_notice}"); + putln!(page); + } + + for line in top_level_docs { + putln!(page, "{line}"); + } + putln!(page); + + match object.kind { + ObjectKind::Datatype | ObjectKind::Component => { + write_fields(reporter, objects, &mut page, object); + } + ObjectKind::Archetype => { + write_archetype_fields(objects, &mut page, object, views_per_archetype); + } + ObjectKind::View => { + write_view_properties(reporter, objects, &mut page, object); + } + } + + if matches!(object.kind, ObjectKind::Datatype | ObjectKind::Component) { + let datatype = &arrow_registry.get(&object.fqname); + putln!(page); + putln!(page, "## Arrow datatype"); + putln!(page, "```"); + super::arrow_datatype::arrow2_datatype_docs(&mut page, datatype); + putln!(page); + putln!(page, "```"); + } + + putln!(page); + putln!(page, "## API reference links"); + list_links(is_unreleased, &mut page, object); + + putln!(page); + write_example_list(&mut page, &examples); + + match object.kind { + ObjectKind::Datatype | ObjectKind::Component => { + putln!(page); + write_used_by(&mut page, reporter, objects, object); + } + ObjectKind::Archetype => { + if examples.is_empty() { + if object.virtpath.starts_with("//testing") { + // do nothing + } else if object.virtpath.starts_with("//archetypes") { + // actual public archetypes: hard error + reporter.error(&object.virtpath, &object.fqname, "No examples"); + } else { + // everything else (including experimental blueprint stuff): simple warning + reporter.warn(&object.virtpath, &object.fqname, "No examples"); + } + } + } + ObjectKind::View => { + putln!(page); + write_visualized_archetypes(reporter, objects, &mut page, object, views_per_archetype); + } + } + + page +} + +fn list_links(is_unreleased: bool, page: &mut String, object: &Object) { + let speculative_marker = if is_unreleased { + "?speculative-link" + } else { + "" + }; + + if object.kind == ObjectKind::View { + // More complicated link due to scope + putln!( + page, + " * 🐍 [Python API docs for `{}`](https://ref.rerun.io/docs/python/stable/common/{}_{}{}#rerun.{}.{}.{})", + object.name, + object.scope().unwrap_or_default(), + object.kind.plural_snake_case(), + speculative_marker, + object.scope().unwrap_or_default(), + object.kind.plural_snake_case(), + object.name + ); + } else { + let cpp_link = if object.is_enum() { + // Can't link to enums directly 🤷 + format!( + "https://ref.rerun.io/docs/cpp/stable/namespacererun_1_1{}.html", + object.kind.plural_snake_case() + ) + } else { + // `_1` is doxygen's replacement for ':' + // https://github.com/doxygen/doxygen/blob/Release_1_9_8/src/util.cpp#L3532 + format!( + "https://ref.rerun.io/docs/cpp/stable/structrerun_1_1{}_1_1{}.html", + object.kind.plural_snake_case(), + object.name + ) + }; + + // In alphabetical order by language. + putln!( + page, + " * 🌊 [C++ API docs for `{}`]({cpp_link}{speculative_marker})", + object.name, + ); + + putln!( + page, + " * 🐍 [Python API docs for `{}`](https://ref.rerun.io/docs/python/stable/common/{}{}#rerun.{}.{})", + object.name, + object.module_name().replace('/', "_"), // E.g. `blueprint_archetypes` + speculative_marker, + object.module_name().replace('/', "."), // E.g. `blueprint.archetypes` + object.name + ); + + putln!( + page, + " * 🦀 [Rust API docs for `{}`](https://docs.rs/rerun/latest/rerun/{}/{}.{}.html{speculative_marker})", + object.name, + object.kind.plural_snake_case(), + if object.is_struct() { "struct" } else { "enum" }, + object.name, + ); + } +} + +fn write_frontmatter(o: &mut String, title: &str, order: Option) { + putln!(o, "---"); + putln!(o, "title: {title:?}"); + if let Some(order) = order { + // The order is used to sort `rerun.io/docs` side navigation + putln!(o, "order: {order}"); + } + putln!(o, "---"); + // Can't put the autogen warning before the frontmatter, stuff breaks down then. + putln!(o, "", autogen_warning!()); +} + +fn write_fields(reporter: &Reporter, objects: &Objects, o: &mut String, object: &Object) { + if object.fields.is_empty() { + return; + } + + fn type_info(objects: &Objects, ty: &Type) -> String { + fn atomic(name: &str) -> String { + format!("`{name}`") + } + + match ty { + Type::Unit => unreachable!("Should be handled elsewhere"), + + // We use explicit, arrow-like names: + Type::UInt8 => atomic("uint8"), + Type::UInt16 => atomic("uint16"), + Type::UInt32 => atomic("uint32"), + Type::UInt64 => atomic("uint64"), + Type::Int8 => atomic("int8"), + Type::Int16 => atomic("int16"), + Type::Int32 => atomic("int32"), + Type::Int64 => atomic("int64"), + Type::Bool => atomic("boolean"), + Type::Float16 => atomic("float16"), + Type::Float32 => atomic("float32"), + Type::Float64 => atomic("float64"), + Type::String => atomic("utf8"), + + Type::Array { elem_type, length } => { + format!( + "{length}x {}", + type_info(objects, &Type::from(elem_type.clone())) + ) + } + Type::Vector { elem_type } => { + format!( + "List of {}", + type_info(objects, &Type::from(elem_type.clone())) + ) + } + Type::Object(fqname) => { + let ty = objects.get(fqname).unwrap(); + format!( + "[`{}`](../{}/{}.md)", + ty.name, + ty.kind.plural_snake_case(), + ty.snake_case_name() + ) + } + } + } + + if object.is_arrow_transparent() { + assert!(object.is_struct()); + assert_eq!(object.fields.len(), 1); + let field_type = &object.fields[0].typ; + if object.kind == ObjectKind::Component && matches!(field_type, Type::Object(_)) { + putln!(o, "## Rerun datatype"); + putln!(o, "{}", type_info(objects, field_type)); + putln!(o); + } else { + // The arrow datatype section covers it + } + return; // This is just a wrapper type, so don't show the "Fields" section + } + + let mut fields = Vec::new(); + for field in &object.fields { + let mut field_string = format!("#### `{}`", field.name); + + if let Some(enum_value) = field.enum_value { + field_string.push_str(&format!(" = {enum_value}")); + } + field_string.push('\n'); + + if !object.is_enum() { + field_string.push_str("Type: "); + if field.typ == Type::Unit { + field_string.push_str("`null`"); + } else { + if field.is_nullable { + field_string.push_str("nullable "); + } + field_string.push_str(&type_info(objects, &field.typ)); + } + field_string.push('\n'); + field_string.push('\n'); + } + + for line in field + .docs + .lines_for(reporter, objects, Target::WebDocsMarkdown) + { + field_string.push_str(&line); + field_string.push('\n'); + } + + fields.push(field_string); + } + + if !fields.is_empty() { + let heading = match object.class { + crate::ObjectClass::Struct => "## Fields", + crate::ObjectClass::Enum | crate::ObjectClass::Union => "## Variants", + }; + putln!(o, "{heading}"); + for field in fields { + putln!(o, "{field}"); + } + } +} + +fn write_used_by(o: &mut String, reporter: &Reporter, objects: &Objects, object: &Object) { + let mut used_by = Vec::new(); + for ty in objects.values() { + // Since blueprints are being skipped there used-by links should also be skipped + if ty.scope() == Some("blueprint".to_owned()) { + continue; + } + for field in &ty.fields { + if field.typ.fqname() == Some(object.fqname.as_str()) { + let is_unreleased = ty.is_attr_set(crate::ATTR_DOCS_UNRELEASED); + let speculative_marker = if is_unreleased { + "?speculative-link" + } else { + "" + }; + used_by.push(format!( + "* [`{}`](../{}/{}.md{})", + ty.name, + ty.kind.plural_snake_case(), + ty.snake_case_name(), + speculative_marker + )); + } + } + } + used_by.sort(); + used_by.dedup(); // The same datatype can be used multiple times by the same component + + if used_by.is_empty() { + // NOTE: there are some false positives here, because unions can only + // reference other tables, but they are unwrapped in the codegen. + // So for instance: `union Angle` uses `rerun.datatypes.Float32` in + // `angle.fbs`, but in the generated code that datatype is unused. + if false { + reporter.warn(&object.virtpath, &object.fqname, "Unused object"); + } + } else { + putln!(o, "## Used by"); + putln!(o); + for ty in used_by { + putln!(o, "{ty}"); + } + } +} + +fn write_archetype_fields( + objects: &Objects, + page: &mut String, + object: &Object, + view_per_archetype: &ViewsPerArchetype, +) { + if object.fields.is_empty() { + return; + } + + // collect names of field _components_ by their `FieldKind` + let (mut required, mut recommended, mut optional) = (Vec::new(), Vec::new(), Vec::new()); + for field in &object.fields { + let Some(fqname) = field.typ.fqname() else { + continue; + }; + let Some(ty) = objects.get(fqname) else { + continue; + }; + let target = match field.kind() { + Some(FieldKind::Required) => &mut required, + Some(FieldKind::Recommended) => &mut recommended, + Some(FieldKind::Optional) => &mut optional, + _ => continue, + }; + target.push(format!( + "[`{}`](../{}/{}.md)", + ty.name, + ty.kind.plural_snake_case(), + ty.snake_case_name() + )); + } + + if required.is_empty() && recommended.is_empty() && optional.is_empty() { + return; + } + + putln!(page, "## Components"); + if !required.is_empty() { + putln!(page); + putln!(page, "**Required**: {}", required.join(", ")); + } + if !recommended.is_empty() { + putln!(page); + putln!(page, "**Recommended**: {}", recommended.join(", ")); + } + if !optional.is_empty() { + putln!(page); + putln!(page, "**Optional**: {}", optional.join(", ")); + } + + putln!(page); + putln!(page, "## Shown in"); + + if let Some(view_types) = view_per_archetype.get(&object.fqname) { + for ViewReference { + view_name, + explanation, + } in view_types + { + page.push_str(&format!( + "* [{view_name}](../views/{}.md)", + re_case::to_snake_case(view_name) + )); + if let Some(explanation) = explanation { + page.push_str(&format!(" ({explanation})")); + } + putln!(page); + } + } + + // Special case for dataframe view: it can display anything. + putln!(page, "* [DataframeView](../views/dataframe_view.md)"); +} + +fn write_visualized_archetypes( + reporter: &Reporter, + objects: &Objects, + page: &mut String, + view: &Object, + views_per_archetype: &ViewsPerArchetype, +) { + let mut archetype_fqnames = Vec::new(); + for (fqname, reference) in views_per_archetype { + for ViewReference { + view_name, + explanation, + } in reference + { + if view_name == &view.name { + archetype_fqnames.push((fqname.clone(), explanation)); + } + } + } + + if archetype_fqnames.is_empty() && view.fqname != DATAFRAME_VIEW_FQNAME { + reporter.error(&view.virtpath, &view.fqname, "No archetypes use this view."); + return; + } + + // Put the archetypes in alphabetical order but put the ones with extra explanation last. + archetype_fqnames.sort_by_key(|(fqname, explanation)| (explanation.is_some(), fqname.clone())); + + putln!(page, "## Visualized archetypes"); + putln!(page); + + // special case for dataframe view + if view.fqname == DATAFRAME_VIEW_FQNAME { + putln!(page, "Any data can be displayed by the Dataframe view."); + } else { + for (fqname, explanation) in archetype_fqnames { + let object = &objects[&fqname]; + page.push_str(&format!( + "* [`{}`](../{}/{}.md)", + object.name, + object.kind.plural_snake_case(), + object.snake_case_name() + )); + if let Some(explanation) = explanation { + page.push_str(&format!(" ({explanation})")); + } + putln!(page); + } + } + putln!(page); +} + +fn write_view_properties(reporter: &Reporter, objects: &Objects, page: &mut String, view: &Object) { + if view.fields.is_empty() { + return; + } + + putln!(page, "## Properties"); + putln!(page); + + // Each field in a view should be a property + for field in &view.fields { + write_view_property(reporter, objects, page, field); + } +} + +fn write_view_property( + reporter: &Reporter, + objects: &Objects, + o: &mut String, + field: &ObjectField, +) { + putln!(o, "### `{}`", field.name); + + let top_level_docs = field + .docs + .lines_for(reporter, objects, Target::WebDocsMarkdown); + + if top_level_docs.is_empty() { + reporter.error(&field.virtpath, &field.fqname, "Undocumented view property"); + } + + for line in top_level_docs { + putln!(o, "{line}"); + } + + // If there's more than one fields on this type, list them: + let Some(field_fqname) = field.typ.fqname() else { + return; + }; + let object = &objects[field_fqname]; + + let mut fields = Vec::new(); + for field in &object.fields { + fields.push(format!( + "* `{}`: {}", + field.name, + field + .docs + .first_line(reporter, objects, Target::WebDocsMarkdown) + .unwrap_or_default() + )); + } + + if fields.len() > 1 { + putln!(o); + for field in fields { + putln!(o, "{field}"); + } + } + + // Note that we don't list links to reference docs for this type since this causes a lot of clutter. +} + +fn write_example_list(o: &mut String, examples: &[ExampleInfo<'_>]) { + if examples.is_empty() { + return; + } + + if examples.len() > 1 { + putln!(o, "## Examples"); + } else { + putln!(o, "## Example"); + }; + putln!(o); + + for ExampleInfo { + path, + name, + title, + image, + exclude_from_api_docs: _, + missing_extensions: _, + } in examples + { + let title = title.unwrap_or(name); + putln!(o, "### {title}"); + putln!(o); + putln!(o, "snippet: {path}"); + if let Some(image_url) = image { + putln!(o); + for line in image_url.image_stack().snippet_id(name).finish() { + putln!(o, "{line}"); + } + } + putln!(o); + } +} diff --git a/docs/content/reference/types/archetypes.md b/docs/content/reference/types/archetypes.md index 0bc8e5767ef5..4b6f07b9b037 100644 --- a/docs/content/reference/types/archetypes.md +++ b/docs/content/reference/types/archetypes.md @@ -2,7 +2,7 @@ title: "Archetypes" order: 1 --- - + Archetypes are bundles of components for which the Rerun viewer has first-class built-in support. When logged, each archetype also includes an _indicator component_ which captures diff --git a/docs/content/reference/types/archetypes/annotation_context.md b/docs/content/reference/types/archetypes/annotation_context.md index a9850dde6c0b..e6e1eaa0d195 100644 --- a/docs/content/reference/types/archetypes/annotation_context.md +++ b/docs/content/reference/types/archetypes/annotation_context.md @@ -1,7 +1,7 @@ --- title: "AnnotationContext" --- - + The annotation context provides additional information on how to display entities. diff --git a/docs/content/reference/types/archetypes/arrows2d.md b/docs/content/reference/types/archetypes/arrows2d.md index 40564b6514bc..f29981bea7ee 100644 --- a/docs/content/reference/types/archetypes/arrows2d.md +++ b/docs/content/reference/types/archetypes/arrows2d.md @@ -1,7 +1,7 @@ --- title: "Arrows2D" --- - + 2D arrows with optional colors, radii, labels, etc. diff --git a/docs/content/reference/types/archetypes/arrows3d.md b/docs/content/reference/types/archetypes/arrows3d.md index 937223f432ba..0f7fae1f0740 100644 --- a/docs/content/reference/types/archetypes/arrows3d.md +++ b/docs/content/reference/types/archetypes/arrows3d.md @@ -1,7 +1,7 @@ --- title: "Arrows3D" --- - + 3D arrows with optional colors, radii, labels, etc. diff --git a/docs/content/reference/types/archetypes/asset3d.md b/docs/content/reference/types/archetypes/asset3d.md index ed8b246601db..0b14103b35ba 100644 --- a/docs/content/reference/types/archetypes/asset3d.md +++ b/docs/content/reference/types/archetypes/asset3d.md @@ -1,7 +1,7 @@ --- title: "Asset3D" --- - + A prepacked 3D asset (`.gltf`, `.glb`, `.obj`, `.stl`, etc.). diff --git a/docs/content/reference/types/archetypes/asset_video.md b/docs/content/reference/types/archetypes/asset_video.md index b2ffd51cc9ad..1f4d33406ccc 100644 --- a/docs/content/reference/types/archetypes/asset_video.md +++ b/docs/content/reference/types/archetypes/asset_video.md @@ -1,7 +1,7 @@ --- title: "AssetVideo" --- - + A video binary. diff --git a/docs/content/reference/types/archetypes/bar_chart.md b/docs/content/reference/types/archetypes/bar_chart.md index 6f2e286bd923..4c63a6f69162 100644 --- a/docs/content/reference/types/archetypes/bar_chart.md +++ b/docs/content/reference/types/archetypes/bar_chart.md @@ -1,7 +1,7 @@ --- title: "BarChart" --- - + A bar chart. diff --git a/docs/content/reference/types/archetypes/boxes2d.md b/docs/content/reference/types/archetypes/boxes2d.md index c1b9c9c424e4..b2299e18b3f5 100644 --- a/docs/content/reference/types/archetypes/boxes2d.md +++ b/docs/content/reference/types/archetypes/boxes2d.md @@ -1,7 +1,7 @@ --- title: "Boxes2D" --- - + 2D boxes with half-extents and optional center, colors etc. diff --git a/docs/content/reference/types/archetypes/boxes3d.md b/docs/content/reference/types/archetypes/boxes3d.md index ef33d29fcfc2..7d192310ea0a 100644 --- a/docs/content/reference/types/archetypes/boxes3d.md +++ b/docs/content/reference/types/archetypes/boxes3d.md @@ -1,7 +1,7 @@ --- title: "Boxes3D" --- - + 3D boxes with half-extents and optional center, rotations, colors etc. diff --git a/docs/content/reference/types/archetypes/capsules3d.md b/docs/content/reference/types/archetypes/capsules3d.md index 2e5bf57004b9..0925b8700b89 100644 --- a/docs/content/reference/types/archetypes/capsules3d.md +++ b/docs/content/reference/types/archetypes/capsules3d.md @@ -1,7 +1,7 @@ --- title: "Capsules3D" --- - + 3D capsules; cylinders with hemispherical caps. diff --git a/docs/content/reference/types/archetypes/clear.md b/docs/content/reference/types/archetypes/clear.md index 476fcb56470b..b590e6b2d9ed 100644 --- a/docs/content/reference/types/archetypes/clear.md +++ b/docs/content/reference/types/archetypes/clear.md @@ -1,7 +1,7 @@ --- title: "Clear" --- - + Empties all the components of an entity. diff --git a/docs/content/reference/types/archetypes/depth_image.md b/docs/content/reference/types/archetypes/depth_image.md index 6a0d62afe6c0..8868dc61c32d 100644 --- a/docs/content/reference/types/archetypes/depth_image.md +++ b/docs/content/reference/types/archetypes/depth_image.md @@ -1,7 +1,7 @@ --- title: "DepthImage" --- - + A depth image, i.e. as captured by a depth camera. diff --git a/docs/content/reference/types/archetypes/disconnected_space.md b/docs/content/reference/types/archetypes/disconnected_space.md index eacd122ed166..e6e81e02bab6 100644 --- a/docs/content/reference/types/archetypes/disconnected_space.md +++ b/docs/content/reference/types/archetypes/disconnected_space.md @@ -1,7 +1,7 @@ --- title: "DisconnectedSpace" --- - + Spatially disconnect this entity from its parent. diff --git a/docs/content/reference/types/archetypes/ellipsoids3d.md b/docs/content/reference/types/archetypes/ellipsoids3d.md index faeaba7a7b94..e0e1ecdf4bf1 100644 --- a/docs/content/reference/types/archetypes/ellipsoids3d.md +++ b/docs/content/reference/types/archetypes/ellipsoids3d.md @@ -1,7 +1,7 @@ --- title: "Ellipsoids3D" --- - + 3D ellipsoids or spheres. diff --git a/docs/content/reference/types/archetypes/encoded_image.md b/docs/content/reference/types/archetypes/encoded_image.md index 48b3edd7669c..ca095801929e 100644 --- a/docs/content/reference/types/archetypes/encoded_image.md +++ b/docs/content/reference/types/archetypes/encoded_image.md @@ -1,7 +1,7 @@ --- title: "EncodedImage" --- - + An image encoded as e.g. a JPEG or PNG. diff --git a/docs/content/reference/types/archetypes/geo_line_strings.md b/docs/content/reference/types/archetypes/geo_line_strings.md index e6c316e5be05..492462915e5c 100644 --- a/docs/content/reference/types/archetypes/geo_line_strings.md +++ b/docs/content/reference/types/archetypes/geo_line_strings.md @@ -1,7 +1,7 @@ --- title: "GeoLineStrings" --- - + Geospatial line strings with positions expressed in [EPSG:4326](https://epsg.io/4326) altitude and longitude (North/East-positive degrees), and optional colors and radii. diff --git a/docs/content/reference/types/archetypes/geo_points.md b/docs/content/reference/types/archetypes/geo_points.md index 866f074b0903..2ad7615c9da2 100644 --- a/docs/content/reference/types/archetypes/geo_points.md +++ b/docs/content/reference/types/archetypes/geo_points.md @@ -1,7 +1,7 @@ --- title: "GeoPoints" --- - + Geospatial points with positions expressed in [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees), and optional colors and radii. diff --git a/docs/content/reference/types/archetypes/graph_edges.md b/docs/content/reference/types/archetypes/graph_edges.md index 626954039656..8a14d6c11d70 100644 --- a/docs/content/reference/types/archetypes/graph_edges.md +++ b/docs/content/reference/types/archetypes/graph_edges.md @@ -1,7 +1,7 @@ --- title: "GraphEdges" --- - + ⚠️ **This is an experimental API! It is not fully supported, and is likely to change significantly in future versions.** diff --git a/docs/content/reference/types/archetypes/graph_nodes.md b/docs/content/reference/types/archetypes/graph_nodes.md index 694708eaa5be..1bc0f1589ff2 100644 --- a/docs/content/reference/types/archetypes/graph_nodes.md +++ b/docs/content/reference/types/archetypes/graph_nodes.md @@ -1,7 +1,7 @@ --- title: "GraphNodes" --- - + ⚠️ **This is an experimental API! It is not fully supported, and is likely to change significantly in future versions.** diff --git a/docs/content/reference/types/archetypes/image.md b/docs/content/reference/types/archetypes/image.md index f278721593b9..1c878217832c 100644 --- a/docs/content/reference/types/archetypes/image.md +++ b/docs/content/reference/types/archetypes/image.md @@ -1,7 +1,7 @@ --- title: "Image" --- - + A monochrome or color image. diff --git a/docs/content/reference/types/archetypes/instance_poses3d.md b/docs/content/reference/types/archetypes/instance_poses3d.md index 89f7e9846421..063624daaa46 100644 --- a/docs/content/reference/types/archetypes/instance_poses3d.md +++ b/docs/content/reference/types/archetypes/instance_poses3d.md @@ -1,7 +1,7 @@ --- title: "InstancePoses3D" --- - + One or more transforms between the current entity and its parent. Unlike [`archetypes.Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d), it is *not* propagated in the transform hierarchy. diff --git a/docs/content/reference/types/archetypes/line_strips2d.md b/docs/content/reference/types/archetypes/line_strips2d.md index dde4074a399d..a4005a5991b7 100644 --- a/docs/content/reference/types/archetypes/line_strips2d.md +++ b/docs/content/reference/types/archetypes/line_strips2d.md @@ -1,7 +1,7 @@ --- title: "LineStrips2D" --- - + 2D line strips with positions and optional colors, radii, labels, etc. diff --git a/docs/content/reference/types/archetypes/line_strips3d.md b/docs/content/reference/types/archetypes/line_strips3d.md index ab9c01704820..30761c0abae0 100644 --- a/docs/content/reference/types/archetypes/line_strips3d.md +++ b/docs/content/reference/types/archetypes/line_strips3d.md @@ -1,7 +1,7 @@ --- title: "LineStrips3D" --- - + 3D line strips with positions and optional colors, radii, labels, etc. diff --git a/docs/content/reference/types/archetypes/mesh3d.md b/docs/content/reference/types/archetypes/mesh3d.md index 3546920a0238..bb833b3e76d3 100644 --- a/docs/content/reference/types/archetypes/mesh3d.md +++ b/docs/content/reference/types/archetypes/mesh3d.md @@ -1,7 +1,7 @@ --- title: "Mesh3D" --- - + A 3D triangle mesh as specified by its per-mesh and per-vertex properties. diff --git a/docs/content/reference/types/archetypes/pinhole.md b/docs/content/reference/types/archetypes/pinhole.md index 06a456ba5c46..81de1d3d4517 100644 --- a/docs/content/reference/types/archetypes/pinhole.md +++ b/docs/content/reference/types/archetypes/pinhole.md @@ -1,7 +1,7 @@ --- title: "Pinhole" --- - + Camera perspective projection (a.k.a. intrinsics). diff --git a/docs/content/reference/types/archetypes/points2d.md b/docs/content/reference/types/archetypes/points2d.md index 69395fd5fa0b..1ca403cbe934 100644 --- a/docs/content/reference/types/archetypes/points2d.md +++ b/docs/content/reference/types/archetypes/points2d.md @@ -1,7 +1,7 @@ --- title: "Points2D" --- - + A 2D point cloud with positions and optional colors, radii, labels, etc. diff --git a/docs/content/reference/types/archetypes/points3d.md b/docs/content/reference/types/archetypes/points3d.md index 6b83466c7381..6608f79221f5 100644 --- a/docs/content/reference/types/archetypes/points3d.md +++ b/docs/content/reference/types/archetypes/points3d.md @@ -1,7 +1,7 @@ --- title: "Points3D" --- - + A 3D point cloud with positions and optional colors, radii, labels, etc. diff --git a/docs/content/reference/types/archetypes/scalar.md b/docs/content/reference/types/archetypes/scalar.md index b75e7960f4a0..1b8d06834a30 100644 --- a/docs/content/reference/types/archetypes/scalar.md +++ b/docs/content/reference/types/archetypes/scalar.md @@ -1,7 +1,7 @@ --- title: "Scalar" --- - + A double-precision scalar, e.g. for use for time-series plots. diff --git a/docs/content/reference/types/archetypes/segmentation_image.md b/docs/content/reference/types/archetypes/segmentation_image.md index d6fd1a5c1543..4145b350dda1 100644 --- a/docs/content/reference/types/archetypes/segmentation_image.md +++ b/docs/content/reference/types/archetypes/segmentation_image.md @@ -1,7 +1,7 @@ --- title: "SegmentationImage" --- - + An image made up of integer [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id)s. diff --git a/docs/content/reference/types/archetypes/series_line.md b/docs/content/reference/types/archetypes/series_line.md index a35379f1b8e9..6562b35b38c1 100644 --- a/docs/content/reference/types/archetypes/series_line.md +++ b/docs/content/reference/types/archetypes/series_line.md @@ -1,7 +1,7 @@ --- title: "SeriesLine" --- - + Define the style properties for a line series in a chart. diff --git a/docs/content/reference/types/archetypes/series_point.md b/docs/content/reference/types/archetypes/series_point.md index c2163b8e2638..7b7ad10a86de 100644 --- a/docs/content/reference/types/archetypes/series_point.md +++ b/docs/content/reference/types/archetypes/series_point.md @@ -1,7 +1,7 @@ --- title: "SeriesPoint" --- - + Define the style properties for a point series in a chart. diff --git a/docs/content/reference/types/archetypes/tensor.md b/docs/content/reference/types/archetypes/tensor.md index 7e25161887e2..e1fab3624dbe 100644 --- a/docs/content/reference/types/archetypes/tensor.md +++ b/docs/content/reference/types/archetypes/tensor.md @@ -1,7 +1,7 @@ --- title: "Tensor" --- - + An N-dimensional array of numbers. diff --git a/docs/content/reference/types/archetypes/text_document.md b/docs/content/reference/types/archetypes/text_document.md index e7b481d14b6f..e517fdabe7a8 100644 --- a/docs/content/reference/types/archetypes/text_document.md +++ b/docs/content/reference/types/archetypes/text_document.md @@ -1,7 +1,7 @@ --- title: "TextDocument" --- - + A text element intended to be displayed in its own text box. diff --git a/docs/content/reference/types/archetypes/text_log.md b/docs/content/reference/types/archetypes/text_log.md index 96ce9f014dca..58b71beb310c 100644 --- a/docs/content/reference/types/archetypes/text_log.md +++ b/docs/content/reference/types/archetypes/text_log.md @@ -1,7 +1,7 @@ --- title: "TextLog" --- - + A log entry in a text log, comprised of a text body and its log level. diff --git a/docs/content/reference/types/archetypes/transform3d.md b/docs/content/reference/types/archetypes/transform3d.md index a1214398179d..8d63c1681cdd 100644 --- a/docs/content/reference/types/archetypes/transform3d.md +++ b/docs/content/reference/types/archetypes/transform3d.md @@ -1,7 +1,7 @@ --- title: "Transform3D" --- - + A transform between two 3D spaces, i.e. a pose. diff --git a/docs/content/reference/types/archetypes/video_frame_reference.md b/docs/content/reference/types/archetypes/video_frame_reference.md index 310c18af65e2..1762dc8c370c 100644 --- a/docs/content/reference/types/archetypes/video_frame_reference.md +++ b/docs/content/reference/types/archetypes/video_frame_reference.md @@ -1,7 +1,7 @@ --- title: "VideoFrameReference" --- - + References a single video frame. diff --git a/docs/content/reference/types/archetypes/view_coordinates.md b/docs/content/reference/types/archetypes/view_coordinates.md index 544fd552f529..ab36b361bf19 100644 --- a/docs/content/reference/types/archetypes/view_coordinates.md +++ b/docs/content/reference/types/archetypes/view_coordinates.md @@ -1,7 +1,7 @@ --- title: "ViewCoordinates" --- - + How we interpret the coordinate system of an entity/space. diff --git a/docs/content/reference/types/components.md b/docs/content/reference/types/components.md index 895232baec05..c9be262b0fde 100644 --- a/docs/content/reference/types/components.md +++ b/docs/content/reference/types/components.md @@ -2,7 +2,7 @@ title: "Components" order: 2 --- - + Components are the fundamental unit of logging in Rerun. This page lists all built-in components. diff --git a/docs/content/reference/types/components/aggregation_policy.md b/docs/content/reference/types/components/aggregation_policy.md index 108c3aee615e..a6e5f8a50e98 100644 --- a/docs/content/reference/types/components/aggregation_policy.md +++ b/docs/content/reference/types/components/aggregation_policy.md @@ -1,7 +1,7 @@ --- title: "AggregationPolicy" --- - + Policy for aggregation of multiple scalar plot values. diff --git a/docs/content/reference/types/components/albedo_factor.md b/docs/content/reference/types/components/albedo_factor.md index 620ebf98f388..8f371bad0df6 100644 --- a/docs/content/reference/types/components/albedo_factor.md +++ b/docs/content/reference/types/components/albedo_factor.md @@ -1,7 +1,7 @@ --- title: "AlbedoFactor" --- - + A color multiplier, usually applied to a whole entity, e.g. a mesh. diff --git a/docs/content/reference/types/components/annotation_context.md b/docs/content/reference/types/components/annotation_context.md index eb4402d89374..1d16e5ab73e1 100644 --- a/docs/content/reference/types/components/annotation_context.md +++ b/docs/content/reference/types/components/annotation_context.md @@ -1,7 +1,7 @@ --- title: "AnnotationContext" --- - + The annotation context provides additional information on how to display entities. diff --git a/docs/content/reference/types/components/axis_length.md b/docs/content/reference/types/components/axis_length.md index 48d0d76f5edc..15c6beb38317 100644 --- a/docs/content/reference/types/components/axis_length.md +++ b/docs/content/reference/types/components/axis_length.md @@ -1,7 +1,7 @@ --- title: "AxisLength" --- - + The length of an axis in local units of the space. diff --git a/docs/content/reference/types/components/blob.md b/docs/content/reference/types/components/blob.md index 614b9542eb5e..b9fe1a1087f4 100644 --- a/docs/content/reference/types/components/blob.md +++ b/docs/content/reference/types/components/blob.md @@ -1,7 +1,7 @@ --- title: "Blob" --- - + A binary blob of data. diff --git a/docs/content/reference/types/components/class_id.md b/docs/content/reference/types/components/class_id.md index a808c474cdb2..7eb3336d423f 100644 --- a/docs/content/reference/types/components/class_id.md +++ b/docs/content/reference/types/components/class_id.md @@ -1,7 +1,7 @@ --- title: "ClassId" --- - + A 16-bit ID representing a type of semantic class. diff --git a/docs/content/reference/types/components/clear_is_recursive.md b/docs/content/reference/types/components/clear_is_recursive.md index ef8b8e2d8117..6c2ba5c2552d 100644 --- a/docs/content/reference/types/components/clear_is_recursive.md +++ b/docs/content/reference/types/components/clear_is_recursive.md @@ -1,7 +1,7 @@ --- title: "ClearIsRecursive" --- - + Configures how a clear operation should behave - recursive or not. diff --git a/docs/content/reference/types/components/color.md b/docs/content/reference/types/components/color.md index 6babca0c5743..7e28f1ebae84 100644 --- a/docs/content/reference/types/components/color.md +++ b/docs/content/reference/types/components/color.md @@ -1,7 +1,7 @@ --- title: "Color" --- - + An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha. diff --git a/docs/content/reference/types/components/colormap.md b/docs/content/reference/types/components/colormap.md index 70de09de6056..9ed0faaa641e 100644 --- a/docs/content/reference/types/components/colormap.md +++ b/docs/content/reference/types/components/colormap.md @@ -1,7 +1,7 @@ --- title: "Colormap" --- - + Colormap for mapping scalar values within a given range to a color. diff --git a/docs/content/reference/types/components/depth_meter.md b/docs/content/reference/types/components/depth_meter.md index 1d538ae6a479..2c01da7b07a4 100644 --- a/docs/content/reference/types/components/depth_meter.md +++ b/docs/content/reference/types/components/depth_meter.md @@ -1,7 +1,7 @@ --- title: "DepthMeter" --- - + The world->depth map scaling factor. diff --git a/docs/content/reference/types/components/disconnected_space.md b/docs/content/reference/types/components/disconnected_space.md index 4f7f472db1ce..1c3dce66f820 100644 --- a/docs/content/reference/types/components/disconnected_space.md +++ b/docs/content/reference/types/components/disconnected_space.md @@ -1,7 +1,7 @@ --- title: "DisconnectedSpace" --- - + Spatially disconnect this entity from its parent. diff --git a/docs/content/reference/types/components/draw_order.md b/docs/content/reference/types/components/draw_order.md index deb5c0213ce7..b0f63da2c98c 100644 --- a/docs/content/reference/types/components/draw_order.md +++ b/docs/content/reference/types/components/draw_order.md @@ -1,7 +1,7 @@ --- title: "DrawOrder" --- - + Draw order of 2D elements. Higher values are drawn on top of lower values. diff --git a/docs/content/reference/types/components/entity_path.md b/docs/content/reference/types/components/entity_path.md index fd781a032d82..c85f803e2388 100644 --- a/docs/content/reference/types/components/entity_path.md +++ b/docs/content/reference/types/components/entity_path.md @@ -1,7 +1,7 @@ --- title: "EntityPath" --- - + A path to an entity, usually to reference some data that is part of the target entity. diff --git a/docs/content/reference/types/components/fill_mode.md b/docs/content/reference/types/components/fill_mode.md index a939e3eee30d..fa9c2cddda2c 100644 --- a/docs/content/reference/types/components/fill_mode.md +++ b/docs/content/reference/types/components/fill_mode.md @@ -1,7 +1,7 @@ --- title: "FillMode" --- - + How a geometric shape is drawn and colored. diff --git a/docs/content/reference/types/components/fill_ratio.md b/docs/content/reference/types/components/fill_ratio.md index e9a14ea74a22..4d21b164aee5 100644 --- a/docs/content/reference/types/components/fill_ratio.md +++ b/docs/content/reference/types/components/fill_ratio.md @@ -1,7 +1,7 @@ --- title: "FillRatio" --- - + How much a primitive fills out the available space. diff --git a/docs/content/reference/types/components/gamma_correction.md b/docs/content/reference/types/components/gamma_correction.md index 18465ef0e832..21adf58833e9 100644 --- a/docs/content/reference/types/components/gamma_correction.md +++ b/docs/content/reference/types/components/gamma_correction.md @@ -1,7 +1,7 @@ --- title: "GammaCorrection" --- - + A gamma correction value to be used with a scalar value or color. diff --git a/docs/content/reference/types/components/geo_line_string.md b/docs/content/reference/types/components/geo_line_string.md index b56e6aa435c6..e3a656364101 100644 --- a/docs/content/reference/types/components/geo_line_string.md +++ b/docs/content/reference/types/components/geo_line_string.md @@ -1,7 +1,7 @@ --- title: "GeoLineString" --- - + A geospatial line string expressed in [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees). diff --git a/docs/content/reference/types/components/graph_edge.md b/docs/content/reference/types/components/graph_edge.md index 572c0f45abbe..7e3d6a7a8300 100644 --- a/docs/content/reference/types/components/graph_edge.md +++ b/docs/content/reference/types/components/graph_edge.md @@ -1,7 +1,7 @@ --- title: "GraphEdge" --- - + An edge in a graph connecting two nodes. diff --git a/docs/content/reference/types/components/graph_node.md b/docs/content/reference/types/components/graph_node.md index 63339a42164e..23e0732351b0 100644 --- a/docs/content/reference/types/components/graph_node.md +++ b/docs/content/reference/types/components/graph_node.md @@ -1,7 +1,7 @@ --- title: "GraphNode" --- - + A string-based ID representing a node in a graph. diff --git a/docs/content/reference/types/components/graph_type.md b/docs/content/reference/types/components/graph_type.md index 30a9869f4431..5bb3a94c79ec 100644 --- a/docs/content/reference/types/components/graph_type.md +++ b/docs/content/reference/types/components/graph_type.md @@ -1,7 +1,7 @@ --- title: "GraphType" --- - + Specifies if a graph has directed or undirected edges. diff --git a/docs/content/reference/types/components/half_size2d.md b/docs/content/reference/types/components/half_size2d.md index d62d8ced89ee..ffeecbcdb9b6 100644 --- a/docs/content/reference/types/components/half_size2d.md +++ b/docs/content/reference/types/components/half_size2d.md @@ -1,7 +1,7 @@ --- title: "HalfSize2D" --- - + Half-size (radius) of a 2D box. diff --git a/docs/content/reference/types/components/half_size3d.md b/docs/content/reference/types/components/half_size3d.md index 4d155a50f776..836ce91e947b 100644 --- a/docs/content/reference/types/components/half_size3d.md +++ b/docs/content/reference/types/components/half_size3d.md @@ -1,7 +1,7 @@ --- title: "HalfSize3D" --- - + Half-size (radius) of a 3D box. diff --git a/docs/content/reference/types/components/image_buffer.md b/docs/content/reference/types/components/image_buffer.md index b8c63d1ea96c..601f857b54eb 100644 --- a/docs/content/reference/types/components/image_buffer.md +++ b/docs/content/reference/types/components/image_buffer.md @@ -1,7 +1,7 @@ --- title: "ImageBuffer" --- - + A buffer that is known to store image data. diff --git a/docs/content/reference/types/components/image_format.md b/docs/content/reference/types/components/image_format.md index da3a4c0cb844..9733a14749c0 100644 --- a/docs/content/reference/types/components/image_format.md +++ b/docs/content/reference/types/components/image_format.md @@ -1,7 +1,7 @@ --- title: "ImageFormat" --- - + The metadata describing the contents of a [`components.ImageBuffer`](https://rerun.io/docs/reference/types/components/image_buffer). diff --git a/docs/content/reference/types/components/image_plane_distance.md b/docs/content/reference/types/components/image_plane_distance.md index 913f703a6758..f3f64e873292 100644 --- a/docs/content/reference/types/components/image_plane_distance.md +++ b/docs/content/reference/types/components/image_plane_distance.md @@ -1,7 +1,7 @@ --- title: "ImagePlaneDistance" --- - + The distance from the camera origin to the image plane when the projection is shown in a 3D viewer. diff --git a/docs/content/reference/types/components/keypoint_id.md b/docs/content/reference/types/components/keypoint_id.md index 8d405c519827..630c9b1287f2 100644 --- a/docs/content/reference/types/components/keypoint_id.md +++ b/docs/content/reference/types/components/keypoint_id.md @@ -1,7 +1,7 @@ --- title: "KeypointId" --- - + A 16-bit ID representing a type of semantic keypoint within a class. diff --git a/docs/content/reference/types/components/lat_lon.md b/docs/content/reference/types/components/lat_lon.md index c99770a309fd..9a09586739a2 100644 --- a/docs/content/reference/types/components/lat_lon.md +++ b/docs/content/reference/types/components/lat_lon.md @@ -1,7 +1,7 @@ --- title: "LatLon" --- - + A geospatial position expressed in [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees). diff --git a/docs/content/reference/types/components/length.md b/docs/content/reference/types/components/length.md index 3ca08ab2647f..bf97ae971747 100644 --- a/docs/content/reference/types/components/length.md +++ b/docs/content/reference/types/components/length.md @@ -1,7 +1,7 @@ --- title: "Length" --- - + Length, or one-dimensional size. diff --git a/docs/content/reference/types/components/line_strip2d.md b/docs/content/reference/types/components/line_strip2d.md index 4cd8b225161e..3aec239297d7 100644 --- a/docs/content/reference/types/components/line_strip2d.md +++ b/docs/content/reference/types/components/line_strip2d.md @@ -1,7 +1,7 @@ --- title: "LineStrip2D" --- - + A line strip in 2D space. diff --git a/docs/content/reference/types/components/line_strip3d.md b/docs/content/reference/types/components/line_strip3d.md index 8bc3cc421fab..f454ea54ceaf 100644 --- a/docs/content/reference/types/components/line_strip3d.md +++ b/docs/content/reference/types/components/line_strip3d.md @@ -1,7 +1,7 @@ --- title: "LineStrip3D" --- - + A line strip in 3D space. diff --git a/docs/content/reference/types/components/magnification_filter.md b/docs/content/reference/types/components/magnification_filter.md index 425505e8b793..e465277e2827 100644 --- a/docs/content/reference/types/components/magnification_filter.md +++ b/docs/content/reference/types/components/magnification_filter.md @@ -1,7 +1,7 @@ --- title: "MagnificationFilter" --- - + Filter used when magnifying an image/texture such that a single pixel/texel is displayed as multiple pixels on screen. diff --git a/docs/content/reference/types/components/marker_shape.md b/docs/content/reference/types/components/marker_shape.md index e0fe1c1cdd83..2bfb90acc6c1 100644 --- a/docs/content/reference/types/components/marker_shape.md +++ b/docs/content/reference/types/components/marker_shape.md @@ -1,7 +1,7 @@ --- title: "MarkerShape" --- - + The visual appearance of a point in e.g. a 2D plot. diff --git a/docs/content/reference/types/components/marker_size.md b/docs/content/reference/types/components/marker_size.md index 48d47b0371cc..8a7673d6913f 100644 --- a/docs/content/reference/types/components/marker_size.md +++ b/docs/content/reference/types/components/marker_size.md @@ -1,7 +1,7 @@ --- title: "MarkerSize" --- - + Radius of a marker of a point in e.g. a 2D plot, measured in UI points. diff --git a/docs/content/reference/types/components/media_type.md b/docs/content/reference/types/components/media_type.md index ffe3f277bc39..04731ddab5fc 100644 --- a/docs/content/reference/types/components/media_type.md +++ b/docs/content/reference/types/components/media_type.md @@ -1,7 +1,7 @@ --- title: "MediaType" --- - + A standardized media type (RFC2046, formerly known as MIME types), encoded as a string. diff --git a/docs/content/reference/types/components/name.md b/docs/content/reference/types/components/name.md index 85bb4afdd28d..3e69546ba0eb 100644 --- a/docs/content/reference/types/components/name.md +++ b/docs/content/reference/types/components/name.md @@ -1,7 +1,7 @@ --- title: "Name" --- - + A display name, typically for an entity or a item like a plot series. diff --git a/docs/content/reference/types/components/opacity.md b/docs/content/reference/types/components/opacity.md index 558c8b1951fe..2ea1d9214468 100644 --- a/docs/content/reference/types/components/opacity.md +++ b/docs/content/reference/types/components/opacity.md @@ -1,7 +1,7 @@ --- title: "Opacity" --- - + Degree of transparency ranging from 0.0 (fully transparent) to 1.0 (fully opaque). diff --git a/docs/content/reference/types/components/pinhole_projection.md b/docs/content/reference/types/components/pinhole_projection.md index 4f8d53d6d81d..e86ee6980514 100644 --- a/docs/content/reference/types/components/pinhole_projection.md +++ b/docs/content/reference/types/components/pinhole_projection.md @@ -1,7 +1,7 @@ --- title: "PinholeProjection" --- - + Camera projection, from image coordinates to view coordinates. diff --git a/docs/content/reference/types/components/plane3d.md b/docs/content/reference/types/components/plane3d.md index bdb085650e7a..58d7e4e31c40 100644 --- a/docs/content/reference/types/components/plane3d.md +++ b/docs/content/reference/types/components/plane3d.md @@ -1,7 +1,7 @@ --- title: "Plane3D" --- - + An infinite 3D plane represented by a unit normal vector and a distance. diff --git a/docs/content/reference/types/components/pose_rotation_axis_angle.md b/docs/content/reference/types/components/pose_rotation_axis_angle.md index 48d12359136c..6361b6f08b1e 100644 --- a/docs/content/reference/types/components/pose_rotation_axis_angle.md +++ b/docs/content/reference/types/components/pose_rotation_axis_angle.md @@ -1,7 +1,7 @@ --- title: "PoseRotationAxisAngle" --- - + 3D rotation represented by a rotation around a given axis that doesn't propagate in the transform hierarchy. diff --git a/docs/content/reference/types/components/pose_rotation_quat.md b/docs/content/reference/types/components/pose_rotation_quat.md index 7234e9163f4b..0d02625dbd23 100644 --- a/docs/content/reference/types/components/pose_rotation_quat.md +++ b/docs/content/reference/types/components/pose_rotation_quat.md @@ -1,7 +1,7 @@ --- title: "PoseRotationQuat" --- - + A 3D rotation expressed as a quaternion that doesn't propagate in the transform hierarchy. diff --git a/docs/content/reference/types/components/pose_scale3d.md b/docs/content/reference/types/components/pose_scale3d.md index 353c2cac368f..ce2a6467c5b1 100644 --- a/docs/content/reference/types/components/pose_scale3d.md +++ b/docs/content/reference/types/components/pose_scale3d.md @@ -1,7 +1,7 @@ --- title: "PoseScale3D" --- - + A 3D scale factor that doesn't propagate in the transform hierarchy. diff --git a/docs/content/reference/types/components/pose_transform_mat3x3.md b/docs/content/reference/types/components/pose_transform_mat3x3.md index eff04995c452..6e7f91cfa6d9 100644 --- a/docs/content/reference/types/components/pose_transform_mat3x3.md +++ b/docs/content/reference/types/components/pose_transform_mat3x3.md @@ -1,7 +1,7 @@ --- title: "PoseTransformMat3x3" --- - + A 3x3 transformation matrix Matrix that doesn't propagate in the transform hierarchy. diff --git a/docs/content/reference/types/components/pose_translation3d.md b/docs/content/reference/types/components/pose_translation3d.md index e752f94a41e3..245e6e80a964 100644 --- a/docs/content/reference/types/components/pose_translation3d.md +++ b/docs/content/reference/types/components/pose_translation3d.md @@ -1,7 +1,7 @@ --- title: "PoseTranslation3D" --- - + A translation vector in 3D space that doesn't propagate in the transform hierarchy. diff --git a/docs/content/reference/types/components/position2d.md b/docs/content/reference/types/components/position2d.md index 3c0db7b55692..faa24a3318ab 100644 --- a/docs/content/reference/types/components/position2d.md +++ b/docs/content/reference/types/components/position2d.md @@ -1,7 +1,7 @@ --- title: "Position2D" --- - + A position in 2D space. diff --git a/docs/content/reference/types/components/position3d.md b/docs/content/reference/types/components/position3d.md index c4c3884a3e57..5bd68ea68e12 100644 --- a/docs/content/reference/types/components/position3d.md +++ b/docs/content/reference/types/components/position3d.md @@ -1,7 +1,7 @@ --- title: "Position3D" --- - + A position in 3D space. diff --git a/docs/content/reference/types/components/radius.md b/docs/content/reference/types/components/radius.md index f12477593b58..3d976dd859d9 100644 --- a/docs/content/reference/types/components/radius.md +++ b/docs/content/reference/types/components/radius.md @@ -1,7 +1,7 @@ --- title: "Radius" --- - + The radius of something, e.g. a point. diff --git a/docs/content/reference/types/components/range1d.md b/docs/content/reference/types/components/range1d.md index d35374e4681a..047e09c6de8c 100644 --- a/docs/content/reference/types/components/range1d.md +++ b/docs/content/reference/types/components/range1d.md @@ -1,7 +1,7 @@ --- title: "Range1D" --- - + A 1D range, specifying a lower and upper bound. diff --git a/docs/content/reference/types/components/recording_uri.md b/docs/content/reference/types/components/recording_uri.md index bcfe34c05aff..99133fc12b35 100644 --- a/docs/content/reference/types/components/recording_uri.md +++ b/docs/content/reference/types/components/recording_uri.md @@ -1,7 +1,7 @@ --- title: "RecordingUri" --- - + A recording URI (Uniform Resource Identifier). diff --git a/docs/content/reference/types/components/resolution.md b/docs/content/reference/types/components/resolution.md index c3ad8e6b1af5..bb44d4cf0dd7 100644 --- a/docs/content/reference/types/components/resolution.md +++ b/docs/content/reference/types/components/resolution.md @@ -1,7 +1,7 @@ --- title: "Resolution" --- - + Pixel resolution width & height, e.g. of a camera sensor. diff --git a/docs/content/reference/types/components/rotation_axis_angle.md b/docs/content/reference/types/components/rotation_axis_angle.md index a1b3fb606577..134b6f59da59 100644 --- a/docs/content/reference/types/components/rotation_axis_angle.md +++ b/docs/content/reference/types/components/rotation_axis_angle.md @@ -1,7 +1,7 @@ --- title: "RotationAxisAngle" --- - + 3D rotation represented by a rotation around a given axis. diff --git a/docs/content/reference/types/components/rotation_quat.md b/docs/content/reference/types/components/rotation_quat.md index 696ffd7081e4..70898260508c 100644 --- a/docs/content/reference/types/components/rotation_quat.md +++ b/docs/content/reference/types/components/rotation_quat.md @@ -1,7 +1,7 @@ --- title: "RotationQuat" --- - + A 3D rotation expressed as a quaternion. diff --git a/docs/content/reference/types/components/scalar.md b/docs/content/reference/types/components/scalar.md index e41edb71b843..c85331c1eac4 100644 --- a/docs/content/reference/types/components/scalar.md +++ b/docs/content/reference/types/components/scalar.md @@ -1,7 +1,7 @@ --- title: "Scalar" --- - + A scalar value, encoded as a 64-bit floating point. diff --git a/docs/content/reference/types/components/scale3d.md b/docs/content/reference/types/components/scale3d.md index 0c9a9d167088..f4766e6bd2e7 100644 --- a/docs/content/reference/types/components/scale3d.md +++ b/docs/content/reference/types/components/scale3d.md @@ -1,7 +1,7 @@ --- title: "Scale3D" --- - + A 3D scale factor. diff --git a/docs/content/reference/types/components/show_labels.md b/docs/content/reference/types/components/show_labels.md index 8ed7d1d008f3..1f81d6c88e8f 100644 --- a/docs/content/reference/types/components/show_labels.md +++ b/docs/content/reference/types/components/show_labels.md @@ -1,7 +1,7 @@ --- title: "ShowLabels" --- - + Whether the entity's [`components.Text`](https://rerun.io/docs/reference/types/components/text) label is shown. diff --git a/docs/content/reference/types/components/stroke_width.md b/docs/content/reference/types/components/stroke_width.md index 42a47e54c2fb..980cba7727f8 100644 --- a/docs/content/reference/types/components/stroke_width.md +++ b/docs/content/reference/types/components/stroke_width.md @@ -1,7 +1,7 @@ --- title: "StrokeWidth" --- - + The width of a stroke specified in UI points. diff --git a/docs/content/reference/types/components/tensor_data.md b/docs/content/reference/types/components/tensor_data.md index 1d6efe720691..212c6f45a755 100644 --- a/docs/content/reference/types/components/tensor_data.md +++ b/docs/content/reference/types/components/tensor_data.md @@ -1,7 +1,7 @@ --- title: "TensorData" --- - + An N-dimensional array of numbers. diff --git a/docs/content/reference/types/components/tensor_dimension_index_selection.md b/docs/content/reference/types/components/tensor_dimension_index_selection.md index cf791cc7206e..bea9c9e60993 100644 --- a/docs/content/reference/types/components/tensor_dimension_index_selection.md +++ b/docs/content/reference/types/components/tensor_dimension_index_selection.md @@ -1,7 +1,7 @@ --- title: "TensorDimensionIndexSelection" --- - + Specifies a concrete index on a tensor dimension. diff --git a/docs/content/reference/types/components/tensor_height_dimension.md b/docs/content/reference/types/components/tensor_height_dimension.md index e494ec3fca15..52e67d9843a1 100644 --- a/docs/content/reference/types/components/tensor_height_dimension.md +++ b/docs/content/reference/types/components/tensor_height_dimension.md @@ -1,7 +1,7 @@ --- title: "TensorHeightDimension" --- - + Specifies which dimension to use for height. diff --git a/docs/content/reference/types/components/tensor_width_dimension.md b/docs/content/reference/types/components/tensor_width_dimension.md index e9ecfcdceda4..bcd47ae073d7 100644 --- a/docs/content/reference/types/components/tensor_width_dimension.md +++ b/docs/content/reference/types/components/tensor_width_dimension.md @@ -1,7 +1,7 @@ --- title: "TensorWidthDimension" --- - + Specifies which dimension to use for width. diff --git a/docs/content/reference/types/components/texcoord2d.md b/docs/content/reference/types/components/texcoord2d.md index f7806492b348..9111894445e2 100644 --- a/docs/content/reference/types/components/texcoord2d.md +++ b/docs/content/reference/types/components/texcoord2d.md @@ -1,7 +1,7 @@ --- title: "Texcoord2D" --- - + A 2D texture UV coordinate. diff --git a/docs/content/reference/types/components/text.md b/docs/content/reference/types/components/text.md index b86cf1f6c29a..456c2fc088df 100644 --- a/docs/content/reference/types/components/text.md +++ b/docs/content/reference/types/components/text.md @@ -1,7 +1,7 @@ --- title: "Text" --- - + A string of text, e.g. for labels and text documents. diff --git a/docs/content/reference/types/components/text_log_level.md b/docs/content/reference/types/components/text_log_level.md index b6d2ac1da93c..90976bc3ded6 100644 --- a/docs/content/reference/types/components/text_log_level.md +++ b/docs/content/reference/types/components/text_log_level.md @@ -1,7 +1,7 @@ --- title: "TextLogLevel" --- - + The severity level of a text log message. diff --git a/docs/content/reference/types/components/transform_mat3x3.md b/docs/content/reference/types/components/transform_mat3x3.md index 439555ef8dee..77db8986a06b 100644 --- a/docs/content/reference/types/components/transform_mat3x3.md +++ b/docs/content/reference/types/components/transform_mat3x3.md @@ -1,7 +1,7 @@ --- title: "TransformMat3x3" --- - + A 3x3 transformation matrix Matrix. diff --git a/docs/content/reference/types/components/transform_relation.md b/docs/content/reference/types/components/transform_relation.md index 6fcbe695e1d2..231249dcf722 100644 --- a/docs/content/reference/types/components/transform_relation.md +++ b/docs/content/reference/types/components/transform_relation.md @@ -1,7 +1,7 @@ --- title: "TransformRelation" --- - + Specifies relation a spatial transform describes. diff --git a/docs/content/reference/types/components/translation3d.md b/docs/content/reference/types/components/translation3d.md index 8908586e957e..db20bae5714b 100644 --- a/docs/content/reference/types/components/translation3d.md +++ b/docs/content/reference/types/components/translation3d.md @@ -1,7 +1,7 @@ --- title: "Translation3D" --- - + A translation vector in 3D space. diff --git a/docs/content/reference/types/components/triangle_indices.md b/docs/content/reference/types/components/triangle_indices.md index b21d06f21a9b..d129224c8394 100644 --- a/docs/content/reference/types/components/triangle_indices.md +++ b/docs/content/reference/types/components/triangle_indices.md @@ -1,7 +1,7 @@ --- title: "TriangleIndices" --- - + The three indices of a triangle in a triangle mesh. diff --git a/docs/content/reference/types/components/value_range.md b/docs/content/reference/types/components/value_range.md index 995b0413df41..a811294dd6b8 100644 --- a/docs/content/reference/types/components/value_range.md +++ b/docs/content/reference/types/components/value_range.md @@ -1,7 +1,7 @@ --- title: "ValueRange" --- - + Range of expected or valid values, specifying a lower and upper bound. diff --git a/docs/content/reference/types/components/vector2d.md b/docs/content/reference/types/components/vector2d.md index 52735fe24c57..c53cc9f3fbe3 100644 --- a/docs/content/reference/types/components/vector2d.md +++ b/docs/content/reference/types/components/vector2d.md @@ -1,7 +1,7 @@ --- title: "Vector2D" --- - + A vector in 2D space. diff --git a/docs/content/reference/types/components/vector3d.md b/docs/content/reference/types/components/vector3d.md index 47c53e7405c7..5221f9d54c47 100644 --- a/docs/content/reference/types/components/vector3d.md +++ b/docs/content/reference/types/components/vector3d.md @@ -1,7 +1,7 @@ --- title: "Vector3D" --- - + A vector in 3D space. diff --git a/docs/content/reference/types/components/video_timestamp.md b/docs/content/reference/types/components/video_timestamp.md index 4e64bfdad8f7..13ddaf965856 100644 --- a/docs/content/reference/types/components/video_timestamp.md +++ b/docs/content/reference/types/components/video_timestamp.md @@ -1,7 +1,7 @@ --- title: "VideoTimestamp" --- - + Timestamp inside a [`archetypes.AssetVideo`](https://rerun.io/docs/reference/types/archetypes/asset_video). diff --git a/docs/content/reference/types/components/view_coordinates.md b/docs/content/reference/types/components/view_coordinates.md index d12bec3e972c..c6a833881cf0 100644 --- a/docs/content/reference/types/components/view_coordinates.md +++ b/docs/content/reference/types/components/view_coordinates.md @@ -1,7 +1,7 @@ --- title: "ViewCoordinates" --- - + How we interpret the coordinate system of an entity/space. diff --git a/docs/content/reference/types/datatypes.md b/docs/content/reference/types/datatypes.md index 750df8e173f8..6902ee39e313 100644 --- a/docs/content/reference/types/datatypes.md +++ b/docs/content/reference/types/datatypes.md @@ -2,7 +2,7 @@ title: "Datatypes" order: 3 --- - + Data types are the lowest layer of the data model hierarchy. They are re-usable types used by the components. diff --git a/docs/content/reference/types/datatypes/angle.md b/docs/content/reference/types/datatypes/angle.md index 794a9733ef6c..8972ce1e235b 100644 --- a/docs/content/reference/types/datatypes/angle.md +++ b/docs/content/reference/types/datatypes/angle.md @@ -1,7 +1,7 @@ --- title: "Angle" --- - + Angle in radians. diff --git a/docs/content/reference/types/datatypes/annotation_info.md b/docs/content/reference/types/datatypes/annotation_info.md index c8e36d0b5dd5..002265fdde51 100644 --- a/docs/content/reference/types/datatypes/annotation_info.md +++ b/docs/content/reference/types/datatypes/annotation_info.md @@ -1,7 +1,7 @@ --- title: "AnnotationInfo" --- - + Annotation info annotating a class id or key-point id. diff --git a/docs/content/reference/types/datatypes/blob.md b/docs/content/reference/types/datatypes/blob.md index 5d2f7a61692a..ef741912473f 100644 --- a/docs/content/reference/types/datatypes/blob.md +++ b/docs/content/reference/types/datatypes/blob.md @@ -1,7 +1,7 @@ --- title: "Blob" --- - + A binary blob of data. diff --git a/docs/content/reference/types/datatypes/bool.md b/docs/content/reference/types/datatypes/bool.md index 70ede9bee361..4ee2740a5ed3 100644 --- a/docs/content/reference/types/datatypes/bool.md +++ b/docs/content/reference/types/datatypes/bool.md @@ -1,7 +1,7 @@ --- title: "Bool" --- - + A single boolean. diff --git a/docs/content/reference/types/datatypes/channel_datatype.md b/docs/content/reference/types/datatypes/channel_datatype.md index 4e720a27dccd..8904ca772d93 100644 --- a/docs/content/reference/types/datatypes/channel_datatype.md +++ b/docs/content/reference/types/datatypes/channel_datatype.md @@ -1,7 +1,7 @@ --- title: "ChannelDatatype" --- - + The innermost datatype of an image. diff --git a/docs/content/reference/types/datatypes/class_description.md b/docs/content/reference/types/datatypes/class_description.md index d68ddd30b91c..f77a8bd6226e 100644 --- a/docs/content/reference/types/datatypes/class_description.md +++ b/docs/content/reference/types/datatypes/class_description.md @@ -1,7 +1,7 @@ --- title: "ClassDescription" --- - + The description of a semantic Class. diff --git a/docs/content/reference/types/datatypes/class_description_map_elem.md b/docs/content/reference/types/datatypes/class_description_map_elem.md index f8a2991f761c..3a3f9b1c2a39 100644 --- a/docs/content/reference/types/datatypes/class_description_map_elem.md +++ b/docs/content/reference/types/datatypes/class_description_map_elem.md @@ -1,7 +1,7 @@ --- title: "ClassDescriptionMapElem" --- - + A helper type for mapping [`datatypes.ClassId`](https://rerun.io/docs/reference/types/datatypes/class_id)s to class descriptions. diff --git a/docs/content/reference/types/datatypes/class_id.md b/docs/content/reference/types/datatypes/class_id.md index abc013862484..0dcace524b59 100644 --- a/docs/content/reference/types/datatypes/class_id.md +++ b/docs/content/reference/types/datatypes/class_id.md @@ -1,7 +1,7 @@ --- title: "ClassId" --- - + A 16-bit ID representing a type of semantic class. diff --git a/docs/content/reference/types/datatypes/color_model.md b/docs/content/reference/types/datatypes/color_model.md index e08c745e5e9b..4dfcedee3d72 100644 --- a/docs/content/reference/types/datatypes/color_model.md +++ b/docs/content/reference/types/datatypes/color_model.md @@ -1,7 +1,7 @@ --- title: "ColorModel" --- - + Specified what color components are present in an [`archetypes.Image`](https://rerun.io/docs/reference/types/archetypes/image). diff --git a/docs/content/reference/types/datatypes/dvec2d.md b/docs/content/reference/types/datatypes/dvec2d.md index 373478c9b7e6..a337ea272965 100644 --- a/docs/content/reference/types/datatypes/dvec2d.md +++ b/docs/content/reference/types/datatypes/dvec2d.md @@ -1,7 +1,7 @@ --- title: "DVec2D" --- - + A double-precision vector in 2D space. diff --git a/docs/content/reference/types/datatypes/entity_path.md b/docs/content/reference/types/datatypes/entity_path.md index b345f5351444..4080e38d07f9 100644 --- a/docs/content/reference/types/datatypes/entity_path.md +++ b/docs/content/reference/types/datatypes/entity_path.md @@ -1,7 +1,7 @@ --- title: "EntityPath" --- - + A path to an entity in the `ChunkStore`. diff --git a/docs/content/reference/types/datatypes/float32.md b/docs/content/reference/types/datatypes/float32.md index 0f6f9561ccae..87fcedfce165 100644 --- a/docs/content/reference/types/datatypes/float32.md +++ b/docs/content/reference/types/datatypes/float32.md @@ -1,7 +1,7 @@ --- title: "Float32" --- - + A single-precision 32-bit IEEE 754 floating point number. diff --git a/docs/content/reference/types/datatypes/float64.md b/docs/content/reference/types/datatypes/float64.md index 8c1ec4bff30d..89011c09b3f6 100644 --- a/docs/content/reference/types/datatypes/float64.md +++ b/docs/content/reference/types/datatypes/float64.md @@ -1,7 +1,7 @@ --- title: "Float64" --- - + A double-precision 64-bit IEEE 754 floating point number. diff --git a/docs/content/reference/types/datatypes/image_format.md b/docs/content/reference/types/datatypes/image_format.md index ab654918f9a3..c1476f30c5fa 100644 --- a/docs/content/reference/types/datatypes/image_format.md +++ b/docs/content/reference/types/datatypes/image_format.md @@ -1,7 +1,7 @@ --- title: "ImageFormat" --- - + The metadata describing the contents of a [`components.ImageBuffer`](https://rerun.io/docs/reference/types/components/image_buffer). diff --git a/docs/content/reference/types/datatypes/keypoint_id.md b/docs/content/reference/types/datatypes/keypoint_id.md index 7b1e06738cd2..63576c27e829 100644 --- a/docs/content/reference/types/datatypes/keypoint_id.md +++ b/docs/content/reference/types/datatypes/keypoint_id.md @@ -1,7 +1,7 @@ --- title: "KeypointId" --- - + A 16-bit ID representing a type of semantic keypoint within a class. diff --git a/docs/content/reference/types/datatypes/keypoint_pair.md b/docs/content/reference/types/datatypes/keypoint_pair.md index c466bac9b3bb..0c59a03b0e4c 100644 --- a/docs/content/reference/types/datatypes/keypoint_pair.md +++ b/docs/content/reference/types/datatypes/keypoint_pair.md @@ -1,7 +1,7 @@ --- title: "KeypointPair" --- - + A connection between two [`datatypes.KeypointId`](https://rerun.io/docs/reference/types/datatypes/keypoint_id)s. diff --git a/docs/content/reference/types/datatypes/mat3x3.md b/docs/content/reference/types/datatypes/mat3x3.md index 47a3e2a6e007..43538b3f242e 100644 --- a/docs/content/reference/types/datatypes/mat3x3.md +++ b/docs/content/reference/types/datatypes/mat3x3.md @@ -1,7 +1,7 @@ --- title: "Mat3x3" --- - + A 3x3 Matrix. diff --git a/docs/content/reference/types/datatypes/mat4x4.md b/docs/content/reference/types/datatypes/mat4x4.md index 73efb6bee533..fbf9af313114 100644 --- a/docs/content/reference/types/datatypes/mat4x4.md +++ b/docs/content/reference/types/datatypes/mat4x4.md @@ -1,7 +1,7 @@ --- title: "Mat4x4" --- - + A 4x4 Matrix. diff --git a/docs/content/reference/types/datatypes/pixel_format.md b/docs/content/reference/types/datatypes/pixel_format.md index 9b44012f59bd..9fefad7c16bc 100644 --- a/docs/content/reference/types/datatypes/pixel_format.md +++ b/docs/content/reference/types/datatypes/pixel_format.md @@ -1,7 +1,7 @@ --- title: "PixelFormat" --- - + Specifieds a particular format of an [`archetypes.Image`](https://rerun.io/docs/reference/types/archetypes/image). diff --git a/docs/content/reference/types/datatypes/plane3d.md b/docs/content/reference/types/datatypes/plane3d.md index 9f9e45a7f47c..3f0973d64b6d 100644 --- a/docs/content/reference/types/datatypes/plane3d.md +++ b/docs/content/reference/types/datatypes/plane3d.md @@ -1,7 +1,7 @@ --- title: "Plane3D" --- - + An infinite 3D plane represented by a unit normal vector and a distance. diff --git a/docs/content/reference/types/datatypes/quaternion.md b/docs/content/reference/types/datatypes/quaternion.md index 7661b5f2579d..97b1ea43a17f 100644 --- a/docs/content/reference/types/datatypes/quaternion.md +++ b/docs/content/reference/types/datatypes/quaternion.md @@ -1,7 +1,7 @@ --- title: "Quaternion" --- - + A Quaternion represented by 4 real numbers. diff --git a/docs/content/reference/types/datatypes/range1d.md b/docs/content/reference/types/datatypes/range1d.md index 60421a00e8f8..1224a346a294 100644 --- a/docs/content/reference/types/datatypes/range1d.md +++ b/docs/content/reference/types/datatypes/range1d.md @@ -1,7 +1,7 @@ --- title: "Range1D" --- - + A 1D range, specifying a lower and upper bound. diff --git a/docs/content/reference/types/datatypes/range2d.md b/docs/content/reference/types/datatypes/range2d.md index 558c3a24a220..1eec1a3e6f8c 100644 --- a/docs/content/reference/types/datatypes/range2d.md +++ b/docs/content/reference/types/datatypes/range2d.md @@ -1,7 +1,7 @@ --- title: "Range2D" --- - + An Axis-Aligned Bounding Box in 2D space, implemented as the minimum and maximum corners. diff --git a/docs/content/reference/types/datatypes/rgba32.md b/docs/content/reference/types/datatypes/rgba32.md index 4b423d35ec30..3487f55895fa 100644 --- a/docs/content/reference/types/datatypes/rgba32.md +++ b/docs/content/reference/types/datatypes/rgba32.md @@ -1,7 +1,7 @@ --- title: "Rgba32" --- - + An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha. diff --git a/docs/content/reference/types/datatypes/rotation_axis_angle.md b/docs/content/reference/types/datatypes/rotation_axis_angle.md index e9a26b8086f2..ef1e7521fad3 100644 --- a/docs/content/reference/types/datatypes/rotation_axis_angle.md +++ b/docs/content/reference/types/datatypes/rotation_axis_angle.md @@ -1,7 +1,7 @@ --- title: "RotationAxisAngle" --- - + 3D rotation represented by a rotation around a given axis. diff --git a/docs/content/reference/types/datatypes/tensor_buffer.md b/docs/content/reference/types/datatypes/tensor_buffer.md index 653f915c978f..6f64e1bfd0a1 100644 --- a/docs/content/reference/types/datatypes/tensor_buffer.md +++ b/docs/content/reference/types/datatypes/tensor_buffer.md @@ -1,7 +1,7 @@ --- title: "TensorBuffer" --- - + The underlying storage for [`archetypes.Tensor`](https://rerun.io/docs/reference/types/archetypes/tensor). diff --git a/docs/content/reference/types/datatypes/tensor_data.md b/docs/content/reference/types/datatypes/tensor_data.md index caef70928282..d8af8ecbb674 100644 --- a/docs/content/reference/types/datatypes/tensor_data.md +++ b/docs/content/reference/types/datatypes/tensor_data.md @@ -1,7 +1,7 @@ --- title: "TensorData" --- - + An N-dimensional array of numbers. diff --git a/docs/content/reference/types/datatypes/tensor_dimension.md b/docs/content/reference/types/datatypes/tensor_dimension.md index 4341e405ac10..71d1446ed11e 100644 --- a/docs/content/reference/types/datatypes/tensor_dimension.md +++ b/docs/content/reference/types/datatypes/tensor_dimension.md @@ -1,7 +1,7 @@ --- title: "TensorDimension" --- - + A single dimension within a multi-dimensional tensor. diff --git a/docs/content/reference/types/datatypes/tensor_dimension_index_selection.md b/docs/content/reference/types/datatypes/tensor_dimension_index_selection.md index 1373e1455731..556d1d42cf7a 100644 --- a/docs/content/reference/types/datatypes/tensor_dimension_index_selection.md +++ b/docs/content/reference/types/datatypes/tensor_dimension_index_selection.md @@ -1,7 +1,7 @@ --- title: "TensorDimensionIndexSelection" --- - + Indexing a specific tensor dimension. diff --git a/docs/content/reference/types/datatypes/tensor_dimension_selection.md b/docs/content/reference/types/datatypes/tensor_dimension_selection.md index 94d97e242c17..3e1c9a74f1fa 100644 --- a/docs/content/reference/types/datatypes/tensor_dimension_selection.md +++ b/docs/content/reference/types/datatypes/tensor_dimension_selection.md @@ -1,7 +1,7 @@ --- title: "TensorDimensionSelection" --- - + Selection of a single tensor dimension. diff --git a/docs/content/reference/types/datatypes/time_int.md b/docs/content/reference/types/datatypes/time_int.md index c121bfaca6cc..c63fd58721c5 100644 --- a/docs/content/reference/types/datatypes/time_int.md +++ b/docs/content/reference/types/datatypes/time_int.md @@ -1,7 +1,7 @@ --- title: "TimeInt" --- - + A 64-bit number describing either nanoseconds OR sequence numbers. diff --git a/docs/content/reference/types/datatypes/time_range.md b/docs/content/reference/types/datatypes/time_range.md index a4b272616a4c..d9b458533530 100644 --- a/docs/content/reference/types/datatypes/time_range.md +++ b/docs/content/reference/types/datatypes/time_range.md @@ -1,7 +1,7 @@ --- title: "TimeRange" --- - + Visible time range bounds for a specific timeline. diff --git a/docs/content/reference/types/datatypes/time_range_boundary.md b/docs/content/reference/types/datatypes/time_range_boundary.md index e409fe485ab0..0d7439fce19a 100644 --- a/docs/content/reference/types/datatypes/time_range_boundary.md +++ b/docs/content/reference/types/datatypes/time_range_boundary.md @@ -1,7 +1,7 @@ --- title: "TimeRangeBoundary" --- - + Left or right boundary of a time range. diff --git a/docs/content/reference/types/datatypes/uint16.md b/docs/content/reference/types/datatypes/uint16.md index 5609fed94b6f..abb076eb465f 100644 --- a/docs/content/reference/types/datatypes/uint16.md +++ b/docs/content/reference/types/datatypes/uint16.md @@ -1,7 +1,7 @@ --- title: "UInt16" --- - + A 16bit unsigned integer. diff --git a/docs/content/reference/types/datatypes/uint32.md b/docs/content/reference/types/datatypes/uint32.md index 144d1ee0e9ac..d06e19db59ca 100644 --- a/docs/content/reference/types/datatypes/uint32.md +++ b/docs/content/reference/types/datatypes/uint32.md @@ -1,7 +1,7 @@ --- title: "UInt32" --- - + A 32bit unsigned integer. diff --git a/docs/content/reference/types/datatypes/uint64.md b/docs/content/reference/types/datatypes/uint64.md index 1c0025e56657..2e43d5cc24fb 100644 --- a/docs/content/reference/types/datatypes/uint64.md +++ b/docs/content/reference/types/datatypes/uint64.md @@ -1,7 +1,7 @@ --- title: "UInt64" --- - + A 64bit unsigned integer. diff --git a/docs/content/reference/types/datatypes/utf8.md b/docs/content/reference/types/datatypes/utf8.md index d7f5aa99ea30..b4180a94ad44 100644 --- a/docs/content/reference/types/datatypes/utf8.md +++ b/docs/content/reference/types/datatypes/utf8.md @@ -1,7 +1,7 @@ --- title: "Utf8" --- - + A string of text, encoded as UTF-8. diff --git a/docs/content/reference/types/datatypes/utf8pair.md b/docs/content/reference/types/datatypes/utf8pair.md index a1c4c272f99b..1815cd16438e 100644 --- a/docs/content/reference/types/datatypes/utf8pair.md +++ b/docs/content/reference/types/datatypes/utf8pair.md @@ -1,7 +1,7 @@ --- title: "Utf8Pair" --- - + Stores a tuple of UTF-8 strings. diff --git a/docs/content/reference/types/datatypes/uuid.md b/docs/content/reference/types/datatypes/uuid.md index f709faedfc96..0f7c5e9388e4 100644 --- a/docs/content/reference/types/datatypes/uuid.md +++ b/docs/content/reference/types/datatypes/uuid.md @@ -1,7 +1,7 @@ --- title: "Uuid" --- - + A 16-byte UUID. diff --git a/docs/content/reference/types/datatypes/uvec2d.md b/docs/content/reference/types/datatypes/uvec2d.md index 6215cfb1ceb6..8968a2524064 100644 --- a/docs/content/reference/types/datatypes/uvec2d.md +++ b/docs/content/reference/types/datatypes/uvec2d.md @@ -1,7 +1,7 @@ --- title: "UVec2D" --- - + A uint32 vector in 2D space. diff --git a/docs/content/reference/types/datatypes/uvec3d.md b/docs/content/reference/types/datatypes/uvec3d.md index 7f9fc18f0779..6bdeab36e78a 100644 --- a/docs/content/reference/types/datatypes/uvec3d.md +++ b/docs/content/reference/types/datatypes/uvec3d.md @@ -1,7 +1,7 @@ --- title: "UVec3D" --- - + A uint32 vector in 3D space. diff --git a/docs/content/reference/types/datatypes/uvec4d.md b/docs/content/reference/types/datatypes/uvec4d.md index 0f9f3b292534..d10fa19b7945 100644 --- a/docs/content/reference/types/datatypes/uvec4d.md +++ b/docs/content/reference/types/datatypes/uvec4d.md @@ -1,7 +1,7 @@ --- title: "UVec4D" --- - + A uint vector in 4D space. diff --git a/docs/content/reference/types/datatypes/vec2d.md b/docs/content/reference/types/datatypes/vec2d.md index 1c9be0557c86..a99473ea036d 100644 --- a/docs/content/reference/types/datatypes/vec2d.md +++ b/docs/content/reference/types/datatypes/vec2d.md @@ -1,7 +1,7 @@ --- title: "Vec2D" --- - + A vector in 2D space. diff --git a/docs/content/reference/types/datatypes/vec3d.md b/docs/content/reference/types/datatypes/vec3d.md index 6de9efa0e522..cb683702d8f3 100644 --- a/docs/content/reference/types/datatypes/vec3d.md +++ b/docs/content/reference/types/datatypes/vec3d.md @@ -1,7 +1,7 @@ --- title: "Vec3D" --- - + A vector in 3D space. diff --git a/docs/content/reference/types/datatypes/vec4d.md b/docs/content/reference/types/datatypes/vec4d.md index 26b9f0789b0b..9a5973716c70 100644 --- a/docs/content/reference/types/datatypes/vec4d.md +++ b/docs/content/reference/types/datatypes/vec4d.md @@ -1,7 +1,7 @@ --- title: "Vec4D" --- - + A vector in 4D space. diff --git a/docs/content/reference/types/datatypes/video_timestamp.md b/docs/content/reference/types/datatypes/video_timestamp.md index a64a6c701f28..24751d2b96d2 100644 --- a/docs/content/reference/types/datatypes/video_timestamp.md +++ b/docs/content/reference/types/datatypes/video_timestamp.md @@ -1,7 +1,7 @@ --- title: "VideoTimestamp" --- - + Presentation timestamp within a [`archetypes.AssetVideo`](https://rerun.io/docs/reference/types/archetypes/asset_video). diff --git a/docs/content/reference/types/datatypes/view_coordinates.md b/docs/content/reference/types/datatypes/view_coordinates.md index 33157fdeeb0b..99e55f6cc997 100644 --- a/docs/content/reference/types/datatypes/view_coordinates.md +++ b/docs/content/reference/types/datatypes/view_coordinates.md @@ -1,7 +1,7 @@ --- title: "ViewCoordinates" --- - + How we interpret the coordinate system of an entity/space. diff --git a/docs/content/reference/types/datatypes/visible_time_range.md b/docs/content/reference/types/datatypes/visible_time_range.md index 6ad2bc9c8cb4..75b6f7a9bc01 100644 --- a/docs/content/reference/types/datatypes/visible_time_range.md +++ b/docs/content/reference/types/datatypes/visible_time_range.md @@ -1,7 +1,7 @@ --- title: "VisibleTimeRange" --- - + Visible time range bounds for a specific timeline. diff --git a/docs/content/reference/types/views.md b/docs/content/reference/types/views.md index 7b241e9aa2a2..8f725c6ba452 100644 --- a/docs/content/reference/types/views.md +++ b/docs/content/reference/types/views.md @@ -2,7 +2,7 @@ title: "Views" order: 4 --- - + Views are the panels shown in the viewer's viewport and the primary means of inspecting & visualizing previously logged data. This page lists all built-in views. diff --git a/docs/content/reference/types/views/bar_chart_view.md b/docs/content/reference/types/views/bar_chart_view.md index 2fd22f64e328..7fc5c0ade32f 100644 --- a/docs/content/reference/types/views/bar_chart_view.md +++ b/docs/content/reference/types/views/bar_chart_view.md @@ -1,7 +1,7 @@ --- title: "BarChartView" --- - + A bar chart view. diff --git a/docs/content/reference/types/views/dataframe_view.md b/docs/content/reference/types/views/dataframe_view.md index 4a8d1465e201..c5cc8df55bb9 100644 --- a/docs/content/reference/types/views/dataframe_view.md +++ b/docs/content/reference/types/views/dataframe_view.md @@ -1,7 +1,7 @@ --- title: "DataframeView" --- - + A view to display any data in a tabular form. diff --git a/docs/content/reference/types/views/graph_view.md b/docs/content/reference/types/views/graph_view.md index 4b483c3fda87..90a12b048c15 100644 --- a/docs/content/reference/types/views/graph_view.md +++ b/docs/content/reference/types/views/graph_view.md @@ -1,7 +1,7 @@ --- title: "GraphView" --- - + A graph view to display time-variying, directed or undirected graph visualization. diff --git a/docs/content/reference/types/views/map_view.md b/docs/content/reference/types/views/map_view.md index 60652d7b2bbc..f39f981ca786 100644 --- a/docs/content/reference/types/views/map_view.md +++ b/docs/content/reference/types/views/map_view.md @@ -1,7 +1,7 @@ --- title: "MapView" --- - + A 2D map view to display geospatial primitives. diff --git a/docs/content/reference/types/views/spatial2d_view.md b/docs/content/reference/types/views/spatial2d_view.md index 7125701ab1b9..afcc55b75980 100644 --- a/docs/content/reference/types/views/spatial2d_view.md +++ b/docs/content/reference/types/views/spatial2d_view.md @@ -1,7 +1,7 @@ --- title: "Spatial2DView" --- - + For viewing spatial 2D data. diff --git a/docs/content/reference/types/views/spatial3d_view.md b/docs/content/reference/types/views/spatial3d_view.md index 47d2adab291b..c31a719a1d6b 100644 --- a/docs/content/reference/types/views/spatial3d_view.md +++ b/docs/content/reference/types/views/spatial3d_view.md @@ -1,7 +1,7 @@ --- title: "Spatial3DView" --- - + For viewing spatial 3D data. diff --git a/docs/content/reference/types/views/tensor_view.md b/docs/content/reference/types/views/tensor_view.md index d1800e971ac2..edb127fbba36 100644 --- a/docs/content/reference/types/views/tensor_view.md +++ b/docs/content/reference/types/views/tensor_view.md @@ -1,7 +1,7 @@ --- title: "TensorView" --- - + A view on a tensor of any dimensionality. diff --git a/docs/content/reference/types/views/text_document_view.md b/docs/content/reference/types/views/text_document_view.md index 35369525db3f..9807d5434238 100644 --- a/docs/content/reference/types/views/text_document_view.md +++ b/docs/content/reference/types/views/text_document_view.md @@ -1,7 +1,7 @@ --- title: "TextDocumentView" --- - + A view of a single text document, for use with [`archetypes.TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document). diff --git a/docs/content/reference/types/views/text_log_view.md b/docs/content/reference/types/views/text_log_view.md index 2c4b5a40ae17..3aa39e7d133b 100644 --- a/docs/content/reference/types/views/text_log_view.md +++ b/docs/content/reference/types/views/text_log_view.md @@ -1,7 +1,7 @@ --- title: "TextLogView" --- - + A view of a text log, for use with [`archetypes.TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log). diff --git a/docs/content/reference/types/views/time_series_view.md b/docs/content/reference/types/views/time_series_view.md index 6b403993d926..d862d5a4808f 100644 --- a/docs/content/reference/types/views/time_series_view.md +++ b/docs/content/reference/types/views/time_series_view.md @@ -1,7 +1,7 @@ --- title: "TimeSeriesView" --- - + A time series view for scalars over time, for use with [`archetypes.Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar). From 6b40cd5fe1017cd9bd4408b47f5f167158602f5b Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Tue, 10 Dec 2024 17:35:20 +0100 Subject: [PATCH 16/71] Snippet index: implement codegen foundations (#8383) All the codegen to generate the autogenerated parts of the new snippet index. [Rendered](https://github.com/rerun-io/rerun/blob/cmc/snippets_index_1_autogen/docs/snippets/INDEX.md) * Fixes https://github.com/rerun-io/rerun/issues/1123 * Fixes https://github.com/rerun-io/rerun/issues/5662 * DNM: requires https://github.com/rerun-io/rerun/pull/8382 Generated data can be re-used for: * https://github.com/rerun-io/rerun/issues/2934 --- .../src/bin/build_re_types.rs | 9 + .../re_types_builder/src/codegen/docs/mod.rs | 3 +- .../src/codegen/docs/snippets_ref.rs | 525 ++++++++++++++++++ .../build/re_types_builder/src/codegen/mod.rs | 2 +- crates/build/re_types_builder/src/lib.rs | 40 ++ crates/build/re_types_builder/src/objects.rs | 20 + docs/snippets/.gitattributes | 4 + docs/snippets/INDEX.md | 358 ++++++++++++ scripts/ci/check_large_files.py | 1 + 9 files changed, 960 insertions(+), 2 deletions(-) create mode 100644 crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs create mode 100644 docs/snippets/.gitattributes create mode 100644 docs/snippets/INDEX.md diff --git a/crates/build/re_types_builder/src/bin/build_re_types.rs b/crates/build/re_types_builder/src/bin/build_re_types.rs index 9ddfa3dbbbee..358495255b43 100644 --- a/crates/build/re_types_builder/src/bin/build_re_types.rs +++ b/crates/build/re_types_builder/src/bin/build_re_types.rs @@ -21,6 +21,7 @@ const CPP_OUTPUT_DIR_PATH: &str = "rerun_cpp"; const PYTHON_OUTPUT_DIR_PATH: &str = "rerun_py/rerun_sdk/rerun"; const PYTHON_TESTING_OUTPUT_DIR_PATH: &str = "rerun_py/tests/test_types"; const DOCS_CONTENT_DIR_PATH: &str = "docs/content/reference/types"; +const SNIPPETS_REF_DIR_PATH: &str = "docs/snippets/"; /// This uses [`rayon::scope`] to spawn all closures as tasks /// running in parallel. It blocks until all tasks are done. @@ -91,6 +92,7 @@ fn main() { let python_output_dir_path = workspace_dir.join(PYTHON_OUTPUT_DIR_PATH); let python_testing_output_dir_path = workspace_dir.join(PYTHON_TESTING_OUTPUT_DIR_PATH); let docs_content_dir_path = workspace_dir.join(DOCS_CONTENT_DIR_PATH); + let snippets_ref_dir_path = workspace_dir.join(SNIPPETS_REF_DIR_PATH); let cur_hash = read_versioning_hash(&re_types_source_hash_path); re_log::debug!("cur_hash: {cur_hash:?}"); @@ -159,6 +161,13 @@ fn main() { &arrow_registry, check, ), + || re_types_builder::generate_snippets_ref( + &reporter, + snippets_ref_dir_path, + &objects, + &arrow_registry, + check, + ), ); report.finalize(); diff --git a/crates/build/re_types_builder/src/codegen/docs/mod.rs b/crates/build/re_types_builder/src/codegen/docs/mod.rs index e1ec8edeaa1e..0f49a5a0ad09 100644 --- a/crates/build/re_types_builder/src/codegen/docs/mod.rs +++ b/crates/build/re_types_builder/src/codegen/docs/mod.rs @@ -1,4 +1,5 @@ mod arrow_datatype; +mod snippets_ref; mod website; -pub use self::website::DocsCodeGenerator; +pub use self::{snippets_ref::SnippetsRefCodeGenerator, website::DocsCodeGenerator}; diff --git a/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs b/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs new file mode 100644 index 000000000000..5dfcc757ad88 --- /dev/null +++ b/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs @@ -0,0 +1,525 @@ +//! Generate the snippets reference. + +use std::{ + cmp::Ordering, + collections::{BTreeMap, BTreeSet}, + path::PathBuf, +}; + +use anyhow::Context; +use camino::{Utf8Path, Utf8PathBuf}; + +use crate::{CodeGenerator, GeneratedFiles, Object, ObjectKind, Objects, Reporter}; + +// --- + +/// Everything we know about a snippet, including which objects (archetypes, components, etc) it references. +#[allow(dead_code)] +#[derive(Debug, Clone)] +struct Snippet<'o> { + path: PathBuf, + name: String, + name_qualified: String, + + python: bool, + rust: bool, + cpp: bool, + + description: Option, + contents: String, + + archetypes: BTreeSet<&'o Object>, + components: BTreeSet<&'o Object>, + archetypes_blueprint: BTreeSet<&'o Object>, + components_blueprint: BTreeSet<&'o Object>, + views: BTreeSet<&'o Object>, +} + +/// Maps objects (archetypes, components, etc) back to snippets. +#[derive(Default, Debug)] +struct Snippets<'o> { + per_archetype: BTreeMap<&'o Object, Vec>>, + per_component: BTreeMap<&'o Object, Vec>>, + per_archetype_blueprint: BTreeMap<&'o Object, Vec>>, + per_component_blueprint: BTreeMap<&'o Object, Vec>>, + per_view: BTreeMap<&'o Object, Vec>>, +} + +impl<'o> Snippets<'o> { + fn merge_extend(&mut self, rhs: Self) { + let Self { + per_archetype, + per_component, + per_archetype_blueprint, + per_component_blueprint, + per_view, + } = self; + + let merge_extend = |a: &mut BTreeMap<&'o Object, Vec>>, b| { + for (obj, snippets) in b { + a.entry(obj).or_default().extend(snippets); + } + }; + + merge_extend(per_archetype, rhs.per_archetype); + merge_extend(per_component, rhs.per_component); + merge_extend(per_view, rhs.per_view); + merge_extend(per_archetype_blueprint, rhs.per_archetype_blueprint); + merge_extend(per_component_blueprint, rhs.per_component_blueprint); + } +} + +// --- + +pub struct SnippetsRefCodeGenerator { + out_dir: Utf8PathBuf, +} + +impl SnippetsRefCodeGenerator { + pub fn new(out_dir: impl Into) -> Self { + Self { + out_dir: out_dir.into(), + } + } +} + +impl CodeGenerator for SnippetsRefCodeGenerator { + fn generate( + &mut self, + reporter: &Reporter, + objects: &Objects, + _arrow_registry: &crate::ArrowRegistry, + ) -> GeneratedFiles { + match self.generate_fallible(objects) { + Ok(files) => files, + Err(err) => { + reporter.error_any(err); + Default::default() + } + } + } +} + +impl SnippetsRefCodeGenerator { + fn generate_fallible(&self, objects: &Objects) -> anyhow::Result { + re_tracing::profile_function!(); + + const SNIPPETS_URL: &str = + "https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all"; + + let mut files_to_write = GeneratedFiles::default(); + + let snippets_dir = re_build_tools::cargo_metadata() + .context("failed to read cargo metadata")? + .workspace_root + .join("docs/snippets"); + + let snippets_dir_root = snippets_dir.join("all"); + let snippets_dir_archetypes = snippets_dir_root.clone(); + + let known_objects = KnownObjects::init(objects); + + let snippets = collect_snippets_recursively( + &known_objects, + &snippets_dir_archetypes, + &snippets_dir_root, + )?; + + /// Generates a single row for one of the autogenerated tables. + fn snippet_row(obj: &Object, snippet: &Snippet<'_>) -> anyhow::Result { + let obj_name = &obj.name; + let obj_name_snake = obj.snake_case_name(); + let obj_kind = match obj.kind { + ObjectKind::Datatype => "datatypes", + ObjectKind::Component => "components", + ObjectKind::Archetype => "archetypes", + ObjectKind::View => "views", + }; + + let link_docs = + format!("https://rerun.io/docs/reference/types/{obj_kind}/{obj_name_snake}"); + let link_docs = make_speculative_if_needed(obj_name, &link_docs)?; + let obj_name_rendered = + if obj.kind != ObjectKind::View && obj.scope().as_deref() == Some("blueprint") { + // Blueprint types have no website pages yet. + format!("`{obj_name}`") + } else { + format!("[`{obj_name}`]({link_docs})") + }; + + let snippet_name_qualified = &snippet.name_qualified; + let snippet_descr = snippet.description.clone().unwrap_or_default(); + + let link_py = if snippet.python { + let link = format!("{SNIPPETS_URL}/{snippet_name_qualified}.py"); + let link = make_speculative_if_needed(obj_name, &link)?; + let link = make_speculative_if_needed(snippet_name_qualified, &link)?; + format!("[🐍]({link})") + } else { + String::new() + }; + let link_rs = if snippet.rust { + let link = format!("{SNIPPETS_URL}/{snippet_name_qualified}.rs"); + let link = make_speculative_if_needed(obj_name, &link)?; + let link = make_speculative_if_needed(snippet_name_qualified, &link)?; + format!("[🦀]({link})") + } else { + String::new() + }; + let link_cpp = if snippet.cpp { + let link = format!("{SNIPPETS_URL}/{snippet_name_qualified}.cpp"); + let link = make_speculative_if_needed(obj_name, &link)?; + let link = make_speculative_if_needed(snippet_name_qualified, &link)?; + format!("[🌊]({link})") + } else { + String::new() + }; + + let row = format!("| **{obj_name_rendered}** | `{snippet_name_qualified}` | {snippet_descr} | {link_py} | {link_rs} | {link_cpp} |"); + + Ok(row) + } + + let snippets_table = |snippets: &BTreeMap<&Object, Vec>>| { + let table = snippets + .iter() + .flat_map(|(obj, snippets)| { + let mut snippets = snippets.clone(); + // NOTE: Gotta sort twice to make sure it stays stable after the second one. + snippets.sort_by(|a, b| a.name_qualified.cmp(&b.name_qualified)); + snippets.sort_by(|a, b| { + if a.name_qualified.contains(&obj.snake_case_name()) { + // Snippets that contain the object in question in their name should + // bubble up to the top. + Ordering::Less + } else { + a.name_qualified.cmp(&b.name_qualified) + } + }); + snippets.into_iter().map(move |snippet| (obj, snippet)) + }) + .map(|(obj, snippet)| snippet_row(obj, &snippet)) + .collect::, _>>()? + .join("\n"); + + Ok::<_, anyhow::Error>(table) + }; + + let per_archetype_table = snippets_table(&snippets.per_archetype)?; + let per_component_table = snippets_table(&snippets.per_component)?; + let per_archetype_blueprint_table = snippets_table(&snippets.per_archetype_blueprint)?; + let per_component_blueprint_table = snippets_table(&snippets.per_component_blueprint)?; + let per_view_table = snippets_table(&snippets.per_view)?; + + let autogen_warning = format!( + "", + file!().replace('\\', "/") + ); + let out = format!( + " +{autogen_warning} + +# Snippet index reference + +This file acts as an index reference for all of our [snippets](./README.md). + +Use it to quickly find copy-pastable snippets of code for any Rerun feature you're interested in (API, Archetypes, Components, etc). + +--- + +*Table of contents:* +* [Types](#types) + * [Archetypes](#archetypes) + * [Components](#components) + * [Views](#views-blueprint) + * [Archetypes (blueprint)](#archetypes-blueprint) + * [Components (blueprint)](#components-blueprint) + + +## Types + + +### Archetypes + +_All snippets, organized by the [`Archetype`](https://rerun.io/docs/reference/types/archetypes)(s) they use._ + +| Archetype | Snippet | Description | Python | Rust | C++ | +| --------- | ------- | ----------- | ------ | ---- | --- | +{per_archetype_table} + + +### Components + +_All snippets, organized by the [`Component`](https://rerun.io/docs/reference/types/components)(s) they use._ + +| Component | Snippet | Description | Python | Rust | C++ | +| --------- | ------- | ----------- | ------ | ---- | --- | +{per_component_table} + + +### Views (blueprint) + +_All snippets, organized by the [`View`](https://rerun.io/docs/reference/types/views)(s) they use._ + +| Component | Snippet | Description | Python | Rust | C++ | +| --------- | ------- | ----------- | ------ | ---- | --- | +{per_view_table} + + +### Archetypes (blueprint) + +_All snippets, organized by the blueprint-related [`Archetype`](https://rerun.io/docs/reference/types/archetypes)(s) they use._ + +| Archetype | Snippet | Description | Python | Rust | C++ | +| --------- | ------- | ----------- | ------ | ---- | --- | +{per_archetype_blueprint_table} + + +### Components (blueprint) + +_All snippets, organized by the blueprint-related [`Component`](https://rerun.io/docs/reference/types/components)(s) they use._ + +| Component | Snippet | Description | Python | Rust | C++ | +| --------- | ------- | ----------- | ------ | ---- | --- | +{per_component_blueprint_table} +" + ); + + #[allow(clippy::string_add)] + files_to_write.insert(self.out_dir.join("INDEX.md"), out.trim().to_owned() + "\n"); + + Ok(files_to_write) + } +} + +fn collect_snippets_recursively<'o>( + known_objects: &KnownObjects<'o>, + dir: &Utf8Path, + snippet_root_path: &Utf8Path, +) -> anyhow::Result> { + let mut snippets = Snippets::default(); + + #[allow(clippy::unwrap_used)] // we just use unwrap for string <-> path conversion here + for snippet in dir.read_dir()? { + let snippet = snippet?; + let meta = snippet.metadata()?; + let path = snippet.path(); + + let name = path.file_stem().unwrap().to_str().unwrap().to_owned(); + let name_qualified = path.strip_prefix(snippet_root_path)?.with_extension(""); + let name_qualified = name_qualified.to_str().unwrap().replace('\\', "/"); + + if meta.is_dir() { + snippets.merge_extend(collect_snippets_recursively( + known_objects, + Utf8Path::from_path(&path).unwrap(), + snippet_root_path, + )?); + continue; + } + + // We only track the Python one. We'll derive the other two from there, if they exist at all. + if !path.extension().is_some_and(|p| p == "py") { + continue; + } + + let contents = std::fs::read_to_string(&path)?; + let description = contents.lines().take(1).next().and_then(|s| { + s.contains("\"\"\"") + .then(|| s.replace("\"\"\"", "").trim_end_matches('.').to_owned()) + }); + + // All archetypes, components, etc that this snippet refers to. + let mut archetypes = BTreeSet::default(); + let mut components = BTreeSet::default(); + let mut archetypes_blueprint = BTreeSet::default(); + let mut components_blueprint = BTreeSet::default(); + let mut views = BTreeSet::default(); + + // Fill the sets by grepping into the snippet's contents. + for (objs, set) in [ + (&known_objects.archetypes, &mut archetypes), + (&known_objects.components, &mut components), + (&known_objects.views, &mut views), + ( + &known_objects.archetypes_blueprint, + &mut archetypes_blueprint, + ), + ( + &known_objects.components_blueprint, + &mut components_blueprint, + ), + ] { + for obj in objs { + if contents.contains(&obj.name) { + set.insert(*obj); + continue; + } + } + } + + let python = true; + let rust = path.with_extension("rs").exists(); + let cpp = path.with_extension("cpp").exists(); + + let snippet = Snippet { + name, + name_qualified, + path, + + contents, + description, + + python, + rust, + cpp, + + archetypes, + components, + archetypes_blueprint, + components_blueprint, + views, + }; + + // Fill the reverse indices. + for (objs, index) in [ + (&snippet.archetypes, &mut snippets.per_archetype), + (&snippet.components, &mut snippets.per_component), + (&snippet.views, &mut snippets.per_view), + ( + &snippet.archetypes_blueprint, + &mut snippets.per_archetype_blueprint, + ), + ( + &snippet.components_blueprint, + &mut snippets.per_component_blueprint, + ), + ] { + for obj in objs { + index.entry(obj).or_default().push(snippet.clone()); + } + } + } + + Ok(snippets) +} + +/// Neatly organized [`Object`]s (archetypes, components, etc). +#[derive(Debug)] +struct KnownObjects<'o> { + archetypes: BTreeSet<&'o Object>, + components: BTreeSet<&'o Object>, + + archetypes_blueprint: BTreeSet<&'o Object>, + components_blueprint: BTreeSet<&'o Object>, + + views: BTreeSet<&'o Object>, +} + +impl<'o> KnownObjects<'o> { + fn init(objects: &'o Objects) -> Self { + let ( + mut archetypes, + mut components, + mut archetypes_blueprint, + mut components_blueprint, + mut views, + ) = ( + BTreeSet::new(), + BTreeSet::new(), + BTreeSet::new(), + BTreeSet::new(), + BTreeSet::new(), + ); + + for object in objects.values() { + // skip test-only archetypes + if object.is_testing() { + continue; + } + + match object.kind { + ObjectKind::Archetype if object.scope().as_deref() == Some("blueprint") => { + archetypes_blueprint.insert(object); + } + + ObjectKind::Archetype => { + archetypes.insert(object); + } + + ObjectKind::Component if object.scope().as_deref() == Some("blueprint") => { + components_blueprint.insert(object); + } + + ObjectKind::Component => { + components.insert(object); + } + + ObjectKind::View => { + views.insert(object); + } + + ObjectKind::Datatype => {} + }; + } + + Self { + archetypes, + components, + archetypes_blueprint, + components_blueprint, + views, + } + } +} + +// --- + +/// Returns `true` if the given name has not been released yet. +fn is_speculative(any_name: &str) -> anyhow::Result { + let is_pre_0_21_release = { + // Reminder of what those look like: + // env!("CARGO_PKG_VERSION") = "0.21.0-alpha.1+dev" + // env!("CARGO_PKG_VERSION_MAJOR") = "0" + // env!("CARGO_PKG_VERSION_MINOR") = "21" + // env!("CARGO_PKG_VERSION_PATCH") = "0" + // env!("CARGO_PKG_VERSION_PRE") = "alpha.1" + + let minor: u32 = env!("CARGO_PKG_VERSION_MINOR") + .parse() + .context("couldn't parse minor crate version")?; + let pre = env!("CARGO_PKG_VERSION_PRE"); + + minor < 21 || !pre.is_empty() + }; + + const RELEASED_IN_0_21: &[&str] = &[ + // archetypes & components + "GraphEdge", + "GraphEdges", + "GraphNode", + "GraphNodes", + "GraphView", + "Plane3D", + // snippets + "concepts/explicit_recording", + "descriptors/descr_builtin_archetype", + "descriptors/descr_builtin_component", + "descriptors/descr_custom_archetype", + "descriptors/descr_custom_component", + "howto/any_values_send_columns", + "views/graph", + ]; + + let is_speculative = is_pre_0_21_release && RELEASED_IN_0_21.contains(&any_name); + + Ok(is_speculative) +} + +/// Appends `?speculative-link` to the given link if the associated object has not been released yet. +fn make_speculative_if_needed(name: &str, link: &str) -> anyhow::Result { + if is_speculative(name)? { + return Ok(format!("{link}?speculative-link")); + } + Ok(link.to_owned()) +} diff --git a/crates/build/re_types_builder/src/codegen/mod.rs b/crates/build/re_types_builder/src/codegen/mod.rs index ffa962b7b04a..f9c6fcb4b93a 100644 --- a/crates/build/re_types_builder/src/codegen/mod.rs +++ b/crates/build/re_types_builder/src/codegen/mod.rs @@ -57,7 +57,7 @@ mod python; mod rust; pub use self::cpp::CppCodeGenerator; -pub use self::docs::DocsCodeGenerator; +pub use self::docs::{DocsCodeGenerator, SnippetsRefCodeGenerator}; pub use self::fbs::FbsCodeGenerator; pub use self::python::PythonCodeGenerator; pub use self::rust::RustCodeGenerator; diff --git a/crates/build/re_types_builder/src/lib.rs b/crates/build/re_types_builder/src/lib.rs index f31cc0f85738..4641ace5d09f 100644 --- a/crates/build/re_types_builder/src/lib.rs +++ b/crates/build/re_types_builder/src/lib.rs @@ -119,6 +119,7 @@ mod reflection; use std::collections::{BTreeMap, BTreeSet}; +use std::path::PathBuf; use anyhow::Context as _; use codegen::FbsCodeGenerator; @@ -160,6 +161,7 @@ pub use self::{ arrow_registry::{ArrowRegistry, LazyDatatype, LazyField}, codegen::{ CodeGenerator, CppCodeGenerator, DocsCodeGenerator, PythonCodeGenerator, RustCodeGenerator, + SnippetsRefCodeGenerator, }, docs::Docs, format::{CodeFormatter, CppCodeFormatter, PythonCodeFormatter, RustCodeFormatter}, @@ -358,6 +360,11 @@ pub fn compute_re_types_hash(locations: &SourceLocations<'_>) -> String { let re_types_builder_hash = compute_re_types_builder_hash(); let definitions_hash = compute_dir_hash(locations.definitions_dir, Some(&["fbs"])); let snippets_hash = compute_dir_hash(locations.snippets_dir, Some(&["rs", "py", "cpp"])); + let snippets_index_hash = PathBuf::from(locations.snippets_dir) + .parent() + .map_or(String::new(), |dir| { + compute_dir_filtered_hash(dir, |path| path.to_str().unwrap().ends_with("INDEX.md")) + }); let python_extensions_hash = compute_dir_filtered_hash(locations.python_output_dir, |path| { path.to_str().unwrap().ends_with("_ext.py") }); @@ -369,6 +376,7 @@ pub fn compute_re_types_hash(locations: &SourceLocations<'_>) -> String { &re_types_builder_hash, &definitions_hash, &snippets_hash, + &snippets_index_hash, &python_extensions_hash, &cpp_extensions_hash, ]); @@ -376,6 +384,7 @@ pub fn compute_re_types_hash(locations: &SourceLocations<'_>) -> String { re_log::debug!("re_types_builder_hash: {re_types_builder_hash:?}"); re_log::debug!("definitions_hash: {definitions_hash:?}"); re_log::debug!("snippets_hash: {snippets_hash:?}"); + re_log::debug!("snippets_index_hash: {snippets_index_hash:?}"); re_log::debug!("python_extensions_hash: {python_extensions_hash:?}"); re_log::debug!("cpp_extensions_hash: {cpp_extensions_hash:?}"); re_log::debug!("new_hash: {new_hash:?}"); @@ -564,6 +573,37 @@ pub fn generate_docs( ); } +pub fn generate_snippets_ref( + reporter: &Reporter, + output_snippets_ref_dir: impl AsRef, + objects: &Objects, + arrow_registry: &ArrowRegistry, + check: bool, +) { + re_tracing::profile_function!(); + + re_log::info!( + "Generating snippets_ref to {}", + output_snippets_ref_dir.as_ref() + ); + + let mut generator = SnippetsRefCodeGenerator::new(output_snippets_ref_dir.as_ref()); + let mut formatter = NoopCodeFormatter; + + // NOTE: We generate in an existing folder, don't touch anything else. + let orphan_path_opt_out = output_snippets_ref_dir.as_ref().to_owned(); + + generate_code( + reporter, + objects, + arrow_registry, + &mut generator, + &mut formatter, + &std::iter::once(orphan_path_opt_out).collect(), + check, + ); +} + /// Generate flatbuffers definition files. /// /// This should run as the first step in the codegen pipeline as it influences all others. diff --git a/crates/build/re_types_builder/src/objects.rs b/crates/build/re_types_builder/src/objects.rs index d311ba9b1100..bee035715392 100644 --- a/crates/build/re_types_builder/src/objects.rs +++ b/crates/build/re_types_builder/src/objects.rs @@ -360,6 +360,26 @@ pub struct Object { pub datatype: Option, } +impl PartialEq for Object { + fn eq(&self, other: &Self) -> bool { + self.fqname == other.fqname + } +} + +impl Eq for Object {} + +impl Ord for Object { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.fqname.cmp(&other.fqname) + } +} + +impl PartialOrd for Object { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + impl Object { /// Resolves a raw [`crate::Object`] into a higher-level representation that can be easily /// interpreted and manipulated. diff --git a/docs/snippets/.gitattributes b/docs/snippets/.gitattributes new file mode 100644 index 000000000000..daaabee8c56a --- /dev/null +++ b/docs/snippets/.gitattributes @@ -0,0 +1,4 @@ +# DO NOT EDIT! This file is generated by crates/build/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +INDEX.md linguist-generated=true diff --git a/docs/snippets/INDEX.md b/docs/snippets/INDEX.md new file mode 100644 index 000000000000..63c8a5d11c82 --- /dev/null +++ b/docs/snippets/INDEX.md @@ -0,0 +1,358 @@ + + +# Snippet index reference + +This file acts as an index reference for all of our [snippets](./README.md). + +Use it to quickly find copy-pastable snippets of code for any Rerun feature you're interested in (API, Archetypes, Components, etc). + +--- + +*Table of contents:* +* [Types](#types) + * [Archetypes](#archetypes) + * [Components](#components) + * [Views](#views-blueprint) + * [Archetypes (blueprint)](#archetypes-blueprint) + * [Components (blueprint)](#components-blueprint) + + +## Types + + +### Archetypes + +_All snippets, organized by the [`Archetype`](https://rerun.io/docs/reference/types/archetypes)(s) they use._ + +| Archetype | Snippet | Description | Python | Rust | C++ | +| --------- | ------- | ----------- | ------ | ---- | --- | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/annotation_context_rects` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/annotation_context_connections` | Log annotation context with connections between keypoints | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.rs) | | +| **[`Arrows2D`](https://rerun.io/docs/reference/types/archetypes/arrows2d)** | `archetypes/arrow2d_simple` | Log a batch of 2D arrows | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow2d_simple.cpp) | +| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/arrow3d_simple` | Log a batch of 3D arrows | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow3d_simple.cpp) | +| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/clear_recursive` | Log and then clear data recursively | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.cpp) | +| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/clear_simple` | Log and then clear data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.cpp) | +| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/transform3d_simple` | Log different transforms between three arrows | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.cpp) | +| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/view_coordinates_simple` | Change the view coordinates for the scene | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.cpp) | +| **[`Asset3D`](https://rerun.io/docs/reference/types/archetypes/asset3d)** | `archetypes/asset3d_simple` | Log a simple 3D asset | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.cpp) | +| **[`AssetVideo`](https://rerun.io/docs/reference/types/archetypes/asset_video)** | `archetypes/video_auto_frames` | Log a video asset using automatically determined frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.cpp) | +| **[`AssetVideo`](https://rerun.io/docs/reference/types/archetypes/asset_video)** | `archetypes/video_manual_frames` | Manual use of individual video frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.cpp) | +| **[`BarChart`](https://rerun.io/docs/reference/types/archetypes/bar_chart)** | `views/bar_chart` | Use a blueprint to show a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/bar_chart.py) | | | +| **[`BarChart`](https://rerun.io/docs/reference/types/archetypes/bar_chart)** | `archetypes/bar_chart` | Create and log a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/bar_chart.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/bar_chart.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/bar_chart.cpp) | +| **[`BarChart`](https://rerun.io/docs/reference/types/archetypes/bar_chart)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `archetypes/annotation_context_rects` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.cpp) | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `archetypes/box2d_simple` | Log a simple 2D Box | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box2d_simple.cpp) | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-base` | Base example | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-base.py) | | | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-default.py) | | | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-override.py) | | | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | +| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/box3d_batch` | Log a batch of oriented bounding boxes | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_batch.cpp) | +| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/box3d_simple` | Log a single 3D Box | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_simple.cpp) | +| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | +| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | +| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | +| **[`Capsules3D`](https://rerun.io/docs/reference/types/archetypes/capsules3d)** | `archetypes/capsule3d_batch` | Log a batch of capsules | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.cpp) | +| **[`Clear`](https://rerun.io/docs/reference/types/archetypes/clear)** | `archetypes/clear_simple` | Log and then clear data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.cpp) | +| **[`Clear`](https://rerun.io/docs/reference/types/archetypes/clear)** | `archetypes/clear_recursive` | Log and then clear data recursively | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.cpp) | +| **[`Clear`](https://rerun.io/docs/reference/types/archetypes/clear)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **[`DepthImage`](https://rerun.io/docs/reference/types/archetypes/depth_image)** | `archetypes/depth_image_simple` | Create and log a depth image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.cpp) | +| **[`DepthImage`](https://rerun.io/docs/reference/types/archetypes/depth_image)** | `archetypes/depth_image_3d` | Create and log a depth image and pinhole camera | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.cpp) | +| **[`DisconnectedSpace`](https://rerun.io/docs/reference/types/archetypes/disconnected_space)** | `archetypes/disconnected_space` | Disconnect two spaces | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.cpp) | +| **[`Ellipsoids3D`](https://rerun.io/docs/reference/types/archetypes/ellipsoids3d)** | `archetypes/ellipsoid3d_batch` | Log a batch of ellipsoids | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_batch.cpp) | +| **[`Ellipsoids3D`](https://rerun.io/docs/reference/types/archetypes/ellipsoids3d)** | `archetypes/ellipsoid3d_simple` | Log random points and the corresponding covariance ellipsoid | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.cpp) | +| **[`EncodedImage`](https://rerun.io/docs/reference/types/archetypes/encoded_image)** | `archetypes/encoded_image` | Create and log an image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.cpp) | +| **[`EncodedImage`](https://rerun.io/docs/reference/types/archetypes/encoded_image)** | `archetypes/image_advanced` | Log an image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_advanced.py) | | | +| **[`GeoLineStrings`](https://rerun.io/docs/reference/types/archetypes/geo_line_strings)** | `archetypes/geo_line_string_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.cpp) | +| **[`GeoPoints`](https://rerun.io/docs/reference/types/archetypes/geo_points)** | `archetypes/geo_point_simple` | Log some very simple geospatial point | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.cpp) | +| **[`GeoPoints`](https://rerun.io/docs/reference/types/archetypes/geo_points)** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/map.py) | | | +| **[`GraphEdges`](https://rerun.io/docs/reference/types/archetypes/graph_edges?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | +| **[`GraphEdges`](https://rerun.io/docs/reference/types/archetypes/graph_edges?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | +| **[`GraphNodes`](https://rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | +| **[`GraphNodes`](https://rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | +| **[`GraphNodes`](https://rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link)** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/graph.py?speculative-link?speculative-link) | | | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_simple` | Create and log an image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_simple.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_send_columns` | Send multiple images at once using `send_columns` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_formats` | Create and log an image with various formats | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_formats.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_formats.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_formats.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_advanced` | Log an image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_advanced.py) | | | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/encoded_image` | Create and log an image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/depth_image_simple` | Create and log a depth image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/depth_image_3d` | Create and log a depth image and pinhole camera | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/pinhole_simple` | Log a pinhole and a random image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | +| **[`InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | +| **[`InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | +| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_segments2d_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.cpp) | +| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_strip2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.cpp) | +| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_strip2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.cpp) | +| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | +| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_segments3d_simple` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments3d_simple.cpp) | +| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_strip3d_batch` | Log a batch of 3D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_batch.cpp) | +| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_strip3d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_simple.cpp) | +| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_strip3d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.cpp) | +| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_simple` | Log a simple colored triangle | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_simple.cpp) | +| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_partial_updates` | Log a simple colored triangle, then update its vertices' positions each frame | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.cpp) | +| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | +| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_indexed` | Log a simple colored triangle | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_indexed.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_indexed.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_indexed.cpp) | +| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/manual_indicator` | Shows how to manually associate one or more indicator components with arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.cpp) | +| **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/pinhole_simple` | Log a pinhole and a random image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.cpp) | +| **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.cpp) | +| **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/depth_image_3d` | Create and log a depth image and pinhole camera | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.cpp) | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `archetypes/point2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.cpp) | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `archetypes/point2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.cpp) | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `archetypes/point2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.cpp) | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/extra_values.py) | | | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial2d.py) | | | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/annotation_context_connections` | Log annotation context with connections between keypoints | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/disconnected_space` | Disconnect two spaces | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/ellipsoid3d_simple` | Log random points and the corresponding covariance ellipsoid | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/manual_indicator` | Shows how to manually associate one or more indicator components with arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/point3d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_random.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/point3d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_simple.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/point3d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `concepts/explicit_recording` | Just makes sure that explicit recordings actually work | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/explicit_recording.py?speculative-link) | | | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `descriptors/descr_builtin_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_archetype.cpp?speculative-link) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `descriptors/descr_custom_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.cpp?speculative-link) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `migration/log_line` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/migration/log_line.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/migration/log_line.rs) | | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `quick_start/quick_start_connect` | Connect to the viewer and log some data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_connect.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_connect.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_connect.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `quick_start/quick_start_spawn` | Spawn a viewer and log some data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_spawn.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_spawn.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_spawn.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `tutorials/custom_data` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/custom_data.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/custom_data.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/custom_data.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `tutorials/timelines_example` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/timelines_example.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/timelines_example.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/timelines_example.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/scalar_simple` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/scalar_send_columns` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/series_line_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/series_point_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/data_out.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/fixed_window_plot.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualizer-overrides.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/dataframe.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | +| **[`SegmentationImage`](https://rerun.io/docs/reference/types/archetypes/segmentation_image)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | +| **[`SegmentationImage`](https://rerun.io/docs/reference/types/archetypes/segmentation_image)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | +| **[`SeriesLine`](https://rerun.io/docs/reference/types/archetypes/series_line)** | `archetypes/series_line_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.cpp) | +| **[`SeriesLine`](https://rerun.io/docs/reference/types/archetypes/series_line)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | +| **[`SeriesLine`](https://rerun.io/docs/reference/types/archetypes/series_line)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | +| **[`SeriesPoint`](https://rerun.io/docs/reference/types/archetypes/series_point)** | `archetypes/series_point_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.cpp) | +| **[`SeriesPoint`](https://rerun.io/docs/reference/types/archetypes/series_point)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | +| **[`SeriesPoint`](https://rerun.io/docs/reference/types/archetypes/series_point)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualizer-overrides.py) | | | +| **[`Tensor`](https://rerun.io/docs/reference/types/archetypes/tensor)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | +| **[`Tensor`](https://rerun.io/docs/reference/types/archetypes/tensor)** | `archetypes/tensor_simple` | Create and log a tensor | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/tensor_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/tensor_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/tensor_simple.cpp) | +| **[`Tensor`](https://rerun.io/docs/reference/types/archetypes/tensor)** | `views/bar_chart` | Use a blueprint to show a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/bar_chart.py) | | | +| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | +| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.cpp) | +| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `archetypes/entity_path` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.cpp) | +| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_log.py) | | | +| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `archetypes/text_log_integration` | Shows integration of Rerun's `TextLog` with the native logging interface | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.cpp) | +| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `archetypes/text_log` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.cpp) | +| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `concepts/app-model/native-async` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.cpp) | +| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `concepts/app-model/native-sync` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.cpp) | +| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/transform3d_simple` | Log different transforms between three arrows | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.cpp) | +| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/transform3d_axes` | Log different transforms with visualized coordinates axes | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.cpp) | +| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | +| **[`VideoFrameReference`](https://rerun.io/docs/reference/types/archetypes/video_frame_reference)** | `archetypes/video_auto_frames` | Log a video asset using automatically determined frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.cpp) | +| **[`VideoFrameReference`](https://rerun.io/docs/reference/types/archetypes/video_frame_reference)** | `archetypes/video_manual_frames` | Manual use of individual video frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/view_coordinates_simple` | Change the view coordinates for the scene | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/asset3d_simple` | Log a simple 3D asset | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | + + +### Components + +_All snippets, organized by the [`Component`](https://rerun.io/docs/reference/types/components)(s) they use._ + +| Component | Snippet | Description | Python | Rust | C++ | +| --------- | ------- | ----------- | ------ | ---- | --- | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/annotation_context_rects` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/annotation_context_connections` | Log annotation context with connections between keypoints | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.rs) | | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `archetypes/manual_indicator` | Shows how to manually associate one or more indicator components with arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.cpp) | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.cpp) | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-default.py) | | | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-override.py) | | | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `descriptors/descr_custom_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.cpp?speculative-link) | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | +| **[`DisconnectedSpace`](https://rerun.io/docs/reference/types/components/disconnected_space)** | `archetypes/disconnected_space` | Disconnect two spaces | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.cpp) | +| **[`GeoLineString`](https://rerun.io/docs/reference/types/components/geo_line_string)** | `archetypes/geo_line_string_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.cpp) | +| **[`GraphEdge`](https://rerun.io/docs/reference/types/components/graph_edge?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | +| **[`GraphEdge`](https://rerun.io/docs/reference/types/components/graph_edge?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | +| **[`GraphNode`](https://rerun.io/docs/reference/types/components/graph_node?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | +| **[`GraphNode`](https://rerun.io/docs/reference/types/components/graph_node?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | +| **[`GraphNode`](https://rerun.io/docs/reference/types/components/graph_node?speculative-link)** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/graph.py?speculative-link?speculative-link) | | | +| **[`ImageBuffer`](https://rerun.io/docs/reference/types/components/image_buffer)** | `archetypes/image_send_columns` | Send multiple images at once using `send_columns` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.cpp) | +| **[`ImageFormat`](https://rerun.io/docs/reference/types/components/image_format)** | `archetypes/image_send_columns` | Send multiple images at once using `send_columns` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.cpp) | +| **[`MediaType`](https://rerun.io/docs/reference/types/components/media_type)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.cpp) | +| **[`MediaType`](https://rerun.io/docs/reference/types/components/media_type)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | +| **[`Plane3D`](https://rerun.io/docs/reference/types/components/plane3d?speculative-link)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py?speculative-link) | | | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes/manual_indicator` | Shows how to manually associate one or more indicator components with arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.cpp) | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes/mesh3d_partial_updates` | Log a simple colored triangle, then update its vertices' positions each frame | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.cpp) | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.cpp) | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors/descr_builtin_component` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_component.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_component.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_component.cpp?speculative-link) | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors/descr_custom_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.cpp?speculative-link) | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors/descr_custom_component` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_component.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_component.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_component.cpp?speculative-link) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/point3d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/point2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/line_strip3d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/geo_line_string_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/geo_point_simple` | Log some very simple geospatial point | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/manual_indicator` | Shows how to manually associate one or more indicator components with arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/map.py) | | | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/capsule3d_batch` | Log a batch of capsules | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.cpp) | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/transform3d_axes` | Log different transforms with visualized coordinates axes | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.cpp) | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/transform3d_simple` | Log different transforms between three arrows | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/scalar_simple` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/scalar_send_columns` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/series_line_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/series_point_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/data_out.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/fixed_window_plot.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualizer-overrides.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/dataframe.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | +| **[`ShowLabels`](https://rerun.io/docs/reference/types/components/show_labels)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/data_out.py) | | | +| **[`TensorDimensionIndexSelection`](https://rerun.io/docs/reference/types/components/tensor_dimension_index_selection)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_log.py) | | | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/text_log_integration` | Shows integration of Rerun's `TextLog` with the native logging interface | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/text_log` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/entity_path` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `concepts/app-model/native-async` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `concepts/app-model/native-sync` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/data_out.py) | | | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`TextLogLevel`](https://rerun.io/docs/reference/types/components/text_log_level)** | `archetypes/text_log` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.cpp) | +| **[`TextLogLevel`](https://rerun.io/docs/reference/types/components/text_log_level)** | `archetypes/text_log_integration` | Shows integration of Rerun's `TextLog` with the native logging interface | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.cpp) | +| **[`TextLogLevel`](https://rerun.io/docs/reference/types/components/text_log_level)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_log.py) | | | +| **[`VideoTimestamp`](https://rerun.io/docs/reference/types/components/video_timestamp)** | `archetypes/video_auto_frames` | Log a video asset using automatically determined frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/view_coordinates_simple` | Change the view coordinates for the scene | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/asset3d_simple` | Log a simple 3D asset | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | + + +### Views (blueprint) + +_All snippets, organized by the [`View`](https://rerun.io/docs/reference/types/views)(s) they use._ + +| Component | Snippet | Description | Python | Rust | C++ | +| --------- | ------- | ----------- | ------ | ---- | --- | +| **[`BarChartView`](https://rerun.io/docs/reference/types/views/bar_chart_view)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`BarChartView`](https://rerun.io/docs/reference/types/views/bar_chart_view)** | `views/bar_chart` | Use a blueprint to show a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/bar_chart.py) | | | +| **[`DataframeView`](https://rerun.io/docs/reference/types/views/dataframe_view)** | `reference/dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_view_query.py) | | | +| **[`DataframeView`](https://rerun.io/docs/reference/types/views/dataframe_view)** | `reference/dataframe_save_blueprint` | Craft a blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_save_blueprint.py) | | | +| **[`DataframeView`](https://rerun.io/docs/reference/types/views/dataframe_view)** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/dataframe.py) | | | +| **[`GraphView`](https://rerun.io/docs/reference/types/views/graph_view?speculative-link)** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/graph.py?speculative-link?speculative-link) | | | +| **[`MapView`](https://rerun.io/docs/reference/types/views/map_view)** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/map.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_segments2d_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_strip2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_strip2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/point2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/point2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/point2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/video_manual_frames` | Manual use of individual video frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-base` | Base example | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-base.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-default.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-override.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/extra_values.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial2d.py) | | | +| **[`Spatial3DView`](https://rerun.io/docs/reference/types/views/spatial3d_view)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`Spatial3DView`](https://rerun.io/docs/reference/types/views/spatial3d_view)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | +| **[`TensorView`](https://rerun.io/docs/reference/types/views/tensor_view)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | +| **[`TextDocumentView`](https://rerun.io/docs/reference/types/views/text_document_view)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`TextDocumentView`](https://rerun.io/docs/reference/types/views/text_document_view)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | +| **[`TextLogView`](https://rerun.io/docs/reference/types/views/text_log_view)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_log.py) | | | +| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/fixed_window_plot.py) | | | +| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualizer-overrides.py) | | | +| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | + + +### Archetypes (blueprint) + +_All snippets, organized by the blueprint-related [`Archetype`](https://rerun.io/docs/reference/types/archetypes)(s) they use._ + +| Archetype | Snippet | Description | Python | Rust | C++ | +| --------- | ------- | ----------- | ------ | ---- | --- | +| **`Background`** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.rs) | | +| **`DataframeQuery`** | `reference/dataframe_save_blueprint` | Craft a blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_save_blueprint.py) | | | +| **`DataframeQuery`** | `reference/dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_view_query.py) | | | +| **`DataframeQuery`** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/dataframe.py) | | | +| **`LineGrid3D`** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | +| **`PlotLegend`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | +| **`ScalarAxis`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | +| **`TensorScalarMapping`** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | +| **`TensorSliceSelection`** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | +| **`VisualBounds2D`** | `archetypes/line_segments2d_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strip2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strip2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | +| **`VisualBounds2D`** | `archetypes/point2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.cpp) | +| **`VisualBounds2D`** | `archetypes/point2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/point2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.cpp) | +| **`VisualBounds2D`** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **`VisualBounds2D`** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/extra_values.py) | | | +| **`VisualBounds2D`** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/graph.py?speculative-link) | | | +| **`VisualBounds2D`** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial2d.py) | | | + + +### Components (blueprint) + +_All snippets, organized by the blueprint-related [`Component`](https://rerun.io/docs/reference/types/components)(s) they use._ + +| Component | Snippet | Description | Python | Rust | C++ | +| --------- | ------- | ----------- | ------ | ---- | --- | +| **`MapProvider`** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/map.py) | | | +| **`Visible`** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/fixed_window_plot.py) | | | +| **`Visible`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | +| **`VisibleTimeRange`** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/fixed_window_plot.py) | | | +| **`VisibleTimeRange`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | +| **`VisualBounds2D`** | `archetypes/line_segments2d_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strip2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strip2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | +| **`VisualBounds2D`** | `archetypes/point2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.cpp) | +| **`VisualBounds2D`** | `archetypes/point2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/point2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.cpp) | +| **`VisualBounds2D`** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **`VisualBounds2D`** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/extra_values.py) | | | +| **`VisualBounds2D`** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/graph.py?speculative-link) | | | +| **`VisualBounds2D`** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial2d.py) | | | +| **`VisualizerOverrides`** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | +| **`VisualizerOverrides`** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | +| **`VisualizerOverrides`** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualizer-overrides.py) | | | diff --git a/scripts/ci/check_large_files.py b/scripts/ci/check_large_files.py index a7faf9330173..694ff8672e90 100755 --- a/scripts/ci/check_large_files.py +++ b/scripts/ci/check_large_files.py @@ -12,6 +12,7 @@ "crates/store/re_types/src/datatypes/tensor_buffer.rs", "crates/viewer/re_ui/data/Inter-Medium.otf", "crates/viewer/re_viewer/src/reflection/mod.rs", + "docs/snippets/INDEX.md", "pixi.lock", "rerun_cpp/docs/Doxyfile", } From 7d0036ec007801298d902d56058cf43074809279 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Tue, 10 Dec 2024 17:36:42 +0100 Subject: [PATCH 17/71] Snippet index: support for manual opt-outs (#8385) Adds the ability to manually opt-out of the index for specific snippets/archetypes/components. E.g.: ```toml # These snippets will be excluded from the snippet index, unconditionally. [snippets_ref.snippets.opt_out] "archetypes/manual_indicator" = [] # These archetypes will ignore the associated snippets in the snippet index. [snippets_ref.archetypes.opt_out] "DataframeQuery" = [ "reference/dataframe_save_blueprint" ] # These components will ignore the associated snippets in the snippet index. [snippets_ref.components.opt_out] "ShowLabels" = [ "tutorials/data_out", ] ``` Config will have to be filled over time! [Rendered](https://github.com/rerun-io/rerun/blob/cmc/snippets_index_2_opt_outs/docs/snippets/INDEX.md) * Part of https://github.com/rerun-io/rerun/issues/1123 * Part of https://github.com/rerun-io/rerun/issues/5662 * DNM: requires https://github.com/rerun-io/rerun/pull/8383 --- .../src/codegen/docs/snippets_ref.rs | 50 +++++++++++++++++++ docs/snippets/INDEX.md | 7 --- docs/snippets/snippets.toml | 16 ++++++ 3 files changed, 66 insertions(+), 7 deletions(-) diff --git a/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs b/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs index 5dfcc757ad88..82e46adf2c22 100644 --- a/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs +++ b/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs @@ -13,6 +13,25 @@ use crate::{CodeGenerator, GeneratedFiles, Object, ObjectKind, Objects, Reporter // --- +/// See `docs/snippets/snippets.toml` for more info +#[derive(Debug, serde::Deserialize)] +struct Config { + snippets_ref: SnippetsRef, +} + +#[derive(Debug, serde::Deserialize)] +struct SnippetsRef { + snippets: OptOut, + archetypes: OptOut, + components: OptOut, +} + +#[derive(Debug, serde::Deserialize)] +struct OptOut { + // > + opt_out: BTreeMap>, +} + /// Everything we know about a snippet, including which objects (archetypes, components, etc) it references. #[allow(dead_code)] #[derive(Debug, Clone)] @@ -117,6 +136,10 @@ impl SnippetsRefCodeGenerator { let snippets_dir_root = snippets_dir.join("all"); let snippets_dir_archetypes = snippets_dir_root.clone(); + let config_path = snippets_dir.join("snippets.toml"); + let config = std::fs::read_to_string(config_path)?; + let config: Config = toml::from_str(&config)?; + let known_objects = KnownObjects::init(objects); let snippets = collect_snippets_recursively( @@ -180,6 +203,10 @@ impl SnippetsRefCodeGenerator { Ok(row) } + let opt_outs = &config.snippets_ref.snippets.opt_out; + let archetype_opt_outs = &config.snippets_ref.archetypes.opt_out; + let component_opt_outs = &config.snippets_ref.components.opt_out; + let snippets_table = |snippets: &BTreeMap<&Object, Vec>>| { let table = snippets .iter() @@ -198,6 +225,29 @@ impl SnippetsRefCodeGenerator { }); snippets.into_iter().map(move |snippet| (obj, snippet)) }) + .filter(|(obj, snippet)| { + if opt_outs.contains_key(&snippet.name_qualified) { + return false; + } + + if obj.kind == ObjectKind::Archetype { + if let Some(opt_outs) = archetype_opt_outs.get(&obj.name) { + if opt_outs.contains(&snippet.name_qualified) { + return false; + } + } + } + + if obj.kind == ObjectKind::Component { + if let Some(opt_outs) = component_opt_outs.get(&obj.name) { + if opt_outs.contains(&snippet.name_qualified) { + return false; + } + } + } + + true + }) .map(|(obj, snippet)| snippet_row(obj, &snippet)) .collect::, _>>()? .join("\n"); diff --git a/docs/snippets/INDEX.md b/docs/snippets/INDEX.md index 63c8a5d11c82..42cee4ca5457 100644 --- a/docs/snippets/INDEX.md +++ b/docs/snippets/INDEX.md @@ -101,7 +101,6 @@ _All snippets, organized by the [`Archetype`](https://rerun.io/docs/reference/ty | **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_partial_updates` | Log a simple colored triangle, then update its vertices' positions each frame | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.cpp) | | **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | | **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_indexed` | Log a simple colored triangle | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_indexed.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_indexed.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_indexed.cpp) | -| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/manual_indicator` | Shows how to manually associate one or more indicator components with arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.cpp) | | **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/pinhole_simple` | Log a pinhole and a random image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.cpp) | | **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.cpp) | | **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/depth_image_3d` | Create and log a depth image and pinhole camera | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.cpp) | @@ -118,7 +117,6 @@ _All snippets, organized by the [`Archetype`](https://rerun.io/docs/reference/ty | **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/disconnected_space` | Disconnect two spaces | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.cpp) | | **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/ellipsoid3d_simple` | Log random points and the corresponding covariance ellipsoid | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.cpp) | | **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/manual_indicator` | Shows how to manually associate one or more indicator components with arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.cpp) | | **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.cpp) | | **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/point3d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_random.cpp) | | **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/point3d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_simple.cpp) | @@ -187,7 +185,6 @@ _All snippets, organized by the [`Component`](https://rerun.io/docs/reference/ty | **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/annotation_context_connections` | Log annotation context with connections between keypoints | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.cpp) | | **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | | **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.rs) | | -| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `archetypes/manual_indicator` | Shows how to manually associate one or more indicator components with arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.cpp) | | **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.cpp) | | **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | | **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-default.py) | | | @@ -208,7 +205,6 @@ _All snippets, organized by the [`Component`](https://rerun.io/docs/reference/ty | **[`MediaType`](https://rerun.io/docs/reference/types/components/media_type)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.cpp) | | **[`MediaType`](https://rerun.io/docs/reference/types/components/media_type)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | | **[`Plane3D`](https://rerun.io/docs/reference/types/components/plane3d?speculative-link)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py?speculative-link) | | | -| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes/manual_indicator` | Shows how to manually associate one or more indicator components with arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.cpp) | | **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes/mesh3d_partial_updates` | Log a simple colored triangle, then update its vertices' positions each frame | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.cpp) | | **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.cpp) | | **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors/descr_builtin_component` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_component.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_component.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_component.cpp?speculative-link) | @@ -220,7 +216,6 @@ _All snippets, organized by the [`Component`](https://rerun.io/docs/reference/ty | **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | | **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/geo_line_string_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.cpp) | | **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/geo_point_simple` | Log some very simple geospatial point | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.cpp) | -| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/manual_indicator` | Shows how to manually associate one or more indicator components with arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/manual_indicator.cpp) | | **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | | **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/map.py) | | | | **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/capsule3d_batch` | Log a batch of capsules | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.cpp) | @@ -240,7 +235,6 @@ _All snippets, organized by the [`Component`](https://rerun.io/docs/reference/ty | **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/dataframe.py) | | | | **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | | **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | -| **[`ShowLabels`](https://rerun.io/docs/reference/types/components/show_labels)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/data_out.py) | | | | **[`TensorDimensionIndexSelection`](https://rerun.io/docs/reference/types/components/tensor_dimension_index_selection)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | | **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_log.py) | | | | **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | @@ -310,7 +304,6 @@ _All snippets, organized by the blueprint-related [`Archetype`](https://rerun.io | Archetype | Snippet | Description | Python | Rust | C++ | | --------- | ------- | ----------- | ------ | ---- | --- | | **`Background`** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.rs) | | -| **`DataframeQuery`** | `reference/dataframe_save_blueprint` | Craft a blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_save_blueprint.py) | | | | **`DataframeQuery`** | `reference/dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_view_query.py) | | | | **`DataframeQuery`** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/dataframe.py) | | | | **`LineGrid3D`** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | diff --git a/docs/snippets/snippets.toml b/docs/snippets/snippets.toml index d2eddf3d904b..65c385d36c04 100644 --- a/docs/snippets/snippets.toml +++ b/docs/snippets/snippets.toml @@ -1,5 +1,21 @@ # This file is read in `compare_snippet_output.py` and the `snippets` command in `re_dev_tools`/`build_examples`. +# These snippets will be excluded from the snippet index, unconditionally. +[snippets_ref.snippets.opt_out] +"archetypes/manual_indicator" = [] + +# These archetypes will ignore the associated snippets in the snippet index. +[snippets_ref.archetypes.opt_out] +"DataframeQuery" = [ + "reference/dataframe_save_blueprint" +] + +# These components will ignore the associated snippets in the snippet index. +[snippets_ref.components.opt_out] +"ShowLabels" = [ + "tutorials/data_out", +] + # These entries won't run at all. # # You should only ever use this if the test isn't implemented and cannot yet be implemented From 1a1c5de4e2f7504f3d84afc19e01d58cc83fb6c4 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Tue, 10 Dec 2024 17:43:57 +0100 Subject: [PATCH 18/71] Snippet index: support for enumerating custom features (#8386) Adds the ability to manually enumerate custom things. E.g.: ```toml # These arbitrary feature names will be indexed exactly as written down. # Add anything you can think about! [snippets_ref.features] "Dataframes" = [ "reference/dataframe_query", "reference/dataframe_view_query", ] "`AnyValue`" = [ "tutorials/any_values", "tutorials/extra_values", "howto/any_values_send_columns", ] ``` Config will have to be filled over time! [Rendered](https://github.com/rerun-io/rerun/blob/cmc/snippets_index_3_features/docs/snippets/INDEX.md) * Part of https://github.com/rerun-io/rerun/issues/1123 * Part of https://github.com/rerun-io/rerun/issues/5662 * DNM: requires https://github.com/rerun-io/rerun/pull/8385 --- Cargo.lock | 2 + crates/build/re_types_builder/Cargo.toml | 2 + .../src/codegen/docs/snippets_ref.rs | 91 +++++++++++++++++++ docs/snippets/INDEX.md | 13 +++ docs/snippets/snippets.toml | 13 +++ 5 files changed, 121 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 69fa505685e6..d552c57b8100 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6697,8 +6697,10 @@ dependencies = [ "re_log", "re_tracing", "rust-format", + "serde", "syn 2.0.85", "tempfile", + "toml", "unindent", "xshell", ] diff --git a/crates/build/re_types_builder/Cargo.toml b/crates/build/re_types_builder/Cargo.toml index c14049d90f1e..061b737501cf 100644 --- a/crates/build/re_types_builder/Cargo.toml +++ b/crates/build/re_types_builder/Cargo.toml @@ -47,8 +47,10 @@ proc-macro2.workspace = true quote.workspace = true rayon.workspace = true rust-format.workspace = true +serde = { workspace = true, features = ["derive"] } syn.workspace = true tempfile.workspace = true +toml = { workspace = true, features = ["parse", "preserve_order"] } unindent.workspace = true xshell.workspace = true diff --git a/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs b/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs index 82e46adf2c22..107bd36187ff 100644 --- a/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs +++ b/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs @@ -24,6 +24,9 @@ struct SnippetsRef { snippets: OptOut, archetypes: OptOut, components: OptOut, + + // > + features: BTreeMap>, } #[derive(Debug, serde::Deserialize)] @@ -47,6 +50,7 @@ struct Snippet<'o> { description: Option, contents: String, + features: BTreeSet, archetypes: BTreeSet<&'o Object>, components: BTreeSet<&'o Object>, archetypes_blueprint: BTreeSet<&'o Object>, @@ -57,6 +61,7 @@ struct Snippet<'o> { /// Maps objects (archetypes, components, etc) back to snippets. #[derive(Default, Debug)] struct Snippets<'o> { + per_feature: BTreeMap>>, per_archetype: BTreeMap<&'o Object, Vec>>, per_component: BTreeMap<&'o Object, Vec>>, per_archetype_blueprint: BTreeMap<&'o Object, Vec>>, @@ -67,6 +72,7 @@ struct Snippets<'o> { impl<'o> Snippets<'o> { fn merge_extend(&mut self, rhs: Self) { let Self { + per_feature, per_archetype, per_component, per_archetype_blueprint, @@ -74,6 +80,13 @@ impl<'o> Snippets<'o> { per_view, } = self; + for (feature, snippets) in rhs.per_feature { + per_feature + .entry(feature.clone()) + .or_default() + .extend(snippets); + } + let merge_extend = |a: &mut BTreeMap<&'o Object, Vec>>, b| { for (obj, snippets) in b { a.entry(obj).or_default().extend(snippets); @@ -145,6 +158,7 @@ impl SnippetsRefCodeGenerator { let snippets = collect_snippets_recursively( &known_objects, &snippets_dir_archetypes, + &config, &snippets_dir_root, )?; @@ -255,6 +269,58 @@ impl SnippetsRefCodeGenerator { Ok::<_, anyhow::Error>(table) }; + let per_feature_table = snippets + .per_feature + .iter() + .flat_map(|(feature, snippets)| { + let mut snippets = snippets.clone(); + // NOTE: Gotta sort twice to make sure it stays stable after the second one. + snippets.sort_by(|a, b| a.name_qualified.cmp(&b.name_qualified)); + snippets.sort_by(|a, b| { + if a.name.contains(feature) { + // Snippets that contain the feature in question in their name should + // bubble up to the top. + Ordering::Less + } else { + a.name.cmp(&b.name) + } + }); + snippets.into_iter().map(move |snippet| (feature, snippet)) + }) + .map(|(feature, snippet)| { + let snippet_name = &snippet.name; + let snippet_name_qualified = &snippet.name_qualified; + let snippet_descr = snippet.description.clone().unwrap_or_default(); + + let link_py = if snippet.python { + let link = format!("{SNIPPETS_URL}/{snippet_name_qualified}.py"); + let link = make_speculative_if_needed(&snippet.name_qualified, &link)?; + format!("[🐍]({link})") + } else { + String::new() + }; + let link_rs = if snippet.rust { + let link = format!("{SNIPPETS_URL}/{snippet_name_qualified}.rs"); + let link = make_speculative_if_needed(&snippet.name_qualified, &link)?; + format!("[🦀]({link})") + } else { + String::new() + }; + let link_cpp = if snippet.cpp { + let link = format!("{SNIPPETS_URL}/{snippet_name_qualified}.cpp"); + let link = make_speculative_if_needed(&snippet.name_qualified, &link)?; + format!("[🌊]({link})") + } else { + String::new() + }; + + let row = format!("| **{feature}** | `{snippet_name}` | {snippet_descr} | {link_py} | {link_rs} | {link_cpp} |"); + + Ok::<_, anyhow::Error>(row) + }) + .collect::, _>>()? + .join("\n"); + let per_archetype_table = snippets_table(&snippets.per_archetype)?; let per_component_table = snippets_table(&snippets.per_component)?; let per_archetype_blueprint_table = snippets_table(&snippets.per_archetype_blueprint)?; @@ -278,6 +344,7 @@ Use it to quickly find copy-pastable snippets of code for any Rerun feature you' --- *Table of contents:* +* [Features](#features) * [Types](#types) * [Archetypes](#archetypes) * [Components](#components) @@ -286,6 +353,14 @@ Use it to quickly find copy-pastable snippets of code for any Rerun feature you' * [Components (blueprint)](#components-blueprint) +## Features + +| Feature | Example | Description | Python | Rust | C++ | +| ------- | ------- | ----------- | ------ | ---- | --- | +{per_feature_table} + + + ## Types @@ -345,6 +420,7 @@ _All snippets, organized by the blueprint-related [`Component`](https://rerun.io fn collect_snippets_recursively<'o>( known_objects: &KnownObjects<'o>, dir: &Utf8Path, + config: &Config, snippet_root_path: &Utf8Path, ) -> anyhow::Result> { let mut snippets = Snippets::default(); @@ -363,6 +439,7 @@ fn collect_snippets_recursively<'o>( snippets.merge_extend(collect_snippets_recursively( known_objects, Utf8Path::from_path(&path).unwrap(), + config, snippet_root_path, )?); continue; @@ -380,6 +457,7 @@ fn collect_snippets_recursively<'o>( }); // All archetypes, components, etc that this snippet refers to. + let mut features = BTreeSet::default(); let mut archetypes = BTreeSet::default(); let mut components = BTreeSet::default(); let mut archetypes_blueprint = BTreeSet::default(); @@ -387,6 +465,11 @@ fn collect_snippets_recursively<'o>( let mut views = BTreeSet::default(); // Fill the sets by grepping into the snippet's contents. + for (feature, snippets) in &config.snippets_ref.features { + if snippets.contains(&name_qualified) { + features.insert(feature.clone()); + } + } for (objs, set) in [ (&known_objects.archetypes, &mut archetypes), (&known_objects.components, &mut components), @@ -424,6 +507,7 @@ fn collect_snippets_recursively<'o>( rust, cpp, + features, archetypes, components, archetypes_blueprint, @@ -432,6 +516,13 @@ fn collect_snippets_recursively<'o>( }; // Fill the reverse indices. + for feature in &snippet.features { + snippets + .per_feature + .entry(feature.clone()) + .or_default() + .push(snippet.clone()); + } for (objs, index) in [ (&snippet.archetypes, &mut snippets.per_archetype), (&snippet.components, &mut snippets.per_component), diff --git a/docs/snippets/INDEX.md b/docs/snippets/INDEX.md index 42cee4ca5457..9f645b2a1563 100644 --- a/docs/snippets/INDEX.md +++ b/docs/snippets/INDEX.md @@ -9,6 +9,7 @@ Use it to quickly find copy-pastable snippets of code for any Rerun feature you' --- *Table of contents:* +* [Features](#features) * [Types](#types) * [Archetypes](#archetypes) * [Components](#components) @@ -17,6 +18,18 @@ Use it to quickly find copy-pastable snippets of code for any Rerun feature you' * [Components (blueprint)](#components-blueprint) +## Features + +| Feature | Example | Description | Python | Rust | C++ | +| ------- | ------- | ----------- | ------ | ---- | --- | +| **Dataframes** | `dataframe_query` | Query and display the first 10 rows of a recording | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_query.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_query.rs) | | +| **Dataframes** | `dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_view_query.py) | | | +| **`AnyValue`** | `any_values` | Log arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/any_values.py) | | | +| **`AnyValue`** | `any_values_send_columns` | Use `AnyValues` and `send_column` to send entire columns of custom data to Rerun | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/howto/any_values_send_columns.py?speculative-link) | | | +| **`AnyValue`** | `extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/extra_values.py) | | | + + + ## Types diff --git a/docs/snippets/snippets.toml b/docs/snippets/snippets.toml index 65c385d36c04..8b5dd657fec2 100644 --- a/docs/snippets/snippets.toml +++ b/docs/snippets/snippets.toml @@ -16,6 +16,19 @@ "tutorials/data_out", ] +# These arbitrary feature names will be indexed exactly as written down. +# Add anything you can think about! +[snippets_ref.features] +"Dataframes" = [ + "reference/dataframe_query", + "reference/dataframe_view_query", +] +"`AnyValue`" = [ + "tutorials/any_values", + "tutorials/extra_values", + "howto/any_values_send_columns", +] + # These entries won't run at all. # # You should only ever use this if the test isn't implemented and cannot yet be implemented From 4ab2679668b1dc7da430ee3d015e0119d2568fd0 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Tue, 10 Dec 2024 17:45:35 +0100 Subject: [PATCH 19/71] Link to snippet index from main readme (#8391) Might be a controversial one. I think it's already useful enough to quietly link to it. * DNM: requires #8386 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e8965621452f..6da5a87e1819 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ You should now be able to run `rerun --help` in any terminal. - 📚 [High-level docs](http://rerun.io/docs) - ⏃ [Loggable Types](https://www.rerun.io/docs/reference/types) - ⚙️ [Examples](http://rerun.io/examples) +- 📖 [Code snippets](./docs/snippets/INDEX.md) - 🌊 [C++ API docs](https://ref.rerun.io/docs/cpp) - 🐍 [Python API docs](https://ref.rerun.io/docs/python) - 🦀 [Rust API docs](https://docs.rs/rerun/) From cc23b047e57a7da7aa277a8b381b1f4e1aa5dbe3 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Tue, 10 Dec 2024 18:08:12 +0100 Subject: [PATCH 20/71] Snippets: fix misnamed snippets in `archetypes/` (#8388) Archetype snippets should follow the model `{archetype_name_snake_case}_{snippet_name}`. [Index rendered](https://github.com/rerun-io/rerun/blob/cmc/snippets_index_4_cleanup_data/docs/snippets/INDEX.md) Reasons: A) Consistency. B) Snippets that contain the name of an archetype bubble up in the snippet index (when grepping for Points3D, you are likely more interested in points3d_simple vs. transform_hierarchy_mega_test_of_deth, even though both of them reference Points3D). * DNM: requires #8386 --- .../src/codegen/docs/snippets_ref.rs | 6 +- .../definitions/rerun/archetypes/arrows2d.fbs | 2 +- .../definitions/rerun/archetypes/arrows3d.fbs | 2 +- .../definitions/rerun/archetypes/boxes2d.fbs | 2 +- .../definitions/rerun/archetypes/boxes3d.fbs | 4 +- .../rerun/archetypes/capsules3d.fbs | 2 +- .../rerun/archetypes/ellipsoids3d.fbs | 2 +- .../rerun/archetypes/geo_line_strings.fbs | 2 +- .../rerun/archetypes/geo_points.fbs | 2 +- .../rerun/archetypes/line_strips2d.fbs | 8 +- .../rerun/archetypes/line_strips3d.fbs | 8 +- .../definitions/rerun/archetypes/points2d.fbs | 6 +- .../definitions/rerun/archetypes/points3d.fbs | 6 +- .../re_types/src/archetypes/line_strips2d.rs | 14 +- .../reference/types/archetypes/arrows2d.md | 4 +- .../reference/types/archetypes/arrows3d.md | 4 +- .../reference/types/archetypes/boxes2d.md | 4 +- .../reference/types/archetypes/boxes3d.md | 8 +- .../reference/types/archetypes/capsules3d.md | 4 +- .../types/archetypes/ellipsoids3d.md | 4 +- .../types/archetypes/geo_line_strings.md | 4 +- .../reference/types/archetypes/geo_points.md | 4 +- .../types/archetypes/line_strips2d.md | 20 +- .../types/archetypes/line_strips3d.md | 16 +- .../reference/types/archetypes/points2d.md | 12 +- .../reference/types/archetypes/points3d.md | 12 +- docs/snippets/INDEX.md | 592 +++++++++--------- ...arrow2d_simple.cpp => arrows2d_simple.cpp} | 0 .../{arrow2d_simple.py => arrows2d_simple.py} | 0 .../{arrow2d_simple.rs => arrows2d_simple.rs} | 0 ...arrow3d_simple.cpp => arrows3d_simple.cpp} | 0 .../{arrow3d_simple.py => arrows3d_simple.py} | 0 .../{arrow3d_simple.rs => arrows3d_simple.rs} | 0 .../{box2d_simple.cpp => boxes2d_simple.cpp} | 0 .../{box2d_simple.py => boxes2d_simple.py} | 0 .../{box2d_simple.rs => boxes2d_simple.rs} | 0 .../{box3d_batch.cpp => boxes3d_batch.cpp} | 0 .../{box3d_batch.py => boxes3d_batch.py} | 0 .../{box3d_batch.rs => boxes3d_batch.rs} | 0 .../{box3d_simple.cpp => boxes3d_simple.cpp} | 0 .../{box3d_simple.py => boxes3d_simple.py} | 0 .../{box3d_simple.rs => boxes3d_simple.rs} | 0 ...psule3d_batch.cpp => capsules3d_batch.cpp} | 0 ...capsule3d_batch.py => capsules3d_batch.py} | 0 ...capsule3d_batch.rs => capsules3d_batch.rs} | 0 ...oid3d_batch.cpp => ellipsoids3d_batch.cpp} | 0 ...psoid3d_batch.py => ellipsoids3d_batch.py} | 0 ...psoid3d_batch.rs => ellipsoids3d_batch.rs} | 0 ...d3d_simple.cpp => ellipsoids3d_simple.cpp} | 0 ...oid3d_simple.py => ellipsoids3d_simple.py} | 0 ...oid3d_simple.rs => ellipsoids3d_simple.rs} | 0 ...simple.cpp => geo_line_strings_simple.cpp} | 0 ...g_simple.py => geo_line_strings_simple.py} | 0 ...g_simple.rs => geo_line_strings_simple.rs} | 0 ...point_simple.cpp => geo_points_simple.cpp} | 0 ...o_point_simple.py => geo_points_simple.py} | 0 ...o_point_simple.rs => geo_points_simple.rs} | 0 ...ip2d_batch.cpp => line_strips2d_batch.cpp} | 0 ...trip2d_batch.py => line_strips2d_batch.py} | 0 ...trip2d_batch.rs => line_strips2d_batch.rs} | 0 ....cpp => line_strips2d_segments_simple.cpp} | 0 ...le.py => line_strips2d_segments_simple.py} | 0 ...le.rs => line_strips2d_segments_simple.rs} | 0 ...2d_simple.cpp => line_strips2d_simple.cpp} | 0 ...ip2d_simple.py => line_strips2d_simple.py} | 0 ...ip2d_simple.rs => line_strips2d_simple.rs} | 0 ...radius.cpp => line_strips2d_ui_radius.cpp} | 0 ...i_radius.py => line_strips2d_ui_radius.py} | 0 ...i_radius.rs => line_strips2d_ui_radius.rs} | 0 ...ip3d_batch.cpp => line_strips3d_batch.cpp} | 0 ...trip3d_batch.py => line_strips3d_batch.py} | 0 ...trip3d_batch.rs => line_strips3d_batch.rs} | 0 ....cpp => line_strips3d_segments_simple.cpp} | 0 ...le.py => line_strips3d_segments_simple.py} | 0 ...le.rs => line_strips3d_segments_simple.rs} | 0 ...3d_simple.cpp => line_strips3d_simple.cpp} | 0 ...ip3d_simple.py => line_strips3d_simple.py} | 0 ...ip3d_simple.rs => line_strips3d_simple.rs} | 0 ...radius.cpp => line_strips3d_ui_radius.cpp} | 0 ...i_radius.py => line_strips3d_ui_radius.py} | 0 ...i_radius.rs => line_strips3d_ui_radius.rs} | 0 ...point2d_random.cpp => points2d_random.cpp} | 0 .../{point2d_random.py => points2d_random.py} | 0 .../{point2d_random.rs => points2d_random.rs} | 0 ...point2d_simple.cpp => points2d_simple.cpp} | 0 .../{point2d_simple.py => points2d_simple.py} | 0 .../{point2d_simple.rs => points2d_simple.rs} | 0 ...d_ui_radius.cpp => points2d_ui_radius.cpp} | 0 ...t2d_ui_radius.py => points2d_ui_radius.py} | 0 ...t2d_ui_radius.rs => points2d_ui_radius.rs} | 0 ...point3d_random.cpp => points3d_random.cpp} | 0 .../{point3d_random.py => points3d_random.py} | 0 .../{point3d_random.rs => points3d_random.rs} | 0 ...point3d_simple.cpp => points3d_simple.cpp} | 0 .../{point3d_simple.py => points3d_simple.py} | 0 .../{point3d_simple.rs => points3d_simple.rs} | 0 ...d_ui_radius.cpp => points3d_ui_radius.cpp} | 0 ...t3d_ui_radius.py => points3d_ui_radius.py} | 0 ...t3d_ui_radius.rs => points3d_ui_radius.rs} | 0 docs/snippets/snippets.toml | 10 +- .../src/rerun/archetypes/line_strips2d.hpp | 18 +- .../rerun/archetypes/line_strips2d.py | 16 +- 102 files changed, 402 insertions(+), 396 deletions(-) rename docs/snippets/all/archetypes/{arrow2d_simple.cpp => arrows2d_simple.cpp} (100%) rename docs/snippets/all/archetypes/{arrow2d_simple.py => arrows2d_simple.py} (100%) rename docs/snippets/all/archetypes/{arrow2d_simple.rs => arrows2d_simple.rs} (100%) rename docs/snippets/all/archetypes/{arrow3d_simple.cpp => arrows3d_simple.cpp} (100%) rename docs/snippets/all/archetypes/{arrow3d_simple.py => arrows3d_simple.py} (100%) rename docs/snippets/all/archetypes/{arrow3d_simple.rs => arrows3d_simple.rs} (100%) rename docs/snippets/all/archetypes/{box2d_simple.cpp => boxes2d_simple.cpp} (100%) rename docs/snippets/all/archetypes/{box2d_simple.py => boxes2d_simple.py} (100%) rename docs/snippets/all/archetypes/{box2d_simple.rs => boxes2d_simple.rs} (100%) rename docs/snippets/all/archetypes/{box3d_batch.cpp => boxes3d_batch.cpp} (100%) rename docs/snippets/all/archetypes/{box3d_batch.py => boxes3d_batch.py} (100%) rename docs/snippets/all/archetypes/{box3d_batch.rs => boxes3d_batch.rs} (100%) rename docs/snippets/all/archetypes/{box3d_simple.cpp => boxes3d_simple.cpp} (100%) rename docs/snippets/all/archetypes/{box3d_simple.py => boxes3d_simple.py} (100%) rename docs/snippets/all/archetypes/{box3d_simple.rs => boxes3d_simple.rs} (100%) rename docs/snippets/all/archetypes/{capsule3d_batch.cpp => capsules3d_batch.cpp} (100%) rename docs/snippets/all/archetypes/{capsule3d_batch.py => capsules3d_batch.py} (100%) rename docs/snippets/all/archetypes/{capsule3d_batch.rs => capsules3d_batch.rs} (100%) rename docs/snippets/all/archetypes/{ellipsoid3d_batch.cpp => ellipsoids3d_batch.cpp} (100%) rename docs/snippets/all/archetypes/{ellipsoid3d_batch.py => ellipsoids3d_batch.py} (100%) rename docs/snippets/all/archetypes/{ellipsoid3d_batch.rs => ellipsoids3d_batch.rs} (100%) rename docs/snippets/all/archetypes/{ellipsoid3d_simple.cpp => ellipsoids3d_simple.cpp} (100%) rename docs/snippets/all/archetypes/{ellipsoid3d_simple.py => ellipsoids3d_simple.py} (100%) rename docs/snippets/all/archetypes/{ellipsoid3d_simple.rs => ellipsoids3d_simple.rs} (100%) rename docs/snippets/all/archetypes/{geo_line_string_simple.cpp => geo_line_strings_simple.cpp} (100%) rename docs/snippets/all/archetypes/{geo_line_string_simple.py => geo_line_strings_simple.py} (100%) rename docs/snippets/all/archetypes/{geo_line_string_simple.rs => geo_line_strings_simple.rs} (100%) rename docs/snippets/all/archetypes/{geo_point_simple.cpp => geo_points_simple.cpp} (100%) rename docs/snippets/all/archetypes/{geo_point_simple.py => geo_points_simple.py} (100%) rename docs/snippets/all/archetypes/{geo_point_simple.rs => geo_points_simple.rs} (100%) rename docs/snippets/all/archetypes/{line_strip2d_batch.cpp => line_strips2d_batch.cpp} (100%) rename docs/snippets/all/archetypes/{line_strip2d_batch.py => line_strips2d_batch.py} (100%) rename docs/snippets/all/archetypes/{line_strip2d_batch.rs => line_strips2d_batch.rs} (100%) rename docs/snippets/all/archetypes/{line_segments2d_simple.cpp => line_strips2d_segments_simple.cpp} (100%) rename docs/snippets/all/archetypes/{line_segments2d_simple.py => line_strips2d_segments_simple.py} (100%) rename docs/snippets/all/archetypes/{line_segments2d_simple.rs => line_strips2d_segments_simple.rs} (100%) rename docs/snippets/all/archetypes/{line_strip2d_simple.cpp => line_strips2d_simple.cpp} (100%) rename docs/snippets/all/archetypes/{line_strip2d_simple.py => line_strips2d_simple.py} (100%) rename docs/snippets/all/archetypes/{line_strip2d_simple.rs => line_strips2d_simple.rs} (100%) rename docs/snippets/all/archetypes/{line_strip2d_ui_radius.cpp => line_strips2d_ui_radius.cpp} (100%) rename docs/snippets/all/archetypes/{line_strip2d_ui_radius.py => line_strips2d_ui_radius.py} (100%) rename docs/snippets/all/archetypes/{line_strip2d_ui_radius.rs => line_strips2d_ui_radius.rs} (100%) rename docs/snippets/all/archetypes/{line_strip3d_batch.cpp => line_strips3d_batch.cpp} (100%) rename docs/snippets/all/archetypes/{line_strip3d_batch.py => line_strips3d_batch.py} (100%) rename docs/snippets/all/archetypes/{line_strip3d_batch.rs => line_strips3d_batch.rs} (100%) rename docs/snippets/all/archetypes/{line_segments3d_simple.cpp => line_strips3d_segments_simple.cpp} (100%) rename docs/snippets/all/archetypes/{line_segments3d_simple.py => line_strips3d_segments_simple.py} (100%) rename docs/snippets/all/archetypes/{line_segments3d_simple.rs => line_strips3d_segments_simple.rs} (100%) rename docs/snippets/all/archetypes/{line_strip3d_simple.cpp => line_strips3d_simple.cpp} (100%) rename docs/snippets/all/archetypes/{line_strip3d_simple.py => line_strips3d_simple.py} (100%) rename docs/snippets/all/archetypes/{line_strip3d_simple.rs => line_strips3d_simple.rs} (100%) rename docs/snippets/all/archetypes/{line_strip3d_ui_radius.cpp => line_strips3d_ui_radius.cpp} (100%) rename docs/snippets/all/archetypes/{line_strip3d_ui_radius.py => line_strips3d_ui_radius.py} (100%) rename docs/snippets/all/archetypes/{line_strip3d_ui_radius.rs => line_strips3d_ui_radius.rs} (100%) rename docs/snippets/all/archetypes/{point2d_random.cpp => points2d_random.cpp} (100%) rename docs/snippets/all/archetypes/{point2d_random.py => points2d_random.py} (100%) rename docs/snippets/all/archetypes/{point2d_random.rs => points2d_random.rs} (100%) rename docs/snippets/all/archetypes/{point2d_simple.cpp => points2d_simple.cpp} (100%) rename docs/snippets/all/archetypes/{point2d_simple.py => points2d_simple.py} (100%) rename docs/snippets/all/archetypes/{point2d_simple.rs => points2d_simple.rs} (100%) rename docs/snippets/all/archetypes/{point2d_ui_radius.cpp => points2d_ui_radius.cpp} (100%) rename docs/snippets/all/archetypes/{point2d_ui_radius.py => points2d_ui_radius.py} (100%) rename docs/snippets/all/archetypes/{point2d_ui_radius.rs => points2d_ui_radius.rs} (100%) rename docs/snippets/all/archetypes/{point3d_random.cpp => points3d_random.cpp} (100%) rename docs/snippets/all/archetypes/{point3d_random.py => points3d_random.py} (100%) rename docs/snippets/all/archetypes/{point3d_random.rs => points3d_random.rs} (100%) rename docs/snippets/all/archetypes/{point3d_simple.cpp => points3d_simple.cpp} (100%) rename docs/snippets/all/archetypes/{point3d_simple.py => points3d_simple.py} (100%) rename docs/snippets/all/archetypes/{point3d_simple.rs => points3d_simple.rs} (100%) rename docs/snippets/all/archetypes/{point3d_ui_radius.cpp => points3d_ui_radius.cpp} (100%) rename docs/snippets/all/archetypes/{point3d_ui_radius.py => points3d_ui_radius.py} (100%) rename docs/snippets/all/archetypes/{point3d_ui_radius.rs => points3d_ui_radius.rs} (100%) diff --git a/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs b/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs index 107bd36187ff..47fe4e3cfeac 100644 --- a/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs +++ b/crates/build/re_types_builder/src/codegen/docs/snippets_ref.rs @@ -136,8 +136,10 @@ impl SnippetsRefCodeGenerator { fn generate_fallible(&self, objects: &Objects) -> anyhow::Result { re_tracing::profile_function!(); - const SNIPPETS_URL: &str = - "https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all"; + // NOTE: We're pointing to `main` instead of `latest` for now, because a lot of snippets + // were recently renamed. + // We can change that back during the next release. + const SNIPPETS_URL: &str = "https://github.com/rerun-io/rerun/blob/main/docs/snippets/all"; let mut files_to_write = GeneratedFiles::default(); diff --git a/crates/store/re_types/definitions/rerun/archetypes/arrows2d.fbs b/crates/store/re_types/definitions/rerun/archetypes/arrows2d.fbs index 63c9403872b7..20f87c0e6a8b 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/arrows2d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/arrows2d.fbs @@ -5,7 +5,7 @@ namespace rerun.archetypes; /// 2D arrows with optional colors, radii, labels, etc. /// -/// \example archetypes/arrow2d_simple title="Simple batch of 2D arrows" image="https://static.rerun.io/arrow2d_simple/59f044ccc03f7bc66ee802288f75706618b29a6e/1200w.png" +/// \example archetypes/arrows2d_simple title="Simple batch of 2D arrows" image="https://static.rerun.io/arrow2d_simple/59f044ccc03f7bc66ee802288f75706618b29a6e/1200w.png" table Arrows2D ( "attr.rust.derive": "PartialEq", "attr.rust.new_pub_crate", diff --git a/crates/store/re_types/definitions/rerun/archetypes/arrows3d.fbs b/crates/store/re_types/definitions/rerun/archetypes/arrows3d.fbs index 1a267464fd76..24b3ea1e336e 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/arrows3d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/arrows3d.fbs @@ -4,7 +4,7 @@ namespace rerun.archetypes; /// 3D arrows with optional colors, radii, labels, etc. /// -/// \example archetypes/arrow3d_simple title="Simple batch of 3D arrows" image="https://static.rerun.io/arrow3d_simple/55e2f794a520bbf7527d7b828b0264732146c5d0/1200w.png" +/// \example archetypes/arrows3d_simple title="Simple batch of 3D arrows" image="https://static.rerun.io/arrow3d_simple/55e2f794a520bbf7527d7b828b0264732146c5d0/1200w.png" table Arrows3D ( "attr.rust.derive": "PartialEq", "attr.rust.new_pub_crate", diff --git a/crates/store/re_types/definitions/rerun/archetypes/boxes2d.fbs b/crates/store/re_types/definitions/rerun/archetypes/boxes2d.fbs index d365c2d6dd13..fc8c1b96eb24 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/boxes2d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/boxes2d.fbs @@ -4,7 +4,7 @@ namespace rerun.archetypes; /// 2D boxes with half-extents and optional center, colors etc. /// -/// \example archetypes/box2d_simple title="Simple 2D boxes" image="https://static.rerun.io/box2d_simple/ac4424f3cf747382867649610cbd749c45b2020b/1200w.png" +/// \example archetypes/boxes2d_simple title="Simple 2D boxes" image="https://static.rerun.io/box2d_simple/ac4424f3cf747382867649610cbd749c45b2020b/1200w.png" table Boxes2D ( "attr.rust.derive": "PartialEq", "attr.rust.new_pub_crate", diff --git a/crates/store/re_types/definitions/rerun/archetypes/boxes3d.fbs b/crates/store/re_types/definitions/rerun/archetypes/boxes3d.fbs index 4d5679d5fb15..bb2552778c40 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/boxes3d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/boxes3d.fbs @@ -8,8 +8,8 @@ namespace rerun.archetypes; /// Some of its component are repeated here for convenience. /// If there's more instance poses than half sizes, the last half size will be repeated for the remaining poses. /// -/// \example archetypes/box3d_simple !api title="Simple 3D boxes" image="https://static.rerun.io/box3d_simple/d6a3f38d2e3360fbacac52bb43e44762635be9c8/1200w.png" -/// \example archetypes/box3d_batch title="Batch of 3D boxes" image="https://static.rerun.io/box3d_batch/5aac5b5d29c9f2ecd572c93f6970fcec17f4984b/1200w.png" +/// \example archetypes/boxes3d_simple !api title="Simple 3D boxes" image="https://static.rerun.io/box3d_simple/d6a3f38d2e3360fbacac52bb43e44762635be9c8/1200w.png" +/// \example archetypes/boxes3d_batch title="Batch of 3D boxes" image="https://static.rerun.io/box3d_batch/5aac5b5d29c9f2ecd572c93f6970fcec17f4984b/1200w.png" table Boxes3D ( "attr.rust.derive": "PartialEq", "attr.rust.new_pub_crate", diff --git a/crates/store/re_types/definitions/rerun/archetypes/capsules3d.fbs b/crates/store/re_types/definitions/rerun/archetypes/capsules3d.fbs index c5754fdd01a4..2b7f4434b272 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/capsules3d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/capsules3d.fbs @@ -9,7 +9,7 @@ namespace rerun.archetypes; /// Capsules in other orientations may be produced by applying a rotation to the entity or /// instances. /// -/// \example archetypes/capsule3d_batch title="Batch of capsules" image="https://static.rerun.io/capsule3d_batch/6e6a4acafcf528359372147d7247f85d84434101/1200w.png" +/// \example archetypes/capsules3d_batch title="Batch of capsules" image="https://static.rerun.io/capsule3d_batch/6e6a4acafcf528359372147d7247f85d84434101/1200w.png" // // TODO(#1361): This archetype should eventually generalize to cylinders without caps, truncated // cones, and tapered capsules -- all common shapes based on expanding a line segment circularly. diff --git a/crates/store/re_types/definitions/rerun/archetypes/ellipsoids3d.fbs b/crates/store/re_types/definitions/rerun/archetypes/ellipsoids3d.fbs index aa0247b77c97..0fb824dc7017 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/ellipsoids3d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/ellipsoids3d.fbs @@ -12,7 +12,7 @@ namespace rerun.archetypes; /// Some of its component are repeated here for convenience. /// If there's more instance poses than half sizes, the last half size will be repeated for the remaining poses. /// -/// \example archetypes/ellipsoid3d_simple !api title="Covariance ellipsoid" image="https://static.rerun.io/elliopsoid3d_simple/bd5d46e61b80ae44792b52ee07d750a7137002ea/1200w.png" +/// \example archetypes/ellipsoids3d_simple !api title="Covariance ellipsoid" image="https://static.rerun.io/elliopsoid3d_simple/bd5d46e61b80ae44792b52ee07d750a7137002ea/1200w.png" table Ellipsoids3D ( "attr.rust.derive": "PartialEq", "attr.rust.new_pub_crate", diff --git a/crates/store/re_types/definitions/rerun/archetypes/geo_line_strings.fbs b/crates/store/re_types/definitions/rerun/archetypes/geo_line_strings.fbs index 2dcfefc3f734..37eb4e831e8e 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/geo_line_strings.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/geo_line_strings.fbs @@ -6,7 +6,7 @@ namespace rerun.archetypes; /// /// Also known as "line strips" or "polylines". /// -/// \example archetypes/geo_line_string_simple title="Log a geospatial line string" image="https://static.rerun.io/geo_line_strings_simple/5669983eb10906ace303755b5b5039cad75b917f/1200w.png" +/// \example archetypes/geo_line_strings_simple title="Log a geospatial line string" image="https://static.rerun.io/geo_line_strings_simple/5669983eb10906ace303755b5b5039cad75b917f/1200w.png" table GeoLineStrings ( "attr.rust.derive": "PartialEq", "attr.rust.new_pub_crate", diff --git a/crates/store/re_types/definitions/rerun/archetypes/geo_points.fbs b/crates/store/re_types/definitions/rerun/archetypes/geo_points.fbs index 452129651f6b..2c23035f084b 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/geo_points.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/geo_points.fbs @@ -2,7 +2,7 @@ namespace rerun.archetypes; /// Geospatial points with positions expressed in [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees), and optional colors and radii. /// -/// \example archetypes/geo_point_simple title="Log a geospatial point" image="https://static.rerun.io/geopoint_simple/b86ce83e5871837587bd33a0ad639358b96e9010/1200w.png" +/// \example archetypes/geo_points_simple title="Log a geospatial point" image="https://static.rerun.io/geopoint_simple/b86ce83e5871837587bd33a0ad639358b96e9010/1200w.png" table GeoPoints ( "attr.rust.derive": "PartialEq", "attr.rust.new_pub_crate", diff --git a/crates/store/re_types/definitions/rerun/archetypes/line_strips2d.fbs b/crates/store/re_types/definitions/rerun/archetypes/line_strips2d.fbs index b4b2465dbe73..1884710c1815 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/line_strips2d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/line_strips2d.fbs @@ -4,10 +4,10 @@ namespace rerun.archetypes; /// 2D line strips with positions and optional colors, radii, labels, etc. /// -/// \example archetypes/line_strip2d_simple !api image="https://static.rerun.io/line_strip2d_simple/c4e6ce937544e66b497450fd64ac3ac2f244f0e1/1200w.png" -/// \example archetypes/line_segments2d_simple !api image="https://static.rerun.io/line_segment2d_simple/53df596662dd9ffaaea5d09d091ef95220346c83/1200w.png" -/// \example archetypes/line_strip2d_batch image="https://static.rerun.io/line_strip2d_batch/c6f4062bcf510462d298a5dfe9fdbe87c754acee/1200w.png" -/// \example archetypes/line_strip3d_ui_radius title="Lines with scene & UI radius each" image="https://static.rerun.io/line_strip2d_ui_radius/d3d7d5bd36278564ee37e2ed6932963ec16f5131/1200w.png +/// \example archetypes/line_strips2d_simple !api image="https://static.rerun.io/line_strip2d_simple/c4e6ce937544e66b497450fd64ac3ac2f244f0e1/1200w.png" +/// \example archetypes/line_strips2d_segments_simple !api image="https://static.rerun.io/line_segment2d_simple/53df596662dd9ffaaea5d09d091ef95220346c83/1200w.png" +/// \example archetypes/line_strips2d_batch image="https://static.rerun.io/line_strip2d_batch/c6f4062bcf510462d298a5dfe9fdbe87c754acee/1200w.png" +/// \example archetypes/line_strips2d_ui_radius title="Lines with scene & UI radius each" image="https://static.rerun.io/line_strip2d_ui_radius/d3d7d5bd36278564ee37e2ed6932963ec16f5131/1200w.png table LineStrips2D ( "attr.rust.derive": "PartialEq", "attr.docs.category": "Spatial 2D", diff --git a/crates/store/re_types/definitions/rerun/archetypes/line_strips3d.fbs b/crates/store/re_types/definitions/rerun/archetypes/line_strips3d.fbs index 836f05d66d1f..6984cdcd2334 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/line_strips3d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/line_strips3d.fbs @@ -4,10 +4,10 @@ namespace rerun.archetypes; /// 3D line strips with positions and optional colors, radii, labels, etc. /// -/// \example archetypes/line_strip3d_simple !api title="Simple example" image="https://static.rerun.io/line_strip3d_simple/13036c0e71f78d3cec37d5724f97b47c4cf3c429/1200w.png" -/// \example archetypes/line_segments3d_simple !api title="Many individual segments" image="https://static.rerun.io/line_segment3d_simple/aa800b2a6e6a7b8e32e762b42861bae36f5014bb/1200w.png" -/// \example archetypes/line_strip3d_batch title="Many strips" image="https://static.rerun.io/line_strip3d_batch/15e8ff18a6c95a3191acb0eae6eb04adea3b4874/1200w.png" -/// \example archetypes/line_strip3d_ui_radius title="Lines with scene & UI radius each" image="https://static.rerun.io/line_strip3d_ui_radius/36b98f47e45747b5a3601511ff39b8d74c61d120/1200w.png" +/// \example archetypes/line_strips3d_simple !api title="Simple example" image="https://static.rerun.io/line_strip3d_simple/13036c0e71f78d3cec37d5724f97b47c4cf3c429/1200w.png" +/// \example archetypes/line_strips3d_segments_simple !api title="Many individual segments" image="https://static.rerun.io/line_segment3d_simple/aa800b2a6e6a7b8e32e762b42861bae36f5014bb/1200w.png" +/// \example archetypes/line_strips3d_batch title="Many strips" image="https://static.rerun.io/line_strip3d_batch/15e8ff18a6c95a3191acb0eae6eb04adea3b4874/1200w.png" +/// \example archetypes/line_strips3d_ui_radius title="Lines with scene & UI radius each" image="https://static.rerun.io/line_strip3d_ui_radius/36b98f47e45747b5a3601511ff39b8d74c61d120/1200w.png" table LineStrips3D ( "attr.rust.derive": "PartialEq", "attr.docs.category": "Spatial 3D", diff --git a/crates/store/re_types/definitions/rerun/archetypes/points2d.fbs b/crates/store/re_types/definitions/rerun/archetypes/points2d.fbs index e13aa3b52931..33bffc2991d2 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/points2d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/points2d.fbs @@ -6,9 +6,9 @@ namespace rerun.archetypes; /// A 2D point cloud with positions and optional colors, radii, labels, etc. /// -/// \example archetypes/point2d_simple !api title="Simple 2D points" image="https://static.rerun.io/point2d_simple/66e33b237ecd3d51363e56706566c5e7a58fe075/1200w.png" -/// \example archetypes/point2d_random title="Randomly distributed 2D points with varying color and radius" image="https://static.rerun.io/point2d_random/8e8ac75373677bd72bd3f56a15e44fcab309a168/1200w.png" -/// \example archetypes/point2d_ui_radius title="Log points with radii given in UI points" image="https://static.rerun.io/point2d_ui_radius/ce804fc77300d89c348b4ab5960395171497b7ac/1200w.png" +/// \example archetypes/points2d_simple !api title="Simple 2D points" image="https://static.rerun.io/point2d_simple/66e33b237ecd3d51363e56706566c5e7a58fe075/1200w.png" +/// \example archetypes/points2d_random title="Randomly distributed 2D points with varying color and radius" image="https://static.rerun.io/point2d_random/8e8ac75373677bd72bd3f56a15e44fcab309a168/1200w.png" +/// \example archetypes/points2d_ui_radius title="Log points with radii given in UI points" image="https://static.rerun.io/point2d_ui_radius/ce804fc77300d89c348b4ab5960395171497b7ac/1200w.png" table Points2D ( "attr.rust.derive": "PartialEq", "attr.docs.category": "Spatial 2D", diff --git a/crates/store/re_types/definitions/rerun/archetypes/points3d.fbs b/crates/store/re_types/definitions/rerun/archetypes/points3d.fbs index c420ad94935c..1468d2102bae 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/points3d.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/points3d.fbs @@ -4,9 +4,9 @@ namespace rerun.archetypes; /// A 3D point cloud with positions and optional colors, radii, labels, etc. /// -/// \example archetypes/point3d_simple !api title="Simple 3D points" image="https://static.rerun.io/point3d_simple/32fb3e9b65bea8bd7ffff95ad839f2f8a157a933/1200w.png" -/// \example archetypes/point3d_random title="Randomly distributed 3D points with varying color and radius" image="https://static.rerun.io/point3d_random/7e94e1806d2c381943748abbb3bedb68d564de24/1200w.png" -/// \example archetypes/point3d_ui_radius title="Log points with radii given in UI points" image="https://static.rerun.io/point3d_ui_radius/e051a65b4317438bcaea8d0eee016ac9460b5336/1200w.png" +/// \example archetypes/points3d_simple !api title="Simple 3D points" image="https://static.rerun.io/point3d_simple/32fb3e9b65bea8bd7ffff95ad839f2f8a157a933/1200w.png" +/// \example archetypes/points3d_random title="Randomly distributed 3D points with varying color and radius" image="https://static.rerun.io/point3d_random/7e94e1806d2c381943748abbb3bedb68d564de24/1200w.png" +/// \example archetypes/points3d_ui_radius title="Log points with radii given in UI points" image="https://static.rerun.io/point3d_ui_radius/e051a65b4317438bcaea8d0eee016ac9460b5336/1200w.png" /// \example archetypes/points3d_send_columns title="Send several point clouds with varying point count over time in a single call" image="https://static.rerun.io/points3d_send_columns/633b524a2ee439b0e3afc3f894f4927ce938a3ec/1200w.png" missing="rs" table Points3D ( "attr.rust.derive": "PartialEq", diff --git a/crates/store/re_types/src/archetypes/line_strips2d.rs b/crates/store/re_types/src/archetypes/line_strips2d.rs index 6e44147492ee..657ffd47d1e3 100644 --- a/crates/store/re_types/src/archetypes/line_strips2d.rs +++ b/crates/store/re_types/src/archetypes/line_strips2d.rs @@ -22,7 +22,7 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// /// ## Examples /// -/// ### `line_strip2d_batch`: +/// ### `line_strips2d_batch`: /// ```ignore /// fn main() -> Result<(), Box> { /// let rec = rerun::RecordingStreamBuilder::new("rerun_example_line_strip2d_batch").spawn()?; @@ -56,13 +56,13 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// ### Lines with scene & UI radius each /// ```ignore /// fn main() -> Result<(), Box> { -/// let rec = rerun::RecordingStreamBuilder::new("rerun_example_line_strip3d_ui_radius").spawn()?; +/// let rec = rerun::RecordingStreamBuilder::new("rerun_example_line_strip2d_ui_radius").spawn()?; /// /// // A blue line with a scene unit radii of 0.01. -/// let points = [[0., 0., 0.], [0., 0., 1.], [1., 0., 0.], [1., 0., 1.]]; +/// let points = [[0., 0.], [0., 1.], [1., 0.], [1., 1.]]; /// rec.log( /// "scene_unit_line", -/// &rerun::LineStrips3D::new([points]) +/// &rerun::LineStrips2D::new([points]) /// // By default, radii are interpreted as world-space units. /// .with_radii([0.01]) /// .with_colors([rerun::Color::from_rgb(0, 0, 255)]), @@ -71,15 +71,17 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// // A red line with a ui point radii of 5. /// // UI points are independent of zooming in Views, but are sensitive to the application UI scaling. /// // For 100 % ui scaling, UI points are equal to pixels. -/// let points = [[3., 0., 0.], [3., 0., 1.], [4., 0., 0.], [4., 0., 1.]]; +/// let points = [[3., 0.], [3., 1.], [4., 0.], [4., 1.]]; /// rec.log( /// "ui_points_line", -/// &rerun::LineStrips3D::new([points]) +/// &rerun::LineStrips2D::new([points]) /// // rerun::Radius::new_ui_points produces a radius that the viewer interprets as given in ui points. /// .with_radii([rerun::Radius::new_ui_points(5.0)]) /// .with_colors([rerun::Color::from_rgb(255, 0, 0)]), /// )?; /// +/// // TODO(#5520): log VisualBounds2D +/// /// Ok(()) /// } /// ``` diff --git a/docs/content/reference/types/archetypes/arrows2d.md b/docs/content/reference/types/archetypes/arrows2d.md index f29981bea7ee..f70f4bf833d1 100644 --- a/docs/content/reference/types/archetypes/arrows2d.md +++ b/docs/content/reference/types/archetypes/arrows2d.md @@ -27,9 +27,9 @@ title: "Arrows2D" ### Simple batch of 2D arrows -snippet: archetypes/arrow2d_simple +snippet: archetypes/arrows2d_simple - + diff --git a/docs/content/reference/types/archetypes/arrows3d.md b/docs/content/reference/types/archetypes/arrows3d.md index 0f7fae1f0740..74d794158755 100644 --- a/docs/content/reference/types/archetypes/arrows3d.md +++ b/docs/content/reference/types/archetypes/arrows3d.md @@ -27,9 +27,9 @@ title: "Arrows3D" ### Simple batch of 3D arrows -snippet: archetypes/arrow3d_simple +snippet: archetypes/arrows3d_simple - + diff --git a/docs/content/reference/types/archetypes/boxes2d.md b/docs/content/reference/types/archetypes/boxes2d.md index b2299e18b3f5..a30bbe6184b5 100644 --- a/docs/content/reference/types/archetypes/boxes2d.md +++ b/docs/content/reference/types/archetypes/boxes2d.md @@ -27,9 +27,9 @@ title: "Boxes2D" ### Simple 2D boxes -snippet: archetypes/box2d_simple +snippet: archetypes/boxes2d_simple - + diff --git a/docs/content/reference/types/archetypes/boxes3d.md b/docs/content/reference/types/archetypes/boxes3d.md index 7d192310ea0a..4a6f38e5f9f8 100644 --- a/docs/content/reference/types/archetypes/boxes3d.md +++ b/docs/content/reference/types/archetypes/boxes3d.md @@ -31,9 +31,9 @@ If there's more instance poses than half sizes, the last half size will be repea ### Simple 3D boxes -snippet: archetypes/box3d_simple +snippet: archetypes/boxes3d_simple - + @@ -43,9 +43,9 @@ snippet: archetypes/box3d_simple ### Batch of 3D boxes -snippet: archetypes/box3d_batch +snippet: archetypes/boxes3d_batch - + diff --git a/docs/content/reference/types/archetypes/capsules3d.md b/docs/content/reference/types/archetypes/capsules3d.md index 0925b8700b89..e67f29e3e214 100644 --- a/docs/content/reference/types/archetypes/capsules3d.md +++ b/docs/content/reference/types/archetypes/capsules3d.md @@ -32,9 +32,9 @@ instances. ### Batch of capsules -snippet: archetypes/capsule3d_batch +snippet: archetypes/capsules3d_batch - + diff --git a/docs/content/reference/types/archetypes/ellipsoids3d.md b/docs/content/reference/types/archetypes/ellipsoids3d.md index e0e1ecdf4bf1..3596b5596888 100644 --- a/docs/content/reference/types/archetypes/ellipsoids3d.md +++ b/docs/content/reference/types/archetypes/ellipsoids3d.md @@ -35,9 +35,9 @@ If there's more instance poses than half sizes, the last half size will be repea ### Covariance ellipsoid -snippet: archetypes/ellipsoid3d_simple +snippet: archetypes/ellipsoids3d_simple - + diff --git a/docs/content/reference/types/archetypes/geo_line_strings.md b/docs/content/reference/types/archetypes/geo_line_strings.md index 492462915e5c..ab6ad8c0fb7f 100644 --- a/docs/content/reference/types/archetypes/geo_line_strings.md +++ b/docs/content/reference/types/archetypes/geo_line_strings.md @@ -26,9 +26,9 @@ Also known as "line strips" or "polylines". ### Log a geospatial line string -snippet: archetypes/geo_line_string_simple +snippet: archetypes/geo_line_strings_simple - + diff --git a/docs/content/reference/types/archetypes/geo_points.md b/docs/content/reference/types/archetypes/geo_points.md index 2ad7615c9da2..23b4f8fd3678 100644 --- a/docs/content/reference/types/archetypes/geo_points.md +++ b/docs/content/reference/types/archetypes/geo_points.md @@ -26,9 +26,9 @@ Geospatial points with positions expressed in [EPSG:4326](https://epsg.io/4326) ### Log a geospatial point -snippet: archetypes/geo_point_simple +snippet: archetypes/geo_points_simple - + diff --git a/docs/content/reference/types/archetypes/line_strips2d.md b/docs/content/reference/types/archetypes/line_strips2d.md index a4005a5991b7..33fa65cf510f 100644 --- a/docs/content/reference/types/archetypes/line_strips2d.md +++ b/docs/content/reference/types/archetypes/line_strips2d.md @@ -25,11 +25,11 @@ title: "LineStrips2D" ## Examples -### line_strip2d_simple +### line_strips2d_simple -snippet: archetypes/line_strip2d_simple +snippet: archetypes/line_strips2d_simple - + @@ -37,11 +37,11 @@ snippet: archetypes/line_strip2d_simple -### line_segments2d_simple +### line_strips2d_segments_simple -snippet: archetypes/line_segments2d_simple +snippet: archetypes/line_strips2d_segments_simple - + @@ -49,11 +49,11 @@ snippet: archetypes/line_segments2d_simple -### line_strip2d_batch +### line_strips2d_batch -snippet: archetypes/line_strip2d_batch +snippet: archetypes/line_strips2d_batch - + @@ -63,5 +63,5 @@ snippet: archetypes/line_strip2d_batch ### Lines with scene & UI radius each -snippet: archetypes/line_strip3d_ui_radius +snippet: archetypes/line_strips2d_ui_radius diff --git a/docs/content/reference/types/archetypes/line_strips3d.md b/docs/content/reference/types/archetypes/line_strips3d.md index 30761c0abae0..76d47d20fc7f 100644 --- a/docs/content/reference/types/archetypes/line_strips3d.md +++ b/docs/content/reference/types/archetypes/line_strips3d.md @@ -27,9 +27,9 @@ title: "LineStrips3D" ### Simple example -snippet: archetypes/line_strip3d_simple +snippet: archetypes/line_strips3d_simple - + @@ -39,9 +39,9 @@ snippet: archetypes/line_strip3d_simple ### Many individual segments -snippet: archetypes/line_segments3d_simple +snippet: archetypes/line_strips3d_segments_simple - + @@ -51,9 +51,9 @@ snippet: archetypes/line_segments3d_simple ### Many strips -snippet: archetypes/line_strip3d_batch +snippet: archetypes/line_strips3d_batch - + @@ -63,9 +63,9 @@ snippet: archetypes/line_strip3d_batch ### Lines with scene & UI radius each -snippet: archetypes/line_strip3d_ui_radius +snippet: archetypes/line_strips3d_ui_radius - + diff --git a/docs/content/reference/types/archetypes/points2d.md b/docs/content/reference/types/archetypes/points2d.md index 1ca403cbe934..14d18b30114b 100644 --- a/docs/content/reference/types/archetypes/points2d.md +++ b/docs/content/reference/types/archetypes/points2d.md @@ -27,9 +27,9 @@ A 2D point cloud with positions and optional colors, radii, labels, etc. ### Simple 2D points -snippet: archetypes/point2d_simple +snippet: archetypes/points2d_simple - + @@ -39,9 +39,9 @@ snippet: archetypes/point2d_simple ### Randomly distributed 2D points with varying color and radius -snippet: archetypes/point2d_random +snippet: archetypes/points2d_random - + @@ -51,9 +51,9 @@ snippet: archetypes/point2d_random ### Log points with radii given in UI points -snippet: archetypes/point2d_ui_radius +snippet: archetypes/points2d_ui_radius - + diff --git a/docs/content/reference/types/archetypes/points3d.md b/docs/content/reference/types/archetypes/points3d.md index 6608f79221f5..e9b09c912ff3 100644 --- a/docs/content/reference/types/archetypes/points3d.md +++ b/docs/content/reference/types/archetypes/points3d.md @@ -27,9 +27,9 @@ A 3D point cloud with positions and optional colors, radii, labels, etc. ### Simple 3D points -snippet: archetypes/point3d_simple +snippet: archetypes/points3d_simple - + @@ -39,9 +39,9 @@ snippet: archetypes/point3d_simple ### Randomly distributed 3D points with varying color and radius -snippet: archetypes/point3d_random +snippet: archetypes/points3d_random - + @@ -51,9 +51,9 @@ snippet: archetypes/point3d_random ### Log points with radii given in UI points -snippet: archetypes/point3d_ui_radius +snippet: archetypes/points3d_ui_radius - + diff --git a/docs/snippets/INDEX.md b/docs/snippets/INDEX.md index 9f645b2a1563..d64fed561048 100644 --- a/docs/snippets/INDEX.md +++ b/docs/snippets/INDEX.md @@ -22,11 +22,11 @@ Use it to quickly find copy-pastable snippets of code for any Rerun feature you' | Feature | Example | Description | Python | Rust | C++ | | ------- | ------- | ----------- | ------ | ---- | --- | -| **Dataframes** | `dataframe_query` | Query and display the first 10 rows of a recording | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_query.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_query.rs) | | -| **Dataframes** | `dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_view_query.py) | | | -| **`AnyValue`** | `any_values` | Log arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/any_values.py) | | | -| **`AnyValue`** | `any_values_send_columns` | Use `AnyValues` and `send_column` to send entire columns of custom data to Rerun | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/howto/any_values_send_columns.py?speculative-link) | | | -| **`AnyValue`** | `extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/extra_values.py) | | | +| **Dataframes** | `dataframe_query` | Query and display the first 10 rows of a recording | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/reference/dataframe_query.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/reference/dataframe_query.rs) | | +| **Dataframes** | `dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/reference/dataframe_view_query.py) | | | +| **`AnyValue`** | `any_values` | Log arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/any_values.py) | | | +| **`AnyValue`** | `any_values_send_columns` | Use `AnyValues` and `send_column` to send entire columns of custom data to Rerun | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/howto/any_values_send_columns.py?speculative-link) | | | +| **`AnyValue`** | `extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | | | @@ -39,152 +39,152 @@ _All snippets, organized by the [`Archetype`](https://rerun.io/docs/reference/ty | Archetype | Snippet | Description | Python | Rust | C++ | | --------- | ------- | ----------- | ------ | ---- | --- | -| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | -| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/annotation_context_rects` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.cpp) | -| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/annotation_context_connections` | Log annotation context with connections between keypoints | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.cpp) | -| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | -| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.rs) | | -| **[`Arrows2D`](https://rerun.io/docs/reference/types/archetypes/arrows2d)** | `archetypes/arrow2d_simple` | Log a batch of 2D arrows | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow2d_simple.cpp) | -| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/arrow3d_simple` | Log a batch of 3D arrows | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/arrow3d_simple.cpp) | -| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/clear_recursive` | Log and then clear data recursively | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.cpp) | -| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/clear_simple` | Log and then clear data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.cpp) | -| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/transform3d_simple` | Log different transforms between three arrows | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.cpp) | -| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/view_coordinates_simple` | Change the view coordinates for the scene | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.cpp) | -| **[`Asset3D`](https://rerun.io/docs/reference/types/archetypes/asset3d)** | `archetypes/asset3d_simple` | Log a simple 3D asset | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.cpp) | -| **[`AssetVideo`](https://rerun.io/docs/reference/types/archetypes/asset_video)** | `archetypes/video_auto_frames` | Log a video asset using automatically determined frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.cpp) | -| **[`AssetVideo`](https://rerun.io/docs/reference/types/archetypes/asset_video)** | `archetypes/video_manual_frames` | Manual use of individual video frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.cpp) | -| **[`BarChart`](https://rerun.io/docs/reference/types/archetypes/bar_chart)** | `views/bar_chart` | Use a blueprint to show a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/bar_chart.py) | | | -| **[`BarChart`](https://rerun.io/docs/reference/types/archetypes/bar_chart)** | `archetypes/bar_chart` | Create and log a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/bar_chart.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/bar_chart.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/bar_chart.cpp) | -| **[`BarChart`](https://rerun.io/docs/reference/types/archetypes/bar_chart)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | -| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `archetypes/annotation_context_rects` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.cpp) | -| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `archetypes/box2d_simple` | Log a simple 2D Box | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box2d_simple.cpp) | -| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-base` | Base example | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-base.py) | | | -| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-default.py) | | | -| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-override.py) | | | -| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | -| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | -| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/box3d_batch` | Log a batch of oriented bounding boxes | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_batch.cpp) | -| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/box3d_simple` | Log a single 3D Box | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/box3d_simple.cpp) | -| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | -| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | -| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | -| **[`Capsules3D`](https://rerun.io/docs/reference/types/archetypes/capsules3d)** | `archetypes/capsule3d_batch` | Log a batch of capsules | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.cpp) | -| **[`Clear`](https://rerun.io/docs/reference/types/archetypes/clear)** | `archetypes/clear_simple` | Log and then clear data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_simple.cpp) | -| **[`Clear`](https://rerun.io/docs/reference/types/archetypes/clear)** | `archetypes/clear_recursive` | Log and then clear data recursively | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/clear_recursive.cpp) | -| **[`Clear`](https://rerun.io/docs/reference/types/archetypes/clear)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | -| **[`DepthImage`](https://rerun.io/docs/reference/types/archetypes/depth_image)** | `archetypes/depth_image_simple` | Create and log a depth image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.cpp) | -| **[`DepthImage`](https://rerun.io/docs/reference/types/archetypes/depth_image)** | `archetypes/depth_image_3d` | Create and log a depth image and pinhole camera | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.cpp) | -| **[`DisconnectedSpace`](https://rerun.io/docs/reference/types/archetypes/disconnected_space)** | `archetypes/disconnected_space` | Disconnect two spaces | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.cpp) | -| **[`Ellipsoids3D`](https://rerun.io/docs/reference/types/archetypes/ellipsoids3d)** | `archetypes/ellipsoid3d_batch` | Log a batch of ellipsoids | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_batch.cpp) | -| **[`Ellipsoids3D`](https://rerun.io/docs/reference/types/archetypes/ellipsoids3d)** | `archetypes/ellipsoid3d_simple` | Log random points and the corresponding covariance ellipsoid | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.cpp) | -| **[`EncodedImage`](https://rerun.io/docs/reference/types/archetypes/encoded_image)** | `archetypes/encoded_image` | Create and log an image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.cpp) | -| **[`EncodedImage`](https://rerun.io/docs/reference/types/archetypes/encoded_image)** | `archetypes/image_advanced` | Log an image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_advanced.py) | | | -| **[`GeoLineStrings`](https://rerun.io/docs/reference/types/archetypes/geo_line_strings)** | `archetypes/geo_line_string_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.cpp) | -| **[`GeoPoints`](https://rerun.io/docs/reference/types/archetypes/geo_points)** | `archetypes/geo_point_simple` | Log some very simple geospatial point | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.cpp) | -| **[`GeoPoints`](https://rerun.io/docs/reference/types/archetypes/geo_points)** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/map.py) | | | -| **[`GraphEdges`](https://rerun.io/docs/reference/types/archetypes/graph_edges?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | -| **[`GraphEdges`](https://rerun.io/docs/reference/types/archetypes/graph_edges?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | -| **[`GraphNodes`](https://rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | -| **[`GraphNodes`](https://rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | -| **[`GraphNodes`](https://rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link)** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/graph.py?speculative-link?speculative-link) | | | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_simple` | Create and log an image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_simple.cpp) | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_send_columns` | Send multiple images at once using `send_columns` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.cpp) | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_formats` | Create and log an image with various formats | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_formats.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_formats.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_formats.cpp) | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_advanced` | Log an image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_advanced.py) | | | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/encoded_image` | Create and log an image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/encoded_image.cpp) | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/depth_image_simple` | Create and log a depth image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_simple.cpp) | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/depth_image_3d` | Create and log a depth image and pinhole camera | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.cpp) | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/pinhole_simple` | Log a pinhole and a random image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.cpp) | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.cpp) | -| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | -| **[`InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | -| **[`InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | -| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_segments2d_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.cpp) | -| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_strip2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.cpp) | -| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_strip2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.cpp) | -| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | -| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_segments3d_simple` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments3d_simple.cpp) | -| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_strip3d_batch` | Log a batch of 3D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_batch.cpp) | -| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_strip3d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_simple.cpp) | -| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_strip3d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.cpp) | -| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | -| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_simple` | Log a simple colored triangle | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_simple.cpp) | -| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_partial_updates` | Log a simple colored triangle, then update its vertices' positions each frame | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.cpp) | -| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | -| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_indexed` | Log a simple colored triangle | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_indexed.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_indexed.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_indexed.cpp) | -| **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/pinhole_simple` | Log a pinhole and a random image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_simple.cpp) | -| **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.cpp) | -| **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/depth_image_3d` | Create and log a depth image and pinhole camera | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/depth_image_3d.cpp) | -| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `archetypes/point2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.cpp) | -| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `archetypes/point2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.cpp) | -| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `archetypes/point2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.cpp) | -| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | -| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | -| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | -| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/extra_values.py) | | | -| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial2d.py) | | | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/annotation_context_connections` | Log annotation context with connections between keypoints | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/disconnected_space` | Disconnect two spaces | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/ellipsoid3d_simple` | Log random points and the corresponding covariance ellipsoid | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/ellipsoid3d_simple.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/point3d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_random.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/point3d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_simple.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/point3d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `concepts/explicit_recording` | Just makes sure that explicit recordings actually work | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/explicit_recording.py?speculative-link) | | | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `descriptors/descr_builtin_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_archetype.cpp?speculative-link) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `descriptors/descr_custom_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.cpp?speculative-link) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `migration/log_line` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/migration/log_line.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/migration/log_line.rs) | | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `quick_start/quick_start_connect` | Connect to the viewer and log some data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_connect.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_connect.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_connect.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `quick_start/quick_start_spawn` | Spawn a viewer and log some data | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_spawn.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_spawn.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/quick_start/quick_start_spawn.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `tutorials/custom_data` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/custom_data.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/custom_data.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/custom_data.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `tutorials/timelines_example` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/timelines_example.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/timelines_example.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/timelines_example.cpp) | -| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/scalar_simple` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/scalar_send_columns` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/series_line_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/series_point_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/data_out.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/fixed_window_plot.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualizer-overrides.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/dataframe.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | -| **[`SegmentationImage`](https://rerun.io/docs/reference/types/archetypes/segmentation_image)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | -| **[`SegmentationImage`](https://rerun.io/docs/reference/types/archetypes/segmentation_image)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | -| **[`SeriesLine`](https://rerun.io/docs/reference/types/archetypes/series_line)** | `archetypes/series_line_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.cpp) | -| **[`SeriesLine`](https://rerun.io/docs/reference/types/archetypes/series_line)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | -| **[`SeriesLine`](https://rerun.io/docs/reference/types/archetypes/series_line)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | -| **[`SeriesPoint`](https://rerun.io/docs/reference/types/archetypes/series_point)** | `archetypes/series_point_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.cpp) | -| **[`SeriesPoint`](https://rerun.io/docs/reference/types/archetypes/series_point)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | -| **[`SeriesPoint`](https://rerun.io/docs/reference/types/archetypes/series_point)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualizer-overrides.py) | | | -| **[`Tensor`](https://rerun.io/docs/reference/types/archetypes/tensor)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | -| **[`Tensor`](https://rerun.io/docs/reference/types/archetypes/tensor)** | `archetypes/tensor_simple` | Create and log a tensor | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/tensor_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/tensor_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/tensor_simple.cpp) | -| **[`Tensor`](https://rerun.io/docs/reference/types/archetypes/tensor)** | `views/bar_chart` | Use a blueprint to show a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/bar_chart.py) | | | -| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | -| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.cpp) | -| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `archetypes/entity_path` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.cpp) | -| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | -| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_log.py) | | | -| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `archetypes/text_log_integration` | Shows integration of Rerun's `TextLog` with the native logging interface | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.cpp) | -| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `archetypes/text_log` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.cpp) | -| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `concepts/app-model/native-async` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.cpp) | -| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `concepts/app-model/native-sync` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.cpp) | -| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/transform3d_simple` | Log different transforms between three arrows | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.cpp) | -| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | -| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/transform3d_axes` | Log different transforms with visualized coordinates axes | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.cpp) | -| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | -| **[`VideoFrameReference`](https://rerun.io/docs/reference/types/archetypes/video_frame_reference)** | `archetypes/video_auto_frames` | Log a video asset using automatically determined frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.cpp) | -| **[`VideoFrameReference`](https://rerun.io/docs/reference/types/archetypes/video_frame_reference)** | `archetypes/video_manual_frames` | Manual use of individual video frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.cpp) | -| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/view_coordinates_simple` | Change the view coordinates for the scene | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.cpp) | -| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/asset3d_simple` | Log a simple 3D asset | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.cpp) | -| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.cpp) | -| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/annotation_context_rects` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_rects.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_rects.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_rects.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/annotation_context_connections` | Log annotation context with connections between keypoints | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_connections.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_connections.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_connections.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/archetypes/annotation_context)** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/annotation-context.rs) | | +| **[`Arrows2D`](https://rerun.io/docs/reference/types/archetypes/arrows2d)** | `archetypes/arrows2d_simple` | Log a batch of 2D arrows | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/arrows2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/arrows2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/arrows2d_simple.cpp) | +| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/arrows3d_simple` | Log a batch of 3D arrows | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/arrows3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/arrows3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/arrows3d_simple.cpp) | +| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/clear_recursive` | Log and then clear data recursively | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_recursive.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_recursive.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_recursive.cpp) | +| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/clear_simple` | Log and then clear data | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_simple.cpp) | +| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/transform3d_simple` | Log different transforms between three arrows | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_simple.cpp) | +| **[`Arrows3D`](https://rerun.io/docs/reference/types/archetypes/arrows3d)** | `archetypes/view_coordinates_simple` | Change the view coordinates for the scene | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/view_coordinates_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/view_coordinates_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/view_coordinates_simple.cpp) | +| **[`Asset3D`](https://rerun.io/docs/reference/types/archetypes/asset3d)** | `archetypes/asset3d_simple` | Log a simple 3D asset | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/asset3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/asset3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/asset3d_simple.cpp) | +| **[`AssetVideo`](https://rerun.io/docs/reference/types/archetypes/asset_video)** | `archetypes/video_auto_frames` | Log a video asset using automatically determined frame references | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_auto_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_auto_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_auto_frames.cpp) | +| **[`AssetVideo`](https://rerun.io/docs/reference/types/archetypes/asset_video)** | `archetypes/video_manual_frames` | Manual use of individual video frame references | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_manual_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_manual_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_manual_frames.cpp) | +| **[`BarChart`](https://rerun.io/docs/reference/types/archetypes/bar_chart)** | `views/bar_chart` | Use a blueprint to show a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/bar_chart.py) | | | +| **[`BarChart`](https://rerun.io/docs/reference/types/archetypes/bar_chart)** | `archetypes/bar_chart` | Create and log a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/bar_chart.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/bar_chart.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/bar_chart.cpp) | +| **[`BarChart`](https://rerun.io/docs/reference/types/archetypes/bar_chart)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `archetypes/boxes2d_simple` | Log a simple 2D Box | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/boxes2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/boxes2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/boxes2d_simple.cpp) | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `archetypes/annotation_context_rects` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_rects.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_rects.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_rects.cpp) | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-base` | Base example | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-base.py) | | | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-component-default.py) | | | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-component-override.py) | | | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | +| **[`Boxes2D`](https://rerun.io/docs/reference/types/archetypes/boxes2d)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | +| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/boxes3d_simple` | Log a single 3D Box | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/boxes3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/boxes3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/boxes3d_simple.cpp) | +| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/boxes3d_batch` | Log a batch of oriented bounding boxes | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/boxes3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/boxes3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/boxes3d_batch.cpp) | +| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | +| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | +| **[`Boxes3D`](https://rerun.io/docs/reference/types/archetypes/boxes3d)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial3d.py) | | | +| **[`Capsules3D`](https://rerun.io/docs/reference/types/archetypes/capsules3d)** | `archetypes/capsules3d_batch` | Log a batch of capsules | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/capsules3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/capsules3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/capsules3d_batch.cpp) | +| **[`Clear`](https://rerun.io/docs/reference/types/archetypes/clear)** | `archetypes/clear_simple` | Log and then clear data | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_simple.cpp) | +| **[`Clear`](https://rerun.io/docs/reference/types/archetypes/clear)** | `archetypes/clear_recursive` | Log and then clear data recursively | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_recursive.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_recursive.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/clear_recursive.cpp) | +| **[`Clear`](https://rerun.io/docs/reference/types/archetypes/clear)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **[`DepthImage`](https://rerun.io/docs/reference/types/archetypes/depth_image)** | `archetypes/depth_image_simple` | Create and log a depth image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_simple.cpp) | +| **[`DepthImage`](https://rerun.io/docs/reference/types/archetypes/depth_image)** | `archetypes/depth_image_3d` | Create and log a depth image and pinhole camera | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_3d.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_3d.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_3d.cpp) | +| **[`DisconnectedSpace`](https://rerun.io/docs/reference/types/archetypes/disconnected_space)** | `archetypes/disconnected_space` | Disconnect two spaces | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/disconnected_space.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/disconnected_space.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/disconnected_space.cpp) | +| **[`Ellipsoids3D`](https://rerun.io/docs/reference/types/archetypes/ellipsoids3d)** | `archetypes/ellipsoids3d_simple` | Log random points and the corresponding covariance ellipsoid | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/ellipsoids3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/ellipsoids3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/ellipsoids3d_simple.cpp) | +| **[`Ellipsoids3D`](https://rerun.io/docs/reference/types/archetypes/ellipsoids3d)** | `archetypes/ellipsoids3d_batch` | Log a batch of ellipsoids | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/ellipsoids3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/ellipsoids3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/ellipsoids3d_batch.cpp) | +| **[`EncodedImage`](https://rerun.io/docs/reference/types/archetypes/encoded_image)** | `archetypes/encoded_image` | Create and log an image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/encoded_image.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/encoded_image.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/encoded_image.cpp) | +| **[`EncodedImage`](https://rerun.io/docs/reference/types/archetypes/encoded_image)** | `archetypes/image_advanced` | Log an image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_advanced.py) | | | +| **[`GeoLineStrings`](https://rerun.io/docs/reference/types/archetypes/geo_line_strings)** | `archetypes/geo_line_strings_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.cpp) | +| **[`GeoPoints`](https://rerun.io/docs/reference/types/archetypes/geo_points)** | `archetypes/geo_points_simple` | Log some very simple geospatial point | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_points_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_points_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_points_simple.cpp) | +| **[`GeoPoints`](https://rerun.io/docs/reference/types/archetypes/geo_points)** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/map.py) | | | +| **[`GraphEdges`](https://rerun.io/docs/reference/types/archetypes/graph_edges?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | +| **[`GraphEdges`](https://rerun.io/docs/reference/types/archetypes/graph_edges?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | +| **[`GraphNodes`](https://rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | +| **[`GraphNodes`](https://rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | +| **[`GraphNodes`](https://rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link)** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/graph.py?speculative-link?speculative-link) | | | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_simple` | Create and log an image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_simple.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_send_columns` | Send multiple images at once using `send_columns` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_send_columns.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_formats` | Create and log an image with various formats | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_formats.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_formats.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_formats.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/image_advanced` | Log an image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_advanced.py) | | | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/encoded_image` | Create and log an image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/encoded_image.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/encoded_image.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/encoded_image.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/depth_image_simple` | Create and log a depth image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_simple.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/depth_image_3d` | Create and log a depth image and pinhole camera | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_3d.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_3d.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_3d.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/pinhole_simple` | Log a pinhole and a random image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_simple.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.cpp) | +| **[`Image`](https://rerun.io/docs/reference/types/archetypes/image)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/text_document.py) | | | +| **[`InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | +| **[`InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | +| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_strips2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.cpp) | +| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_strips2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.cpp) | +| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_strips2d_segments_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.cpp) | +| **[`LineStrips2D`](https://rerun.io/docs/reference/types/archetypes/line_strips2d)** | `archetypes/line_strips2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.cpp) | +| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_strips3d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_ui_radius.cpp) | +| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_strips3d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_simple.cpp) | +| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_strips3d_segments_simple` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_segments_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_segments_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_segments_simple.cpp) | +| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/line_strips3d_batch` | Log a batch of 3D line strips | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_batch.cpp) | +| **[`LineStrips3D`](https://rerun.io/docs/reference/types/archetypes/line_strips3d)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_simple` | Log a simple colored triangle | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_simple.cpp) | +| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_partial_updates` | Log a simple colored triangle, then update its vertices' positions each frame | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_partial_updates.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_partial_updates.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_partial_updates.cpp) | +| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | +| **[`Mesh3D`](https://rerun.io/docs/reference/types/archetypes/mesh3d)** | `archetypes/mesh3d_indexed` | Log a simple colored triangle | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_indexed.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_indexed.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_indexed.cpp) | +| **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/pinhole_simple` | Log a pinhole and a random image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_simple.cpp) | +| **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.cpp) | +| **[`Pinhole`](https://rerun.io/docs/reference/types/archetypes/pinhole)** | `archetypes/depth_image_3d` | Create and log a depth image and pinhole camera | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_3d.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_3d.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/depth_image_3d.cpp) | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `archetypes/points2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.cpp) | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `archetypes/points2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.cpp) | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `archetypes/points2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.cpp) | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | | | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial2d.py) | | | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/points3d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_ui_radius.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/points3d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_simple.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/points3d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_random.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/annotation_context_connections` | Log annotation context with connections between keypoints | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_connections.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_connections.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_connections.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/disconnected_space` | Disconnect two spaces | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/disconnected_space.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/disconnected_space.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/disconnected_space.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/ellipsoids3d_simple` | Log random points and the corresponding covariance ellipsoid | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/ellipsoids3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/ellipsoids3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/ellipsoids3d_simple.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `concepts/explicit_recording` | Just makes sure that explicit recordings actually work | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/explicit_recording.py?speculative-link) | | | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `descriptors/descr_builtin_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_builtin_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_builtin_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_builtin_archetype.cpp?speculative-link) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `descriptors/descr_custom_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.cpp?speculative-link) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `migration/log_line` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/migration/log_line.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/migration/log_line.rs) | | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `quick_start/quick_start_connect` | Connect to the viewer and log some data | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/quick_start/quick_start_connect.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/quick_start/quick_start_connect.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/quick_start/quick_start_connect.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `quick_start/quick_start_spawn` | Spawn a viewer and log some data | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/quick_start/quick_start_spawn.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/quick_start/quick_start_spawn.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/quick_start/quick_start_spawn.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `tutorials/custom_data` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/custom_data.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/custom_data.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/custom_data.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `tutorials/timelines_example` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/timelines_example.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/timelines_example.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/timelines_example.cpp) | +| **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial3d.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/scalar_simple` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_simple.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/scalar_send_columns` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_send_columns.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/series_line_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_line_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_line_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_line_style.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `archetypes/series_point_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_point_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_point_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_point_style.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/data_out.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/fixed_window_plot.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualizer-overrides.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/dataframe.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/tensor.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/archetypes/scalar)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/timeseries.py) | | | +| **[`SegmentationImage`](https://rerun.io/docs/reference/types/archetypes/segmentation_image)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | +| **[`SegmentationImage`](https://rerun.io/docs/reference/types/archetypes/segmentation_image)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | +| **[`SeriesLine`](https://rerun.io/docs/reference/types/archetypes/series_line)** | `archetypes/series_line_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_line_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_line_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_line_style.cpp) | +| **[`SeriesLine`](https://rerun.io/docs/reference/types/archetypes/series_line)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | +| **[`SeriesLine`](https://rerun.io/docs/reference/types/archetypes/series_line)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/timeseries.py) | | | +| **[`SeriesPoint`](https://rerun.io/docs/reference/types/archetypes/series_point)** | `archetypes/series_point_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_point_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_point_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_point_style.cpp) | +| **[`SeriesPoint`](https://rerun.io/docs/reference/types/archetypes/series_point)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | +| **[`SeriesPoint`](https://rerun.io/docs/reference/types/archetypes/series_point)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualizer-overrides.py) | | | +| **[`Tensor`](https://rerun.io/docs/reference/types/archetypes/tensor)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/tensor.py) | | | +| **[`Tensor`](https://rerun.io/docs/reference/types/archetypes/tensor)** | `archetypes/tensor_simple` | Create and log a tensor | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/tensor_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/tensor_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/tensor_simple.cpp) | +| **[`Tensor`](https://rerun.io/docs/reference/types/archetypes/tensor)** | `views/bar_chart` | Use a blueprint to show a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/bar_chart.py) | | | +| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/text_document.py) | | | +| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.cpp) | +| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `archetypes/entity_path` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/entity_path.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/entity_path.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/entity_path.cpp) | +| **[`TextDocument`](https://rerun.io/docs/reference/types/archetypes/text_document)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/text_log.py) | | | +| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `archetypes/text_log_integration` | Shows integration of Rerun's `TextLog` with the native logging interface | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log_integration.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log_integration.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log_integration.cpp) | +| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `archetypes/text_log` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log.cpp) | +| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `concepts/app-model/native-async` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-async.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-async.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-async.cpp) | +| **[`TextLog`](https://rerun.io/docs/reference/types/archetypes/text_log)** | `concepts/app-model/native-sync` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-sync.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-sync.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-sync.cpp) | +| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/transform3d_simple` | Log different transforms between three arrows | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_simple.cpp) | +| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/transform3d_axes` | Log different transforms with visualized coordinates axes | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_axes.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_axes.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_axes.cpp) | +| **[`Transform3D`](https://rerun.io/docs/reference/types/archetypes/transform3d)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | +| **[`VideoFrameReference`](https://rerun.io/docs/reference/types/archetypes/video_frame_reference)** | `archetypes/video_auto_frames` | Log a video asset using automatically determined frame references | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_auto_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_auto_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_auto_frames.cpp) | +| **[`VideoFrameReference`](https://rerun.io/docs/reference/types/archetypes/video_frame_reference)** | `archetypes/video_manual_frames` | Manual use of individual video frame references | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_manual_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_manual_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_manual_frames.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/view_coordinates_simple` | Change the view coordinates for the scene | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/view_coordinates_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/view_coordinates_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/view_coordinates_simple.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/asset3d_simple` | Log a simple 3D asset | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/asset3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/asset3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/asset3d_simple.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/archetypes/view_coordinates)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | ### Components @@ -193,80 +193,80 @@ _All snippets, organized by the [`Component`](https://rerun.io/docs/reference/ty | Component | Snippet | Description | Python | Rust | C++ | | --------- | ------- | ----------- | ------ | ---- | --- | -| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | -| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/annotation_context_rects` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_rects.cpp) | -| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/annotation_context_connections` | Log annotation context with connections between keypoints | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/annotation_context_connections.cpp) | -| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | -| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.rs) | | -| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.cpp) | -| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | -| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-default.py) | | | -| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-override.py) | | | -| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | -| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | -| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `descriptors/descr_custom_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.cpp?speculative-link) | -| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | -| **[`DisconnectedSpace`](https://rerun.io/docs/reference/types/components/disconnected_space)** | `archetypes/disconnected_space` | Disconnect two spaces | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/disconnected_space.cpp) | -| **[`GeoLineString`](https://rerun.io/docs/reference/types/components/geo_line_string)** | `archetypes/geo_line_string_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.cpp) | -| **[`GraphEdge`](https://rerun.io/docs/reference/types/components/graph_edge?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | -| **[`GraphEdge`](https://rerun.io/docs/reference/types/components/graph_edge?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | -| **[`GraphNode`](https://rerun.io/docs/reference/types/components/graph_node?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | -| **[`GraphNode`](https://rerun.io/docs/reference/types/components/graph_node?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | -| **[`GraphNode`](https://rerun.io/docs/reference/types/components/graph_node?speculative-link)** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/graph.py?speculative-link?speculative-link) | | | -| **[`ImageBuffer`](https://rerun.io/docs/reference/types/components/image_buffer)** | `archetypes/image_send_columns` | Send multiple images at once using `send_columns` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.cpp) | -| **[`ImageFormat`](https://rerun.io/docs/reference/types/components/image_format)** | `archetypes/image_send_columns` | Send multiple images at once using `send_columns` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/image_send_columns.cpp) | -| **[`MediaType`](https://rerun.io/docs/reference/types/components/media_type)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.cpp) | -| **[`MediaType`](https://rerun.io/docs/reference/types/components/media_type)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | -| **[`Plane3D`](https://rerun.io/docs/reference/types/components/plane3d?speculative-link)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py?speculative-link) | | | -| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes/mesh3d_partial_updates` | Log a simple colored triangle, then update its vertices' positions each frame | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_partial_updates.cpp) | -| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/points3d_send_columns.cpp) | -| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors/descr_builtin_component` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_component.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_component.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_builtin_component.cpp?speculative-link) | -| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors/descr_custom_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_archetype.cpp?speculative-link) | -| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors/descr_custom_component` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_component.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_component.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/descriptors/descr_custom_component.cpp?speculative-link) | -| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/point3d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point3d_ui_radius.cpp) | -| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/point2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.cpp) | -| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/line_strip3d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip3d_ui_radius.cpp) | -| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | -| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/geo_line_string_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_line_string_simple.cpp) | -| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/geo_point_simple` | Log some very simple geospatial point | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/geo_point_simple.cpp) | -| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | -| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/map.py) | | | -| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/capsule3d_batch` | Log a batch of capsules | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/capsule3d_batch.cpp) | -| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | -| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | -| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/transform3d_axes` | Log different transforms with visualized coordinates axes | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_axes.cpp) | -| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | -| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/transform3d_simple` | Log different transforms between three arrows | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_simple.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/scalar_simple` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_simple.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/scalar_send_columns` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_send_columns.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/series_line_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_line_style.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/series_point_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/series_point_style.cpp) | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/data_out.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/fixed_window_plot.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualizer-overrides.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/dataframe.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | -| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | -| **[`TensorDimensionIndexSelection`](https://rerun.io/docs/reference/types/components/tensor_dimension_index_selection)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | -| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_log.py) | | | -| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | -| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/text_log_integration` | Shows integration of Rerun's `TextLog` with the native logging interface | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.cpp) | -| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/text_log` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.cpp) | -| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_document.cpp) | -| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/entity_path` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/entity_path.cpp) | -| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `concepts/app-model/native-async` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-async.cpp) | -| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `concepts/app-model/native-sync` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/app-model/native-sync.cpp) | -| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/data_out.py) | | | -| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | -| **[`TextLogLevel`](https://rerun.io/docs/reference/types/components/text_log_level)** | `archetypes/text_log` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log.cpp) | -| **[`TextLogLevel`](https://rerun.io/docs/reference/types/components/text_log_level)** | `archetypes/text_log_integration` | Shows integration of Rerun's `TextLog` with the native logging interface | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/text_log_integration.cpp) | -| **[`TextLogLevel`](https://rerun.io/docs/reference/types/components/text_log_level)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_log.py) | | | -| **[`VideoTimestamp`](https://rerun.io/docs/reference/types/components/video_timestamp)** | `archetypes/video_auto_frames` | Log a video asset using automatically determined frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_auto_frames.cpp) | -| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/view_coordinates_simple` | Change the view coordinates for the scene | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/view_coordinates_simple.cpp) | -| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/asset3d_simple` | Log a simple 3D asset | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/asset3d_simple.cpp) | -| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/pinhole_perspective.cpp) | -| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/annotation_context_segmentation` | Log a segmentation image with annotations | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_segmentation.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/annotation_context_rects` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_rects.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_rects.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_rects.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/annotation_context_connections` | Log annotation context with connections between keypoints | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_connections.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_connections.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/annotation_context_connections.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `archetypes/segmentation_image_simple` | Create and log a segmentation image | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/segmentation_image_simple.cpp) | +| **[`AnnotationContext`](https://rerun.io/docs/reference/types/components/annotation_context)** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/annotation-context.rs) | | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.cpp) | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-component-default.py) | | | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-component-override.py) | | | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `descriptors/descr_custom_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.cpp?speculative-link) | +| **[`Color`](https://rerun.io/docs/reference/types/components/color)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial3d.py) | | | +| **[`DisconnectedSpace`](https://rerun.io/docs/reference/types/components/disconnected_space)** | `archetypes/disconnected_space` | Disconnect two spaces | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/disconnected_space.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/disconnected_space.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/disconnected_space.cpp) | +| **[`GeoLineString`](https://rerun.io/docs/reference/types/components/geo_line_string)** | `archetypes/geo_line_strings_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.cpp) | +| **[`GraphEdge`](https://rerun.io/docs/reference/types/components/graph_edge?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | +| **[`GraphEdge`](https://rerun.io/docs/reference/types/components/graph_edge?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | +| **[`GraphNode`](https://rerun.io/docs/reference/types/components/graph_node?speculative-link)** | `archetypes/graph_directed` | Log a simple directed graph | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_directed.cpp?speculative-link) | +| **[`GraphNode`](https://rerun.io/docs/reference/types/components/graph_node?speculative-link)** | `archetypes/graph_undirected` | Log a simple undirected graph | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/graph_undirected.cpp?speculative-link) | +| **[`GraphNode`](https://rerun.io/docs/reference/types/components/graph_node?speculative-link)** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/graph.py?speculative-link?speculative-link) | | | +| **[`ImageBuffer`](https://rerun.io/docs/reference/types/components/image_buffer)** | `archetypes/image_send_columns` | Send multiple images at once using `send_columns` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_send_columns.cpp) | +| **[`ImageFormat`](https://rerun.io/docs/reference/types/components/image_format)** | `archetypes/image_send_columns` | Send multiple images at once using `send_columns` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/image_send_columns.cpp) | +| **[`MediaType`](https://rerun.io/docs/reference/types/components/media_type)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.cpp) | +| **[`MediaType`](https://rerun.io/docs/reference/types/components/media_type)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/text_document.py) | | | +| **[`Plane3D`](https://rerun.io/docs/reference/types/components/plane3d?speculative-link)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial3d.py?speculative-link) | | | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes/mesh3d_partial_updates` | Log a simple colored triangle, then update its vertices' positions each frame | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_partial_updates.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_partial_updates.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_partial_updates.cpp) | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `archetypes/points3d_send_columns` | Use the `send_columns` API to send several point clouds over time in a single call | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.py) | | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_send_columns.cpp) | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors/descr_builtin_component` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_builtin_component.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_builtin_component.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_builtin_component.cpp?speculative-link) | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors/descr_custom_archetype` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_archetype.cpp?speculative-link) | +| **[`Position3D`](https://rerun.io/docs/reference/types/components/position3d)** | `descriptors/descr_custom_component` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_component.py?speculative-link) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_component.rs?speculative-link) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/descriptors/descr_custom_component.cpp?speculative-link) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/points3d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_ui_radius.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/points2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/line_strips3d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips3d_ui_radius.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/line_strips2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/geo_line_strings_simple` | Log a simple geospatial line string | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_line_strings_simple.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `archetypes/geo_points_simple` | Log some very simple geospatial point | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_points_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_points_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/geo_points_simple.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **[`Radius`](https://rerun.io/docs/reference/types/components/radius)** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/map.py) | | | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/capsules3d_batch` | Log a batch of capsules | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/capsules3d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/capsules3d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/capsules3d_batch.cpp) | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/instance_poses3d_combined` | Log a simple 3D box with a regular & instance pose transform | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/instance_poses3d_combined.cpp) | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/mesh3d_instancing` | Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing) | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/mesh3d_instancing.cpp) | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/transform3d_axes` | Log different transforms with visualized coordinates axes | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_axes.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_axes.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_axes.cpp) | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`RotationAxisAngle`](https://rerun.io/docs/reference/types/components/rotation_axis_angle)** | `archetypes/transform3d_simple` | Log different transforms between three arrows | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_simple.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/scalar_simple` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_simple.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/scalar_send_columns` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_send_columns.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_send_columns.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_send_columns.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/scalar_multiple_plots` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/scalar_multiple_plots.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/series_line_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_line_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_line_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_line_style.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `archetypes/series_point_style` | Log a scalar over time | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_point_style.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_point_style.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/series_point_style.cpp) | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/data_out.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/fixed_window_plot.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualizer-overrides.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/dataframe.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/tensor.py) | | | +| **[`Scalar`](https://rerun.io/docs/reference/types/components/scalar)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/timeseries.py) | | | +| **[`TensorDimensionIndexSelection`](https://rerun.io/docs/reference/types/components/tensor_dimension_index_selection)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/tensor.py) | | | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/text_log.py) | | | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/text_document.py) | | | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/text_log_integration` | Shows integration of Rerun's `TextLog` with the native logging interface | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log_integration.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log_integration.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log_integration.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/text_log` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/text_document` | Log a `TextDocument` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_document.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `archetypes/entity_path` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/entity_path.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/entity_path.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/entity_path.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `concepts/app-model/native-async` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-async.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-async.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-async.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `concepts/app-model/native-sync` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-sync.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-sync.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/app-model/native-sync.cpp) | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `tutorials/data_out` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/data_out.py) | | | +| **[`Text`](https://rerun.io/docs/reference/types/components/text)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`TextLogLevel`](https://rerun.io/docs/reference/types/components/text_log_level)** | `archetypes/text_log` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log.cpp) | +| **[`TextLogLevel`](https://rerun.io/docs/reference/types/components/text_log_level)** | `archetypes/text_log_integration` | Shows integration of Rerun's `TextLog` with the native logging interface | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log_integration.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log_integration.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/text_log_integration.cpp) | +| **[`TextLogLevel`](https://rerun.io/docs/reference/types/components/text_log_level)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/text_log.py) | | | +| **[`VideoTimestamp`](https://rerun.io/docs/reference/types/components/video_timestamp)** | `archetypes/video_auto_frames` | Log a video asset using automatically determined frame references | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_auto_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_auto_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_auto_frames.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/view_coordinates_simple` | Change the view coordinates for the scene | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/view_coordinates_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/view_coordinates_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/view_coordinates_simple.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/asset3d_simple` | Log a simple 3D asset | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/asset3d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/asset3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/asset3d_simple.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/pinhole_perspective` | Logs a point cloud and a perspective camera looking at it | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/pinhole_perspective.cpp) | +| **[`ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | ### Views (blueprint) @@ -275,39 +275,39 @@ _All snippets, organized by the [`View`](https://rerun.io/docs/reference/types/v | Component | Snippet | Description | Python | Rust | C++ | | --------- | ------- | ----------- | ------ | ---- | --- | -| **[`BarChartView`](https://rerun.io/docs/reference/types/views/bar_chart_view)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | -| **[`BarChartView`](https://rerun.io/docs/reference/types/views/bar_chart_view)** | `views/bar_chart` | Use a blueprint to show a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/bar_chart.py) | | | -| **[`DataframeView`](https://rerun.io/docs/reference/types/views/dataframe_view)** | `reference/dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_view_query.py) | | | -| **[`DataframeView`](https://rerun.io/docs/reference/types/views/dataframe_view)** | `reference/dataframe_save_blueprint` | Craft a blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_save_blueprint.py) | | | -| **[`DataframeView`](https://rerun.io/docs/reference/types/views/dataframe_view)** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/dataframe.py) | | | -| **[`GraphView`](https://rerun.io/docs/reference/types/views/graph_view?speculative-link)** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/graph.py?speculative-link?speculative-link) | | | -| **[`MapView`](https://rerun.io/docs/reference/types/views/map_view)** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/map.py) | | | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_segments2d_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.cpp) | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_strip2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.cpp) | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_strip2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.cpp) | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/point2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.cpp) | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/point2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.cpp) | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/point2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.cpp) | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/video_manual_frames` | Manual use of individual video frame references | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/video_manual_frames.cpp) | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-base` | Base example | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-base.py) | | | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-default.py) | | | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-component-override.py) | | | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/extra_values.py) | | | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial2d.py) | | | -| **[`Spatial3DView`](https://rerun.io/docs/reference/types/views/spatial3d_view)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | -| **[`Spatial3DView`](https://rerun.io/docs/reference/types/views/spatial3d_view)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | -| **[`TensorView`](https://rerun.io/docs/reference/types/views/tensor_view)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | -| **[`TextDocumentView`](https://rerun.io/docs/reference/types/views/text_document_view)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | -| **[`TextDocumentView`](https://rerun.io/docs/reference/types/views/text_document_view)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_document.py) | | | -| **[`TextLogView`](https://rerun.io/docs/reference/types/views/text_log_view)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/text_log.py) | | | -| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/fixed_window_plot.py) | | | -| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | -| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualizer-overrides.py) | | | -| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | +| **[`BarChartView`](https://rerun.io/docs/reference/types/views/bar_chart_view)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`BarChartView`](https://rerun.io/docs/reference/types/views/bar_chart_view)** | `views/bar_chart` | Use a blueprint to show a bar chart | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/bar_chart.py) | | | +| **[`DataframeView`](https://rerun.io/docs/reference/types/views/dataframe_view)** | `reference/dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/reference/dataframe_view_query.py) | | | +| **[`DataframeView`](https://rerun.io/docs/reference/types/views/dataframe_view)** | `reference/dataframe_save_blueprint` | Craft a blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/reference/dataframe_save_blueprint.py) | | | +| **[`DataframeView`](https://rerun.io/docs/reference/types/views/dataframe_view)** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/dataframe.py) | | | +| **[`GraphView`](https://rerun.io/docs/reference/types/views/graph_view?speculative-link)** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/graph.py?speculative-link?speculative-link) | | | +| **[`MapView`](https://rerun.io/docs/reference/types/views/map_view)** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/map.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_strips2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_strips2d_segments_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_strips2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/line_strips2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/points2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/points2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/points2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `archetypes/video_manual_frames` | Manual use of individual video frame references | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_manual_frames.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_manual_frames.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/video_manual_frames.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-base` | Base example | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-base.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-component-default` | Add a component default | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-component-default.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-component-override.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial2d.py) | | | +| **[`Spatial3DView`](https://rerun.io/docs/reference/types/views/spatial3d_view)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | +| **[`Spatial3DView`](https://rerun.io/docs/reference/types/views/spatial3d_view)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial3d.py) | | | +| **[`TensorView`](https://rerun.io/docs/reference/types/views/tensor_view)** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/tensor.py) | | | +| **[`TextDocumentView`](https://rerun.io/docs/reference/types/views/text_document_view)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`TextDocumentView`](https://rerun.io/docs/reference/types/views/text_document_view)** | `views/text_document` | Use a blueprint to show a text document | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/text_document.py) | | | +| **[`TextLogView`](https://rerun.io/docs/reference/types/views/text_log_view)** | `views/text_log` | Use a blueprint to show a text log | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/text_log.py) | | | +| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/fixed_window_plot.py) | | | +| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `tutorials/visualization/save_blueprint` | Craft an example blueprint with the python API and save it to a file for future use | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualization/save_blueprint.py) | | | +| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualizer-overrides.py) | | | +| **[`TimeSeriesView`](https://rerun.io/docs/reference/types/views/time_series_view)** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/timeseries.py) | | | ### Archetypes (blueprint) @@ -316,25 +316,25 @@ _All snippets, organized by the blueprint-related [`Archetype`](https://rerun.io | Archetype | Snippet | Description | Python | Rust | C++ | | --------- | ------- | ----------- | ------ | ---- | --- | -| **`Background`** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/annotation-context.rs) | | -| **`DataframeQuery`** | `reference/dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/reference/dataframe_view_query.py) | | | -| **`DataframeQuery`** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/dataframe.py) | | | -| **`LineGrid3D`** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial3d.py) | | | -| **`PlotLegend`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | -| **`ScalarAxis`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | -| **`TensorScalarMapping`** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | -| **`TensorSliceSelection`** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/tensor.py) | | | -| **`VisualBounds2D`** | `archetypes/line_segments2d_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.cpp) | -| **`VisualBounds2D`** | `archetypes/line_strip2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.cpp) | -| **`VisualBounds2D`** | `archetypes/line_strip2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.cpp) | -| **`VisualBounds2D`** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | -| **`VisualBounds2D`** | `archetypes/point2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.cpp) | -| **`VisualBounds2D`** | `archetypes/point2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.cpp) | -| **`VisualBounds2D`** | `archetypes/point2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.cpp) | -| **`VisualBounds2D`** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | -| **`VisualBounds2D`** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/extra_values.py) | | | -| **`VisualBounds2D`** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/graph.py?speculative-link) | | | -| **`VisualBounds2D`** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial2d.py) | | | +| **`Background`** | `tutorials/annotation-context` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/annotation-context.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/annotation-context.rs) | | +| **`DataframeQuery`** | `reference/dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/reference/dataframe_view_query.py) | | | +| **`DataframeQuery`** | `views/dataframe` | Use a blueprint to customize a DataframeView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/dataframe.py) | | | +| **`LineGrid3D`** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial3d.py) | | | +| **`PlotLegend`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/timeseries.py) | | | +| **`ScalarAxis`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/timeseries.py) | | | +| **`TensorScalarMapping`** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/tensor.py) | | | +| **`TensorSliceSelection`** | `views/tensor` | Use a blueprint to show a tensor view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/tensor.py) | | | +| **`VisualBounds2D`** | `archetypes/line_strips2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strips2d_segments_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strips2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strips2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.cpp) | +| **`VisualBounds2D`** | `archetypes/points2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.cpp) | +| **`VisualBounds2D`** | `archetypes/points2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/points2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.cpp) | +| **`VisualBounds2D`** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **`VisualBounds2D`** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | | | +| **`VisualBounds2D`** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/graph.py?speculative-link) | | | +| **`VisualBounds2D`** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial2d.py) | | | ### Components (blueprint) @@ -343,22 +343,22 @@ _All snippets, organized by the blueprint-related [`Component`](https://rerun.io | Component | Snippet | Description | Python | Rust | C++ | | --------- | ------- | ----------- | ------ | ---- | --- | -| **`MapProvider`** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/map.py) | | | -| **`Visible`** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/fixed_window_plot.py) | | | -| **`Visible`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | -| **`VisibleTimeRange`** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/fixed_window_plot.py) | | | -| **`VisibleTimeRange`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/timeseries.py) | | | -| **`VisualBounds2D`** | `archetypes/line_segments2d_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_segments2d_simple.cpp) | -| **`VisualBounds2D`** | `archetypes/line_strip2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_batch.cpp) | -| **`VisualBounds2D`** | `archetypes/line_strip2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_simple.cpp) | -| **`VisualBounds2D`** | `archetypes/line_strip2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp) | -| **`VisualBounds2D`** | `archetypes/point2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_random.cpp) | -| **`VisualBounds2D`** | `archetypes/point2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_simple.cpp) | -| **`VisualBounds2D`** | `archetypes/point2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/archetypes/point2d_ui_radius.cpp) | -| **`VisualBounds2D`** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/different_data_per_timeline.cpp) | -| **`VisualBounds2D`** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/extra_values.py) | | | -| **`VisualBounds2D`** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/graph.py?speculative-link) | | | -| **`VisualBounds2D`** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/views/spatial2d.py) | | | -| **`VisualizerOverrides`** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | -| **`VisualizerOverrides`** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | -| **`VisualizerOverrides`** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/latest/docs/snippets/all/tutorials/visualizer-overrides.py) | | | +| **`MapProvider`** | `views/map` | Use a blueprint to customize a map view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/map.py) | | | +| **`Visible`** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/fixed_window_plot.py) | | | +| **`Visible`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/timeseries.py) | | | +| **`VisibleTimeRange`** | `tutorials/fixed_window_plot` | | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/fixed_window_plot.py) | | | +| **`VisibleTimeRange`** | `views/timeseries` | Use a blueprint to customize a TimeSeriesView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/timeseries.py) | | | +| **`VisualBounds2D`** | `archetypes/line_strips2d_batch` | Log a batch of 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_batch.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strips2d_segments_simple` | Log a couple 2D line segments using 2D line strips | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_segments_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strips2d_simple` | Log a simple line strip | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/line_strips2d_ui_radius` | Log lines with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/line_strips2d_ui_radius.cpp) | +| **`VisualBounds2D`** | `archetypes/points2d_random` | Log some random points with color and radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_random.cpp) | +| **`VisualBounds2D`** | `archetypes/points2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.cpp) | +| **`VisualBounds2D`** | `archetypes/points2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.cpp) | +| **`VisualBounds2D`** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [🦀](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | +| **`VisualBounds2D`** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | | | +| **`VisualBounds2D`** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/graph.py?speculative-link) | | | +| **`VisualBounds2D`** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial2d.py) | | | +| **`VisualizerOverrides`** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | +| **`VisualizerOverrides`** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | +| **`VisualizerOverrides`** | `tutorials/visualizer-overrides` | Log a scalar over time and override the visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/visualizer-overrides.py) | | | diff --git a/docs/snippets/all/archetypes/arrow2d_simple.cpp b/docs/snippets/all/archetypes/arrows2d_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/arrow2d_simple.cpp rename to docs/snippets/all/archetypes/arrows2d_simple.cpp diff --git a/docs/snippets/all/archetypes/arrow2d_simple.py b/docs/snippets/all/archetypes/arrows2d_simple.py similarity index 100% rename from docs/snippets/all/archetypes/arrow2d_simple.py rename to docs/snippets/all/archetypes/arrows2d_simple.py diff --git a/docs/snippets/all/archetypes/arrow2d_simple.rs b/docs/snippets/all/archetypes/arrows2d_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/arrow2d_simple.rs rename to docs/snippets/all/archetypes/arrows2d_simple.rs diff --git a/docs/snippets/all/archetypes/arrow3d_simple.cpp b/docs/snippets/all/archetypes/arrows3d_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/arrow3d_simple.cpp rename to docs/snippets/all/archetypes/arrows3d_simple.cpp diff --git a/docs/snippets/all/archetypes/arrow3d_simple.py b/docs/snippets/all/archetypes/arrows3d_simple.py similarity index 100% rename from docs/snippets/all/archetypes/arrow3d_simple.py rename to docs/snippets/all/archetypes/arrows3d_simple.py diff --git a/docs/snippets/all/archetypes/arrow3d_simple.rs b/docs/snippets/all/archetypes/arrows3d_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/arrow3d_simple.rs rename to docs/snippets/all/archetypes/arrows3d_simple.rs diff --git a/docs/snippets/all/archetypes/box2d_simple.cpp b/docs/snippets/all/archetypes/boxes2d_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/box2d_simple.cpp rename to docs/snippets/all/archetypes/boxes2d_simple.cpp diff --git a/docs/snippets/all/archetypes/box2d_simple.py b/docs/snippets/all/archetypes/boxes2d_simple.py similarity index 100% rename from docs/snippets/all/archetypes/box2d_simple.py rename to docs/snippets/all/archetypes/boxes2d_simple.py diff --git a/docs/snippets/all/archetypes/box2d_simple.rs b/docs/snippets/all/archetypes/boxes2d_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/box2d_simple.rs rename to docs/snippets/all/archetypes/boxes2d_simple.rs diff --git a/docs/snippets/all/archetypes/box3d_batch.cpp b/docs/snippets/all/archetypes/boxes3d_batch.cpp similarity index 100% rename from docs/snippets/all/archetypes/box3d_batch.cpp rename to docs/snippets/all/archetypes/boxes3d_batch.cpp diff --git a/docs/snippets/all/archetypes/box3d_batch.py b/docs/snippets/all/archetypes/boxes3d_batch.py similarity index 100% rename from docs/snippets/all/archetypes/box3d_batch.py rename to docs/snippets/all/archetypes/boxes3d_batch.py diff --git a/docs/snippets/all/archetypes/box3d_batch.rs b/docs/snippets/all/archetypes/boxes3d_batch.rs similarity index 100% rename from docs/snippets/all/archetypes/box3d_batch.rs rename to docs/snippets/all/archetypes/boxes3d_batch.rs diff --git a/docs/snippets/all/archetypes/box3d_simple.cpp b/docs/snippets/all/archetypes/boxes3d_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/box3d_simple.cpp rename to docs/snippets/all/archetypes/boxes3d_simple.cpp diff --git a/docs/snippets/all/archetypes/box3d_simple.py b/docs/snippets/all/archetypes/boxes3d_simple.py similarity index 100% rename from docs/snippets/all/archetypes/box3d_simple.py rename to docs/snippets/all/archetypes/boxes3d_simple.py diff --git a/docs/snippets/all/archetypes/box3d_simple.rs b/docs/snippets/all/archetypes/boxes3d_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/box3d_simple.rs rename to docs/snippets/all/archetypes/boxes3d_simple.rs diff --git a/docs/snippets/all/archetypes/capsule3d_batch.cpp b/docs/snippets/all/archetypes/capsules3d_batch.cpp similarity index 100% rename from docs/snippets/all/archetypes/capsule3d_batch.cpp rename to docs/snippets/all/archetypes/capsules3d_batch.cpp diff --git a/docs/snippets/all/archetypes/capsule3d_batch.py b/docs/snippets/all/archetypes/capsules3d_batch.py similarity index 100% rename from docs/snippets/all/archetypes/capsule3d_batch.py rename to docs/snippets/all/archetypes/capsules3d_batch.py diff --git a/docs/snippets/all/archetypes/capsule3d_batch.rs b/docs/snippets/all/archetypes/capsules3d_batch.rs similarity index 100% rename from docs/snippets/all/archetypes/capsule3d_batch.rs rename to docs/snippets/all/archetypes/capsules3d_batch.rs diff --git a/docs/snippets/all/archetypes/ellipsoid3d_batch.cpp b/docs/snippets/all/archetypes/ellipsoids3d_batch.cpp similarity index 100% rename from docs/snippets/all/archetypes/ellipsoid3d_batch.cpp rename to docs/snippets/all/archetypes/ellipsoids3d_batch.cpp diff --git a/docs/snippets/all/archetypes/ellipsoid3d_batch.py b/docs/snippets/all/archetypes/ellipsoids3d_batch.py similarity index 100% rename from docs/snippets/all/archetypes/ellipsoid3d_batch.py rename to docs/snippets/all/archetypes/ellipsoids3d_batch.py diff --git a/docs/snippets/all/archetypes/ellipsoid3d_batch.rs b/docs/snippets/all/archetypes/ellipsoids3d_batch.rs similarity index 100% rename from docs/snippets/all/archetypes/ellipsoid3d_batch.rs rename to docs/snippets/all/archetypes/ellipsoids3d_batch.rs diff --git a/docs/snippets/all/archetypes/ellipsoid3d_simple.cpp b/docs/snippets/all/archetypes/ellipsoids3d_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/ellipsoid3d_simple.cpp rename to docs/snippets/all/archetypes/ellipsoids3d_simple.cpp diff --git a/docs/snippets/all/archetypes/ellipsoid3d_simple.py b/docs/snippets/all/archetypes/ellipsoids3d_simple.py similarity index 100% rename from docs/snippets/all/archetypes/ellipsoid3d_simple.py rename to docs/snippets/all/archetypes/ellipsoids3d_simple.py diff --git a/docs/snippets/all/archetypes/ellipsoid3d_simple.rs b/docs/snippets/all/archetypes/ellipsoids3d_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/ellipsoid3d_simple.rs rename to docs/snippets/all/archetypes/ellipsoids3d_simple.rs diff --git a/docs/snippets/all/archetypes/geo_line_string_simple.cpp b/docs/snippets/all/archetypes/geo_line_strings_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/geo_line_string_simple.cpp rename to docs/snippets/all/archetypes/geo_line_strings_simple.cpp diff --git a/docs/snippets/all/archetypes/geo_line_string_simple.py b/docs/snippets/all/archetypes/geo_line_strings_simple.py similarity index 100% rename from docs/snippets/all/archetypes/geo_line_string_simple.py rename to docs/snippets/all/archetypes/geo_line_strings_simple.py diff --git a/docs/snippets/all/archetypes/geo_line_string_simple.rs b/docs/snippets/all/archetypes/geo_line_strings_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/geo_line_string_simple.rs rename to docs/snippets/all/archetypes/geo_line_strings_simple.rs diff --git a/docs/snippets/all/archetypes/geo_point_simple.cpp b/docs/snippets/all/archetypes/geo_points_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/geo_point_simple.cpp rename to docs/snippets/all/archetypes/geo_points_simple.cpp diff --git a/docs/snippets/all/archetypes/geo_point_simple.py b/docs/snippets/all/archetypes/geo_points_simple.py similarity index 100% rename from docs/snippets/all/archetypes/geo_point_simple.py rename to docs/snippets/all/archetypes/geo_points_simple.py diff --git a/docs/snippets/all/archetypes/geo_point_simple.rs b/docs/snippets/all/archetypes/geo_points_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/geo_point_simple.rs rename to docs/snippets/all/archetypes/geo_points_simple.rs diff --git a/docs/snippets/all/archetypes/line_strip2d_batch.cpp b/docs/snippets/all/archetypes/line_strips2d_batch.cpp similarity index 100% rename from docs/snippets/all/archetypes/line_strip2d_batch.cpp rename to docs/snippets/all/archetypes/line_strips2d_batch.cpp diff --git a/docs/snippets/all/archetypes/line_strip2d_batch.py b/docs/snippets/all/archetypes/line_strips2d_batch.py similarity index 100% rename from docs/snippets/all/archetypes/line_strip2d_batch.py rename to docs/snippets/all/archetypes/line_strips2d_batch.py diff --git a/docs/snippets/all/archetypes/line_strip2d_batch.rs b/docs/snippets/all/archetypes/line_strips2d_batch.rs similarity index 100% rename from docs/snippets/all/archetypes/line_strip2d_batch.rs rename to docs/snippets/all/archetypes/line_strips2d_batch.rs diff --git a/docs/snippets/all/archetypes/line_segments2d_simple.cpp b/docs/snippets/all/archetypes/line_strips2d_segments_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/line_segments2d_simple.cpp rename to docs/snippets/all/archetypes/line_strips2d_segments_simple.cpp diff --git a/docs/snippets/all/archetypes/line_segments2d_simple.py b/docs/snippets/all/archetypes/line_strips2d_segments_simple.py similarity index 100% rename from docs/snippets/all/archetypes/line_segments2d_simple.py rename to docs/snippets/all/archetypes/line_strips2d_segments_simple.py diff --git a/docs/snippets/all/archetypes/line_segments2d_simple.rs b/docs/snippets/all/archetypes/line_strips2d_segments_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/line_segments2d_simple.rs rename to docs/snippets/all/archetypes/line_strips2d_segments_simple.rs diff --git a/docs/snippets/all/archetypes/line_strip2d_simple.cpp b/docs/snippets/all/archetypes/line_strips2d_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/line_strip2d_simple.cpp rename to docs/snippets/all/archetypes/line_strips2d_simple.cpp diff --git a/docs/snippets/all/archetypes/line_strip2d_simple.py b/docs/snippets/all/archetypes/line_strips2d_simple.py similarity index 100% rename from docs/snippets/all/archetypes/line_strip2d_simple.py rename to docs/snippets/all/archetypes/line_strips2d_simple.py diff --git a/docs/snippets/all/archetypes/line_strip2d_simple.rs b/docs/snippets/all/archetypes/line_strips2d_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/line_strip2d_simple.rs rename to docs/snippets/all/archetypes/line_strips2d_simple.rs diff --git a/docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp b/docs/snippets/all/archetypes/line_strips2d_ui_radius.cpp similarity index 100% rename from docs/snippets/all/archetypes/line_strip2d_ui_radius.cpp rename to docs/snippets/all/archetypes/line_strips2d_ui_radius.cpp diff --git a/docs/snippets/all/archetypes/line_strip2d_ui_radius.py b/docs/snippets/all/archetypes/line_strips2d_ui_radius.py similarity index 100% rename from docs/snippets/all/archetypes/line_strip2d_ui_radius.py rename to docs/snippets/all/archetypes/line_strips2d_ui_radius.py diff --git a/docs/snippets/all/archetypes/line_strip2d_ui_radius.rs b/docs/snippets/all/archetypes/line_strips2d_ui_radius.rs similarity index 100% rename from docs/snippets/all/archetypes/line_strip2d_ui_radius.rs rename to docs/snippets/all/archetypes/line_strips2d_ui_radius.rs diff --git a/docs/snippets/all/archetypes/line_strip3d_batch.cpp b/docs/snippets/all/archetypes/line_strips3d_batch.cpp similarity index 100% rename from docs/snippets/all/archetypes/line_strip3d_batch.cpp rename to docs/snippets/all/archetypes/line_strips3d_batch.cpp diff --git a/docs/snippets/all/archetypes/line_strip3d_batch.py b/docs/snippets/all/archetypes/line_strips3d_batch.py similarity index 100% rename from docs/snippets/all/archetypes/line_strip3d_batch.py rename to docs/snippets/all/archetypes/line_strips3d_batch.py diff --git a/docs/snippets/all/archetypes/line_strip3d_batch.rs b/docs/snippets/all/archetypes/line_strips3d_batch.rs similarity index 100% rename from docs/snippets/all/archetypes/line_strip3d_batch.rs rename to docs/snippets/all/archetypes/line_strips3d_batch.rs diff --git a/docs/snippets/all/archetypes/line_segments3d_simple.cpp b/docs/snippets/all/archetypes/line_strips3d_segments_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/line_segments3d_simple.cpp rename to docs/snippets/all/archetypes/line_strips3d_segments_simple.cpp diff --git a/docs/snippets/all/archetypes/line_segments3d_simple.py b/docs/snippets/all/archetypes/line_strips3d_segments_simple.py similarity index 100% rename from docs/snippets/all/archetypes/line_segments3d_simple.py rename to docs/snippets/all/archetypes/line_strips3d_segments_simple.py diff --git a/docs/snippets/all/archetypes/line_segments3d_simple.rs b/docs/snippets/all/archetypes/line_strips3d_segments_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/line_segments3d_simple.rs rename to docs/snippets/all/archetypes/line_strips3d_segments_simple.rs diff --git a/docs/snippets/all/archetypes/line_strip3d_simple.cpp b/docs/snippets/all/archetypes/line_strips3d_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/line_strip3d_simple.cpp rename to docs/snippets/all/archetypes/line_strips3d_simple.cpp diff --git a/docs/snippets/all/archetypes/line_strip3d_simple.py b/docs/snippets/all/archetypes/line_strips3d_simple.py similarity index 100% rename from docs/snippets/all/archetypes/line_strip3d_simple.py rename to docs/snippets/all/archetypes/line_strips3d_simple.py diff --git a/docs/snippets/all/archetypes/line_strip3d_simple.rs b/docs/snippets/all/archetypes/line_strips3d_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/line_strip3d_simple.rs rename to docs/snippets/all/archetypes/line_strips3d_simple.rs diff --git a/docs/snippets/all/archetypes/line_strip3d_ui_radius.cpp b/docs/snippets/all/archetypes/line_strips3d_ui_radius.cpp similarity index 100% rename from docs/snippets/all/archetypes/line_strip3d_ui_radius.cpp rename to docs/snippets/all/archetypes/line_strips3d_ui_radius.cpp diff --git a/docs/snippets/all/archetypes/line_strip3d_ui_radius.py b/docs/snippets/all/archetypes/line_strips3d_ui_radius.py similarity index 100% rename from docs/snippets/all/archetypes/line_strip3d_ui_radius.py rename to docs/snippets/all/archetypes/line_strips3d_ui_radius.py diff --git a/docs/snippets/all/archetypes/line_strip3d_ui_radius.rs b/docs/snippets/all/archetypes/line_strips3d_ui_radius.rs similarity index 100% rename from docs/snippets/all/archetypes/line_strip3d_ui_radius.rs rename to docs/snippets/all/archetypes/line_strips3d_ui_radius.rs diff --git a/docs/snippets/all/archetypes/point2d_random.cpp b/docs/snippets/all/archetypes/points2d_random.cpp similarity index 100% rename from docs/snippets/all/archetypes/point2d_random.cpp rename to docs/snippets/all/archetypes/points2d_random.cpp diff --git a/docs/snippets/all/archetypes/point2d_random.py b/docs/snippets/all/archetypes/points2d_random.py similarity index 100% rename from docs/snippets/all/archetypes/point2d_random.py rename to docs/snippets/all/archetypes/points2d_random.py diff --git a/docs/snippets/all/archetypes/point2d_random.rs b/docs/snippets/all/archetypes/points2d_random.rs similarity index 100% rename from docs/snippets/all/archetypes/point2d_random.rs rename to docs/snippets/all/archetypes/points2d_random.rs diff --git a/docs/snippets/all/archetypes/point2d_simple.cpp b/docs/snippets/all/archetypes/points2d_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/point2d_simple.cpp rename to docs/snippets/all/archetypes/points2d_simple.cpp diff --git a/docs/snippets/all/archetypes/point2d_simple.py b/docs/snippets/all/archetypes/points2d_simple.py similarity index 100% rename from docs/snippets/all/archetypes/point2d_simple.py rename to docs/snippets/all/archetypes/points2d_simple.py diff --git a/docs/snippets/all/archetypes/point2d_simple.rs b/docs/snippets/all/archetypes/points2d_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/point2d_simple.rs rename to docs/snippets/all/archetypes/points2d_simple.rs diff --git a/docs/snippets/all/archetypes/point2d_ui_radius.cpp b/docs/snippets/all/archetypes/points2d_ui_radius.cpp similarity index 100% rename from docs/snippets/all/archetypes/point2d_ui_radius.cpp rename to docs/snippets/all/archetypes/points2d_ui_radius.cpp diff --git a/docs/snippets/all/archetypes/point2d_ui_radius.py b/docs/snippets/all/archetypes/points2d_ui_radius.py similarity index 100% rename from docs/snippets/all/archetypes/point2d_ui_radius.py rename to docs/snippets/all/archetypes/points2d_ui_radius.py diff --git a/docs/snippets/all/archetypes/point2d_ui_radius.rs b/docs/snippets/all/archetypes/points2d_ui_radius.rs similarity index 100% rename from docs/snippets/all/archetypes/point2d_ui_radius.rs rename to docs/snippets/all/archetypes/points2d_ui_radius.rs diff --git a/docs/snippets/all/archetypes/point3d_random.cpp b/docs/snippets/all/archetypes/points3d_random.cpp similarity index 100% rename from docs/snippets/all/archetypes/point3d_random.cpp rename to docs/snippets/all/archetypes/points3d_random.cpp diff --git a/docs/snippets/all/archetypes/point3d_random.py b/docs/snippets/all/archetypes/points3d_random.py similarity index 100% rename from docs/snippets/all/archetypes/point3d_random.py rename to docs/snippets/all/archetypes/points3d_random.py diff --git a/docs/snippets/all/archetypes/point3d_random.rs b/docs/snippets/all/archetypes/points3d_random.rs similarity index 100% rename from docs/snippets/all/archetypes/point3d_random.rs rename to docs/snippets/all/archetypes/points3d_random.rs diff --git a/docs/snippets/all/archetypes/point3d_simple.cpp b/docs/snippets/all/archetypes/points3d_simple.cpp similarity index 100% rename from docs/snippets/all/archetypes/point3d_simple.cpp rename to docs/snippets/all/archetypes/points3d_simple.cpp diff --git a/docs/snippets/all/archetypes/point3d_simple.py b/docs/snippets/all/archetypes/points3d_simple.py similarity index 100% rename from docs/snippets/all/archetypes/point3d_simple.py rename to docs/snippets/all/archetypes/points3d_simple.py diff --git a/docs/snippets/all/archetypes/point3d_simple.rs b/docs/snippets/all/archetypes/points3d_simple.rs similarity index 100% rename from docs/snippets/all/archetypes/point3d_simple.rs rename to docs/snippets/all/archetypes/points3d_simple.rs diff --git a/docs/snippets/all/archetypes/point3d_ui_radius.cpp b/docs/snippets/all/archetypes/points3d_ui_radius.cpp similarity index 100% rename from docs/snippets/all/archetypes/point3d_ui_radius.cpp rename to docs/snippets/all/archetypes/points3d_ui_radius.cpp diff --git a/docs/snippets/all/archetypes/point3d_ui_radius.py b/docs/snippets/all/archetypes/points3d_ui_radius.py similarity index 100% rename from docs/snippets/all/archetypes/point3d_ui_radius.py rename to docs/snippets/all/archetypes/points3d_ui_radius.py diff --git a/docs/snippets/all/archetypes/point3d_ui_radius.rs b/docs/snippets/all/archetypes/points3d_ui_radius.rs similarity index 100% rename from docs/snippets/all/archetypes/point3d_ui_radius.rs rename to docs/snippets/all/archetypes/points3d_ui_radius.rs diff --git a/docs/snippets/snippets.toml b/docs/snippets/snippets.toml index 8b5dd657fec2..d911b5f21f6c 100644 --- a/docs/snippets/snippets.toml +++ b/docs/snippets/snippets.toml @@ -197,7 +197,7 @@ quick_start = [ # These examples don't have exactly the same implementation. "py", "rust", ] -"archetypes/arrow3d_simple" = [ # TODO(#3206): examples use different RNGs +"archetypes/arrows3d_simple" = [ # TODO(#3206): examples use different RNGs "cpp", "py", "rust", @@ -210,12 +210,12 @@ quick_start = [ # These examples don't have exactly the same implementation. "archetypes/bar_chart" = [ # On Windows this logs f64 instead of u64 unless a numpy array with explicit type is used. "py", ] -"archetypes/capsule3d_batch" = [ # TODO(#3235): Degree to radian conversion is slightly different. +"archetypes/capsules3d_batch" = [ # TODO(#3235): Degree to radian conversion is slightly different. "cpp", "py", "rust", ] -"archetypes/ellipsoid3d_simple" = [ # TODO(#3206): examples use different RNGs +"archetypes/ellipsoids3d_simple" = [ # TODO(#3206): examples use different RNGs "cpp", "py", "rust", @@ -230,12 +230,12 @@ quick_start = [ # These examples don't have exactly the same implementation. "py", "rust", ] -"archetypes/point2d_random" = [ # TODO(#3206): examples use different RNGs +"archetypes/points2d_random" = [ # TODO(#3206): examples use different RNGs "cpp", "py", "rust", ] -"archetypes/point3d_random" = [ # TODO(#3206): examples use different RNGs +"archetypes/points3d_random" = [ # TODO(#3206): examples use different RNGs "cpp", "py", "rust", diff --git a/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp b/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp index 33e210363f0d..1af265add4c7 100644 --- a/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp +++ b/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp @@ -26,7 +26,7 @@ namespace rerun::archetypes { /// /// ## Examples /// - /// ### line_strip2d_batch: + /// ### line_strips2d_batch: /// ![image](https://static.rerun.io/line_strip2d_batch/c6f4062bcf510462d298a5dfe9fdbe87c754acee/full.png) /// /// ```cpp @@ -58,16 +58,14 @@ namespace rerun::archetypes { /// #include /// /// int main() { - /// const auto rec = rerun::RecordingStream("rerun_example_line_strip3d_ui_radius"); + /// const auto rec = rerun::RecordingStream("rerun_example_line_strip2d_ui_radius"); /// rec.spawn().exit_on_failure(); /// /// // A blue line with a scene unit radii of 0.01. - /// rerun::LineStrip3D linestrip_blue( - /// {{0.f, 0.f, 0.f}, {0.f, 0.f, 1.f}, {1.f, 0.f, 0.f}, {1.f, 0.f, 1.f}} - /// ); + /// rerun::LineStrip2D linestrip_blue({{0.f, 0.f}, {0.f, 1.f}, {1.f, 0.f}, {1.f, 1.f}}); /// rec.log( /// "scene_unit_line", - /// rerun::LineStrips3D(linestrip_blue) + /// rerun::LineStrips2D(linestrip_blue) /// // By default, radii are interpreted as world-space units. /// .with_radii(0.01f) /// .with_colors(rerun::Color(0, 0, 255)) @@ -76,16 +74,16 @@ namespace rerun::archetypes { /// // A red line with a ui point radii of 5. /// // UI points are independent of zooming in Views, but are sensitive to the application UI scaling. /// // For 100 % ui scaling, UI points are equal to pixels. - /// rerun::LineStrip3D linestrip_red( - /// {{3.f, 0.f, 0.f}, {3.f, 0.f, 1.f}, {4.f, 0.f, 0.f}, {4.f, 0.f, 1.f}} - /// ); + /// rerun::LineStrip2D linestrip_red({{3.f, 0.f}, {3.f, 1.f}, {4.f, 0.f}, {4.f, 1.f}}); /// rec.log( /// "ui_points_line", - /// rerun::LineStrips3D(linestrip_red) + /// rerun::LineStrips2D(linestrip_red) /// // By default, radii are interpreted as world-space units. /// .with_radii(rerun::Radius::ui_points(5.0f)) /// .with_colors(rerun::Color(255, 0, 0)) /// ); + /// + /// // TODO(#5520): log VisualBounds2D /// } /// ``` struct LineStrips2D { diff --git a/rerun_py/rerun_sdk/rerun/archetypes/line_strips2d.py b/rerun_py/rerun_sdk/rerun/archetypes/line_strips2d.py index 97cce10cdace..89891b327415 100644 --- a/rerun_py/rerun_sdk/rerun/archetypes/line_strips2d.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/line_strips2d.py @@ -25,7 +25,7 @@ class LineStrips2D(Archetype): Examples -------- - ### `line_strip2d_batch`: + ### `line_strips2d_batch`: ```python import rerun as rr import rerun.blueprint as rrb @@ -61,14 +61,15 @@ class LineStrips2D(Archetype): ### Lines with scene & UI radius each: ```python import rerun as rr + import rerun.blueprint as rrb - rr.init("rerun_example_line_strip3d_ui_radius", spawn=True) + rr.init("rerun_example_line_strip2d_ui_radius", spawn=True) # A blue line with a scene unit radii of 0.01. - points = [[0, 0, 0], [0, 0, 1], [1, 0, 0], [1, 0, 1]] + points = [[0, 0], [0, 1], [1, 0], [1, 1]] rr.log( "scene_unit_line", - rr.LineStrips3D( + rr.LineStrips2D( [points], # By default, radii are interpreted as world-space units. radii=0.01, @@ -79,16 +80,19 @@ class LineStrips2D(Archetype): # A red line with a ui point radii of 5. # UI points are independent of zooming in Views, but are sensitive to the application UI scaling. # For 100% ui scaling, UI points are equal to pixels. - points = [[3, 0, 0], [3, 0, 1], [4, 0, 0], [4, 0, 1]] + points = [[3, 0], [3, 1], [4, 0], [4, 1]] rr.log( "ui_points_line", - rr.LineStrips3D( + rr.LineStrips2D( [points], # rr.Radius.ui_points produces radii that the viewer interprets as given in ui points. radii=rr.Radius.ui_points(5.0), colors=[255, 0, 0], ), ) + + # Set view bounds: + rr.send_blueprint(rrb.Spatial2DView(visual_bounds=rrb.VisualBounds2D(x_range=[-1, 5], y_range=[-1, 2]))) ``` """ From 3aaeb467a4e7e07ef71952ecc820f6137eeab091 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Tue, 10 Dec 2024 20:29:12 +0100 Subject: [PATCH 21/71] Rename space view to view everywhere (#8396) So far we sometimes called it space view and sometimes just view. This PR cleans up the repository & docs to just call it view. This comes with a few smaller breaking changes, see migration guide. Luckily this very rarely affects user facing types as illustrated by how the lack of changes in our samples & snippets * [x] pass full check --- ARCHITECTURE.md | 48 +- Cargo.lock | 516 +++++------ Cargo.toml | 20 +- DESIGN.md | 2 +- .../src/codegen/python/mod.rs | 2 +- .../src/codegen/python/views.rs | 14 +- .../re_types_builder/src/codegen/rust/api.rs | 2 +- crates/build/re_types_builder/src/docs.rs | 4 +- crates/store/re_log_types/src/lib.rs | 4 +- crates/store/re_types/.gitattributes | 2 +- .../rerun/archetypes/disconnected_space.fbs | 2 +- .../re_types/definitions/rerun/attributes.fbs | 4 +- .../rerun/blueprint/archetypes.fbs | 4 +- .../archetypes/container_blueprint.fbs | 2 +- ..._view_blueprint.fbs => view_blueprint.fbs} | 16 +- ...ce_view_contents.fbs => view_contents.fbs} | 8 +- .../archetypes/viewport_blueprint.fbs | 26 +- .../rerun/blueprint/components.fbs | 8 +- .../{auto_space_views.fbs => auto_views.fbs} | 8 +- .../blueprint/components/query_expression.fbs | 2 +- .../{space_view_class.fbs => view_class.fbs} | 4 +- ..._view_maximized.fbs => view_maximized.fbs} | 8 +- ...{space_view_origin.fbs => view_origin.fbs} | 6 +- .../rerun/components/disconnected_space.fbs | 2 +- .../src/archetypes/disconnected_space.rs | 2 +- .../re_types/src/archetypes/transform3d.rs | 2 +- .../src/blueprint/archetypes/.gitattributes | 4 +- .../re_types/src/blueprint/archetypes/mod.rs | 8 +- ...ce_view_blueprint.rs => view_blueprint.rs} | 129 ++- ...pace_view_contents.rs => view_contents.rs} | 56 +- .../src/blueprint/components/.gitattributes | 4 +- .../re_types/src/blueprint/components/mod.rs | 12 +- .../blueprint/components/query_expression.rs | 2 +- .../{space_view_class.rs => view_class.rs} | 22 +- ...ce_view_class_ext.rs => view_class_ext.rs} | 4 +- .../{space_view_origin.rs => view_origin.rs} | 24 +- ..._view_origin_ext.rs => view_origin_ext.rs} | 4 +- .../src/blueprint/views/bar_chart_view.rs | 2 +- .../src/blueprint/views/dataframe_view.rs | 2 +- .../src/blueprint/views/graph_view.rs | 2 +- .../re_types/src/blueprint/views/map_view.rs | 2 +- .../src/blueprint/views/spatial2d_view.rs | 2 +- .../src/blueprint/views/spatial3d_view.rs | 2 +- .../src/blueprint/views/tensor_view.rs | 2 +- .../src/blueprint/views/text_document_view.rs | 2 +- .../src/blueprint/views/text_log_view.rs | 2 +- .../src/blueprint/views/time_series_view.rs | 2 +- .../src/components/disconnected_space.rs | 2 +- crates/store/re_types/src/lib.rs | 2 +- .../archetypes/container_blueprint.rs | 4 +- .../archetypes/viewport_blueprint.rs | 107 ++- .../src/blueprint/components/.gitattributes | 4 +- .../{auto_space_views.rs => auto_views.rs} | 24 +- .../src/blueprint/components/mod.rs | 8 +- ...ce_view_maximized.rs => view_maximized.rs} | 24 +- crates/store/re_types_core/src/lib.rs | 2 +- crates/store/re_types_core/src/view.rs | 10 +- crates/top/re_sdk/src/log_sink.rs | 2 +- crates/top/re_sdk/src/recording_stream.rs | 2 +- .../re_blueprint_tree/src/blueprint_tree.rs | 183 ++-- .../src/datatype_uis/view_id.rs | 4 +- .../viewer/re_component_ui/src/entity_path.rs | 2 +- crates/viewer/re_component_ui/src/lib.rs | 4 +- .../viewer/re_component_ui/src/zoom_level.rs | 2 +- ...ce_view.rs => add_entities_to_new_view.rs} | 82 +- .../{add_space_view.rs => add_view.rs} | 25 +- .../src/actions/clone_space_view.rs | 29 - .../re_context_menu/src/actions/clone_view.rs | 29 + .../src/actions/collapse_expand_all.rs | 18 +- .../viewer/re_context_menu/src/actions/mod.rs | 6 +- .../actions/move_contents_to_new_container.rs | 4 +- .../re_context_menu/src/actions/remove.rs | 16 +- .../src/actions/screenshot_action.rs | 30 +- .../re_context_menu/src/actions/show_hide.rs | 44 +- crates/viewer/re_context_menu/src/lib.rs | 42 +- crates/viewer/re_data_ui/src/item_ui.rs | 54 +- .../src/error_handling/error_tracker.rs | 2 +- crates/viewer/re_selection_panel/Cargo.toml | 2 +- .../re_selection_panel/src/defaults_ui.rs | 8 +- .../src/item_heading_no_breadcrumbs.rs | 4 +- .../src/item_heading_with_breadcrumbs.rs | 14 +- .../re_selection_panel/src/item_title.rs | 23 +- crates/viewer/re_selection_panel/src/lib.rs | 8 +- .../re_selection_panel/src/selection_panel.rs | 71 +- ...entity_picker.rs => view_entity_picker.rs} | 110 ++- ...e_origin_ui.rs => view_space_origin_ui.rs} | 56 +- .../src/visible_time_range_ui.rs | 40 +- .../re_selection_panel/src/visualizer_ui.rs | 26 +- crates/viewer/re_space_view/README.md | 10 - .../viewer/re_space_view_bar_chart/README.md | 11 - .../viewer/re_space_view_bar_chart/src/lib.rs | 8 - .../viewer/re_space_view_dataframe/README.md | 10 - .../viewer/re_space_view_dataframe/src/lib.rs | 12 - crates/viewer/re_space_view_graph/README.md | 11 - crates/viewer/re_space_view_graph/src/lib.rs | 12 - crates/viewer/re_space_view_map/README.md | 10 - crates/viewer/re_space_view_map/src/lib.rs | 9 - crates/viewer/re_space_view_spatial/README.md | 10 - crates/viewer/re_space_view_tensor/README.md | 11 - crates/viewer/re_space_view_tensor/src/lib.rs | 14 - .../re_space_view_text_document/README.md | 10 - .../re_space_view_text_document/src/lib.rs | 8 - .../viewer/re_space_view_text_log/README.md | 11 - .../viewer/re_space_view_text_log/src/lib.rs | 8 - .../re_space_view_time_series/README.md | 11 - crates/viewer/re_time_panel/src/lib.rs | 2 +- .../icons/{spaceview_2d.png => view_2d.png} | Bin .../icons/{spaceview_3d.png => view_3d.png} | Bin ...eview_dataframe.png => view_dataframe.png} | Bin ...spaceview_generic.png => view_generic.png} | Bin .../{spaceview_graph.png => view_graph.png} | Bin ...eview_histogram.png => view_histogram.png} | Bin .../icons/{spaceview_log.png => view_log.png} | Bin .../icons/{spaceview_map.png => view_map.png} | Bin .../{spaceview_tensor.png => view_tensor.png} | Bin .../{spaceview_text.png => view_text.png} | Bin ...iew_timeseries.png => view_timeseries.png} | Bin ...spaceview_unknown.png => view_unknown.png} | Bin .../examples/re_ui_example/right_panel.rs | 10 +- crates/viewer/re_ui/src/icons.rs | 24 +- crates/viewer/re_ui/src/lib.rs | 2 +- .../re_ui/src/list_item/label_content.rs | 2 +- crates/viewer/re_ui/tests/list_item_tests.rs | 10 +- .../{re_space_view => re_view}/Cargo.toml | 4 +- crates/viewer/re_view/README.md | 10 + .../src/annotation_context_utils.rs | 0 .../src/annotation_scene_context.rs | 0 .../src/controls.rs | 0 .../src/empty_view_state.rs} | 8 +- .../src/heuristics.rs | 24 +- .../src/instance_hash_conversions.rs | 0 .../{re_space_view => re_view}/src/lib.rs | 6 +- .../src/outlines.rs | 0 .../{re_space_view => re_view}/src/query.rs | 0 .../src/results_ext.rs | 2 +- .../src/view_property_ui.rs | 9 +- .../Cargo.toml | 6 +- crates/viewer/re_view_bar_chart/README.md | 11 + crates/viewer/re_view_bar_chart/src/lib.rs | 8 + .../src/view_class.rs} | 67 +- .../src/visualizer_system.rs | 8 +- .../Cargo.toml | 4 +- crates/viewer/re_view_dataframe/README.md | 10 + .../src/dataframe_ui.rs | 8 +- .../src/display_record_batch.rs | 0 .../src/expanded_rows.rs | 2 +- crates/viewer/re_view_dataframe/src/lib.rs | 12 + .../src/view_class.rs} | 61 +- .../src/view_query/blueprint.rs | 22 +- .../src/view_query/mod.rs | 12 +- .../src/view_query/ui.rs | 46 +- .../src/visualizer_system.rs | 8 +- .../Cargo.toml | 6 +- crates/viewer/re_view_graph/README.md | 11 + .../src/graph/hash.rs | 0 .../src/graph/ids.rs | 0 .../src/graph/mod.rs | 0 .../src/layout/geometry.rs | 0 .../src/layout/mod.rs | 0 .../src/layout/params.rs | 10 +- .../src/layout/provider.rs | 0 .../src/layout/request.rs | 0 .../src/layout/result.rs | 0 .../src/layout/slots.rs | 0 crates/viewer/re_view_graph/src/lib.rs | 12 + .../src/properties.rs | 20 +- .../src/ui/draw.rs | 10 +- .../src/ui/mod.rs | 2 +- .../src/ui/selection.rs | 8 +- .../src/ui/state.rs | 10 +- .../src/view.rs | 83 +- .../src/visualizers/edges.rs | 8 +- .../src/visualizers/mod.rs | 0 .../src/visualizers/nodes.rs | 10 +- .../Cargo.toml | 6 +- crates/viewer/re_view_map/README.md | 10 + crates/viewer/re_view_map/src/lib.rs | 9 + .../src/map_overlays.rs | 0 .../src/map_view.rs} | 102 ++- .../src/visualizers/geo_line_strings.rs | 14 +- .../src/visualizers/geo_points.rs | 18 +- .../src/visualizers/mod.rs | 0 .../Cargo.toml | 6 +- crates/viewer/re_view_spatial/README.md | 10 + .../src/contexts/depth_offsets.rs | 2 +- .../src/contexts/mod.rs | 14 +- .../src/contexts/transform_context.rs | 12 +- .../src/eye.rs | 2 +- .../src/heuristics.rs | 12 +- .../src/lib.rs | 14 +- .../src/max_image_dimension_subscriber.rs | 0 .../src/mesh_cache.rs | 0 .../src/mesh_loader.rs | 0 .../src/pickable_textured_rect.rs | 10 +- .../src/picking.rs | 2 +- .../src/picking_ui.rs | 36 +- .../src/picking_ui_pixel.rs | 10 +- .../src/proc_mesh.rs | 0 .../src/scene_bounding_boxes.rs | 8 +- .../src/space_camera_3d.rs | 0 .../src/spatial_topology.rs | 2 +- .../src/transform_component_tracker.rs | 0 .../src/ui.rs | 28 +- .../src/ui_2d.rs | 30 +- .../src/ui_3d.rs | 51 +- .../src/view_2d.rs | 126 ++- .../src/view_2d_properties.rs | 14 +- .../src/view_3d.rs | 86 +- .../src/view_3d_properties.rs | 16 +- .../src/visualizers/arrows2d.rs | 20 +- .../src/visualizers/arrows3d.rs | 20 +- .../src/visualizers/assets3d.rs | 21 +- .../src/visualizers/boxes2d.rs | 20 +- .../src/visualizers/boxes3d.rs | 18 +- .../src/visualizers/cameras.rs | 23 +- .../src/visualizers/capsules3d.rs | 20 +- .../src/visualizers/depth_images.rs | 21 +- .../src/visualizers/ellipsoids.rs | 18 +- .../src/visualizers/encoded_image.rs | 16 +- .../src/visualizers/images.rs | 18 +- .../src/visualizers/lines2d.rs | 20 +- .../src/visualizers/lines3d.rs | 20 +- .../src/visualizers/meshes.rs | 21 +- .../src/visualizers/mod.rs | 18 +- .../src/visualizers/points2d.rs | 24 +- .../src/visualizers/points3d.rs | 24 +- .../src/visualizers/segmentation_images.rs | 24 +- .../src/visualizers/transform3d_arrows.rs | 27 +- .../visualizers/utilities/entity_iterator.rs | 12 +- .../src/visualizers/utilities/labels.rs | 0 .../src/visualizers/utilities/mod.rs | 0 .../visualizers/utilities/proc_mesh_vis.rs | 16 +- .../utilities/spatial_view_visualizer.rs | 6 +- .../visualizers/utilities/textured_rect.rs | 8 +- .../src/visualizers/videos.rs | 34 +- .../Cargo.toml | 6 +- crates/viewer/re_view_tensor/README.md | 11 + .../src/dimension_mapping.rs | 0 crates/viewer/re_view_tensor/src/lib.rs | 14 + .../src/tensor_dimension_mapper.rs | 0 .../src/tensor_slice_to_gpu.rs | 2 +- .../src/tensor_tests.rs | 0 .../src/view_class.rs} | 79 +- .../src/visualizer_system.rs | 16 +- .../Cargo.toml | 6 +- crates/viewer/re_view_text_document/README.md | 10 + .../viewer/re_view_text_document/src/lib.rs | 8 + .../src/view_class.rs} | 58 +- .../src/visualizer_system.rs | 8 +- .../Cargo.toml | 6 +- crates/viewer/re_view_text_log/README.md | 11 + crates/viewer/re_view_text_log/src/lib.rs | 8 + .../src/view_class.rs} | 65 +- .../src/visualizer_system.rs | 8 +- .../Cargo.toml | 6 +- crates/viewer/re_view_time_series/README.md | 11 + .../src/aggregation.rs | 0 .../src/lib.rs | 16 +- .../src/line_visualizer_system.rs | 24 +- .../src/point_visualizer_system.rs | 24 +- .../src/util.rs | 4 +- .../src/view_class.rs} | 97 +-- crates/viewer/re_viewer/Cargo.toml | 20 +- crates/viewer/re_viewer/README.md | 4 +- crates/viewer/re_viewer/src/app.rs | 56 +- crates/viewer/re_viewer/src/app_state.rs | 69 +- .../src/blueprint/validation_gen/mod.rs | 16 +- crates/viewer/re_viewer/src/reflection/mod.rs | 156 ++-- crates/viewer/re_viewer_context/README.md | 4 +- .../re_viewer_context/src/blueprint_id.rs | 8 +- .../re_viewer_context/src/collapsed_id.rs | 16 +- .../src/component_fallbacks.rs | 2 +- .../viewer/re_viewer_context/src/contents.rs | 28 +- crates/viewer/re_viewer_context/src/item.rs | 34 +- crates/viewer/re_viewer_context/src/lib.rs | 45 +- .../re_viewer_context/src/query_context.rs | 6 +- .../re_viewer_context/src/selection_state.rs | 14 +- .../space_view_class_placeholder.rs | 78 -- .../src/space_view/view_states.rs | 38 - .../re_viewer_context/src/test_context.rs | 8 +- .../src/typed_entity_collections.rs | 8 +- .../src/{space_view => view}/highlights.rs | 34 +- .../src/{space_view => view}/mod.rs | 39 +- .../src/{space_view => view}/named_system.rs | 4 +- .../{space_view => view}/spawn_heuristics.rs | 48 +- .../system_execution_output.rs | 4 +- .../view_class.rs} | 119 ++- .../src/view/view_class_placeholder.rs | 77 ++ .../view_class_registry.rs} | 166 ++-- .../src/{space_view => view}/view_context.rs | 10 +- .../view_context_system.rs | 16 +- .../src/{space_view => view}/view_query.rs | 12 +- .../re_viewer_context/src/view/view_states.rs | 38 + .../visualizer_entity_subscriber.rs | 2 +- .../{space_view => view}/visualizer_system.rs | 25 +- .../re_viewer_context/src/viewer_context.rs | 10 +- crates/viewer/re_viewport/Cargo.toml | 2 +- crates/viewer/re_viewport/README.md | 4 +- crates/viewer/re_viewport/src/auto_layout.rs | 50 +- crates/viewer/re_viewport/src/lib.rs | 6 +- .../re_viewport/src/system_execution.rs | 40 +- ..._view_highlights.rs => view_highlights.rs} | 29 +- crates/viewer/re_viewport/src/viewport_ui.rs | 214 +++-- crates/viewer/re_viewport_blueprint/README.md | 4 +- .../re_viewport_blueprint/src/container.rs | 8 +- .../viewer/re_viewport_blueprint/src/lib.rs | 18 +- ...odal.rs => add_view_or_container_modal.rs} | 31 +- .../re_viewport_blueprint/src/ui/mod.rs | 21 +- .../src/{space_view.rs => view.rs} | 176 ++-- ...pace_view_contents.rs => view_contents.rs} | 94 +- .../src/view_properties.rs | 24 +- .../src/viewport_blueprint.rs | 304 ++++--- .../src/viewport_command.rs | 18 +- design/blueprint_store.md | 12 +- design/space_views.md | 48 +- design/spatial_transforms.md | 4 +- docs/content/concepts/apps-and-recordings.md | 2 +- docs/content/concepts/blueprint.md | 4 +- docs/content/concepts/entity-component.md | 10 +- .../content/concepts/spaces-and-transforms.md | 6 +- .../configure-the-viewer/interactively.md | 2 +- .../getting-started/navigating-the-viewer.md | 6 +- .../configure-viewer-through-code.md | 38 +- docs/content/howto/visualization/extend-ui.md | 16 +- docs/content/reference/entity-queries.md | 6 +- .../reference/migration/migration-0-21.md | 27 + .../types/archetypes/disconnected_space.md | 2 +- .../types/components/disconnected_space.md | 2 +- docs/content/reference/viewer/blueprint.md | 20 +- docs/content/reference/viewer/overview.md | 2 +- docs/content/reference/viewer/selection.md | 6 +- .../all/archetypes/transform3d_hierarchy.cpp | 2 +- .../all/archetypes/transform3d_hierarchy.rs | 2 +- examples/cpp/stereo_vision_slam/README.md | 2 +- examples/manifest.toml | 2 +- examples/python/blueprint/blueprint.py | 8 +- .../blueprint_stocks/blueprint_stocks.py | 4 +- examples/python/notebook/cube.ipynb | 816 +++++++++--------- examples/python/nuscenes_dataset/README.md | 4 +- .../nuscenes_dataset/__main__.py | 4 +- examples/rust/chess_robby_fischer/README.md | 4 +- .../Cargo.toml | 2 +- .../README.md | 8 +- .../src/color_coordinates_view.rs} | 71 +- .../color_coordinates_visualizer_system.rs | 11 +- .../src/main.rs | 8 +- rerun_cpp/.gitattributes | 4 +- .../rerun/archetypes/disconnected_space.hpp | 2 +- .../src/rerun/archetypes/transform3d.hpp | 2 +- rerun_cpp/src/rerun/blueprint.hpp | 2 +- rerun_cpp/src/rerun/blueprint/archetypes.hpp | 4 +- .../rerun/blueprint/archetypes/.gitattributes | 8 +- .../archetypes/container_blueprint.hpp | 4 +- ..._view_blueprint.cpp => view_blueprint.cpp} | 22 +- ..._view_blueprint.hpp => view_blueprint.hpp} | 52 +- ...ce_view_contents.cpp => view_contents.cpp} | 12 +- ...ce_view_contents.hpp => view_contents.hpp} | 22 +- .../archetypes/viewport_blueprint.cpp | 10 +- .../archetypes/viewport_blueprint.hpp | 52 +- rerun_cpp/src/rerun/blueprint/components.hpp | 8 +- .../rerun/blueprint/components/.gitattributes | 8 +- .../{auto_space_views.hpp => auto_views.hpp} | 38 +- .../blueprint/components/query_expression.hpp | 2 +- .../{space_view_class.hpp => view_class.hpp} | 25 +- ..._view_maximized.hpp => view_maximized.hpp} | 38 +- ...{space_view_origin.hpp => view_origin.hpp} | 27 +- .../rerun/components/disconnected_space.hpp | 2 +- rerun_py/docs/gen_common_index.py | 4 +- rerun_py/rerun_sdk/rerun/.gitattributes | 2 +- .../rerun/archetypes/disconnected_space.py | 2 +- .../rerun_sdk/rerun/blueprint/__init__.py | 2 +- rerun_py/rerun_sdk/rerun/blueprint/api.py | 98 +-- .../rerun/blueprint/archetypes/.gitattributes | 4 +- .../rerun/blueprint/archetypes/__init__.py | 8 +- .../archetypes/container_blueprint.py | 4 +- ...ce_view_blueprint.py => view_blueprint.py} | 44 +- ...pace_view_contents.py => view_contents.py} | 26 +- .../archetypes/viewport_blueprint.py | 52 +- .../rerun/blueprint/components/.gitattributes | 8 +- .../rerun/blueprint/components/__init__.py | 24 +- .../blueprint/components/auto_space_views.py | 33 - .../rerun/blueprint/components/auto_views.py | 33 + .../blueprint/components/query_expression.py | 2 +- .../blueprint/components/space_view_class.py | 33 - .../components/space_view_maximized.py | 33 - .../blueprint/components/space_view_origin.py | 33 - .../rerun/blueprint/components/view_class.py | 33 + .../blueprint/components/view_maximized.py | 33 + .../rerun/blueprint/components/view_origin.py | 33 + .../rerun_sdk/rerun/blueprint/containers.py | 26 +- .../rerun/blueprint/views/bar_chart_view.py | 12 +- .../rerun/blueprint/views/dataframe_view.py | 12 +- .../rerun/blueprint/views/graph_view.py | 12 +- .../rerun/blueprint/views/map_view.py | 12 +- .../rerun/blueprint/views/spatial2d_view.py | 12 +- .../rerun/blueprint/views/spatial3d_view.py | 12 +- .../rerun/blueprint/views/tensor_view.py | 12 +- .../blueprint/views/text_document_view.py | 12 +- .../rerun/blueprint/views/text_log_view.py | 12 +- .../rerun/blueprint/views/time_series_view.py | 12 +- .../rerun/components/disconnected_space.py | 2 +- rerun_py/tests/unit/blueprint_utils.py | 2 +- ...ew_blueprint.py => test_view_blueprint.py} | 20 +- ...view_contents.py => test_view_contents.py} | 6 +- .../tests/unit/test_viewport_blueprint.py | 20 +- scripts/lint.py | 6 +- .../release_checklist/check_1d_tensor_data.py | 2 +- .../check_all_components_ui.py | 4 +- .../release_checklist/check_annotations.py | 2 +- .../check_container_hierarchy.py | 6 +- ...ntext_menu_add_entity_to_new_space_view.py | 14 +- .../check_context_menu_collapse_expand_all.py | 6 +- ...heck_context_menu_invalid_sub_container.py | 8 +- .../check_context_menu_multi_selection.py | 10 +- .../check_context_menu_single_selection.py | 18 +- ...xt_menu_single_selection_blueprint_tree.py | 14 +- .../check_context_menu_suggested_origin.py | 14 +- .../check_deselect_on_escape.py | 2 +- tests/python/release_checklist/check_focus.py | 10 +- .../release_checklist/check_heuristics_2d.py | 4 +- .../check_heuristics_mixed_2d_and_3d.py | 2 +- .../check_heuristics_mixed_all_root.py | 2 +- .../check_mono_entity_views.py | 2 +- .../check_out_of_tree_data_results.py | 2 +- .../release_checklist/check_plot_overrides.py | 6 +- .../check_static_components_ui.py | 4 +- 426 files changed, 4483 insertions(+), 4674 deletions(-) rename crates/store/re_types/definitions/rerun/blueprint/archetypes/{space_view_blueprint.fbs => view_blueprint.fbs} (60%) rename crates/store/re_types/definitions/rerun/blueprint/archetypes/{space_view_contents.fbs => view_contents.fbs} (92%) rename crates/store/re_types/definitions/rerun/blueprint/components/{auto_space_views.fbs => auto_views.fbs} (68%) rename crates/store/re_types/definitions/rerun/blueprint/components/{space_view_class.fbs => view_class.fbs} (91%) rename crates/store/re_types/definitions/rerun/blueprint/components/{space_view_maximized.fbs => view_maximized.fbs} (69%) rename crates/store/re_types/definitions/rerun/blueprint/components/{space_view_origin.fbs => view_origin.fbs} (81%) rename crates/store/re_types/src/blueprint/archetypes/{space_view_blueprint.rs => view_blueprint.rs} (73%) rename crates/store/re_types/src/blueprint/archetypes/{space_view_contents.rs => view_contents.rs} (80%) rename crates/store/re_types/src/blueprint/components/{space_view_class.rs => view_class.rs} (80%) rename crates/store/re_types/src/blueprint/components/{space_view_class_ext.rs => view_class_ext.rs} (55%) rename crates/store/re_types/src/blueprint/components/{space_view_origin.rs => view_origin.rs} (78%) rename crates/store/re_types/src/blueprint/components/{space_view_origin_ext.rs => view_origin_ext.rs} (69%) rename crates/store/re_types_blueprint/src/blueprint/components/{auto_space_views.rs => auto_views.rs} (80%) rename crates/store/re_types_blueprint/src/blueprint/components/{space_view_maximized.rs => view_maximized.rs} (79%) rename crates/viewer/re_context_menu/src/actions/{add_entities_to_new_space_view.rs => add_entities_to_new_view.rs} (58%) rename crates/viewer/re_context_menu/src/actions/{add_space_view.rs => add_view.rs} (53%) delete mode 100644 crates/viewer/re_context_menu/src/actions/clone_space_view.rs create mode 100644 crates/viewer/re_context_menu/src/actions/clone_view.rs rename crates/viewer/re_selection_panel/src/{space_view_entity_picker.rs => view_entity_picker.rs} (75%) rename crates/viewer/re_selection_panel/src/{space_view_space_origin_ui.rs => view_space_origin_ui.rs} (75%) delete mode 100644 crates/viewer/re_space_view/README.md delete mode 100644 crates/viewer/re_space_view_bar_chart/README.md delete mode 100644 crates/viewer/re_space_view_bar_chart/src/lib.rs delete mode 100644 crates/viewer/re_space_view_dataframe/README.md delete mode 100644 crates/viewer/re_space_view_dataframe/src/lib.rs delete mode 100644 crates/viewer/re_space_view_graph/README.md delete mode 100644 crates/viewer/re_space_view_graph/src/lib.rs delete mode 100644 crates/viewer/re_space_view_map/README.md delete mode 100644 crates/viewer/re_space_view_map/src/lib.rs delete mode 100644 crates/viewer/re_space_view_spatial/README.md delete mode 100644 crates/viewer/re_space_view_tensor/README.md delete mode 100644 crates/viewer/re_space_view_tensor/src/lib.rs delete mode 100644 crates/viewer/re_space_view_text_document/README.md delete mode 100644 crates/viewer/re_space_view_text_document/src/lib.rs delete mode 100644 crates/viewer/re_space_view_text_log/README.md delete mode 100644 crates/viewer/re_space_view_text_log/src/lib.rs delete mode 100644 crates/viewer/re_space_view_time_series/README.md rename crates/viewer/re_ui/data/icons/{spaceview_2d.png => view_2d.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_3d.png => view_3d.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_dataframe.png => view_dataframe.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_generic.png => view_generic.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_graph.png => view_graph.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_histogram.png => view_histogram.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_log.png => view_log.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_map.png => view_map.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_tensor.png => view_tensor.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_text.png => view_text.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_timeseries.png => view_timeseries.png} (100%) rename crates/viewer/re_ui/data/icons/{spaceview_unknown.png => view_unknown.png} (100%) rename crates/viewer/{re_space_view => re_view}/Cargo.toml (87%) create mode 100644 crates/viewer/re_view/README.md rename crates/viewer/{re_space_view => re_view}/src/annotation_context_utils.rs (100%) rename crates/viewer/{re_space_view => re_view}/src/annotation_scene_context.rs (100%) rename crates/viewer/{re_space_view => re_view}/src/controls.rs (100%) rename crates/viewer/{re_space_view/src/empty_space_view_state.rs => re_view/src/empty_view_state.rs} (50%) rename crates/viewer/{re_space_view => re_view}/src/heuristics.rs (53%) rename crates/viewer/{re_space_view => re_view}/src/instance_hash_conversions.rs (100%) rename crates/viewer/{re_space_view => re_view}/src/lib.rs (92%) rename crates/viewer/{re_space_view => re_view}/src/outlines.rs (100%) rename crates/viewer/{re_space_view => re_view}/src/query.rs (100%) rename crates/viewer/{re_space_view => re_view}/src/results_ext.rs (99%) rename crates/viewer/{re_space_view => re_view}/src/view_property_ui.rs (97%) rename crates/viewer/{re_space_view_bar_chart => re_view_bar_chart}/Cargo.toml (84%) create mode 100644 crates/viewer/re_view_bar_chart/README.md create mode 100644 crates/viewer/re_view_bar_chart/src/lib.rs rename crates/viewer/{re_space_view_bar_chart/src/space_view_class.rs => re_view_bar_chart/src/view_class.rs} (82%) rename crates/viewer/{re_space_view_bar_chart => re_view_bar_chart}/src/visualizer_system.rs (91%) rename crates/viewer/{re_space_view_dataframe => re_view_dataframe}/Cargo.toml (87%) create mode 100644 crates/viewer/re_view_dataframe/README.md rename crates/viewer/{re_space_view_dataframe => re_view_dataframe}/src/dataframe_ui.rs (99%) rename crates/viewer/{re_space_view_dataframe => re_view_dataframe}/src/display_record_batch.rs (100%) rename crates/viewer/{re_space_view_dataframe => re_view_dataframe}/src/expanded_rows.rs (99%) create mode 100644 crates/viewer/re_view_dataframe/src/lib.rs rename crates/viewer/{re_space_view_dataframe/src/space_view_class.rs => re_view_dataframe/src/view_class.rs} (72%) rename crates/viewer/{re_space_view_dataframe => re_view_dataframe}/src/view_query/blueprint.rs (93%) rename crates/viewer/{re_space_view_dataframe => re_view_dataframe}/src/view_query/mod.rs (77%) rename crates/viewer/{re_space_view_dataframe => re_view_dataframe}/src/view_query/ui.rs (93%) rename crates/viewer/{re_space_view_dataframe => re_view_dataframe}/src/visualizer_system.rs (76%) rename crates/viewer/{re_space_view_graph => re_view_graph}/Cargo.toml (87%) create mode 100644 crates/viewer/re_view_graph/README.md rename crates/viewer/{re_space_view_graph => re_view_graph}/src/graph/hash.rs (100%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/graph/ids.rs (100%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/graph/mod.rs (100%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/layout/geometry.rs (100%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/layout/mod.rs (100%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/layout/params.rs (93%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/layout/provider.rs (100%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/layout/request.rs (100%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/layout/result.rs (100%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/layout/slots.rs (100%) create mode 100644 crates/viewer/re_view_graph/src/lib.rs rename crates/viewer/{re_space_view_graph => re_view_graph}/src/properties.rs (71%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/ui/draw.rs (97%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/ui/mod.rs (78%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/ui/selection.rs (91%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/ui/state.rs (96%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/view.rs (70%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/visualizers/edges.rs (91%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/visualizers/mod.rs (100%) rename crates/viewer/{re_space_view_graph => re_view_graph}/src/visualizers/nodes.rs (93%) rename crates/viewer/{re_space_view_map => re_view_map}/Cargo.toml (88%) create mode 100644 crates/viewer/re_view_map/README.md create mode 100644 crates/viewer/re_view_map/src/lib.rs rename crates/viewer/{re_space_view_map => re_view_map}/src/map_overlays.rs (100%) rename crates/viewer/{re_space_view_map/src/map_space_view.rs => re_view_map/src/map_view.rs} (86%) rename crates/viewer/{re_space_view_map => re_view_map}/src/visualizers/geo_line_strings.rs (94%) rename crates/viewer/{re_space_view_map => re_view_map}/src/visualizers/geo_points.rs (96%) rename crates/viewer/{re_space_view_map => re_view_map}/src/visualizers/mod.rs (100%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/Cargo.toml (92%) create mode 100644 crates/viewer/re_view_spatial/README.md rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/contexts/depth_offsets.rs (98%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/contexts/mod.rs (63%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/contexts/transform_context.rs (98%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/eye.rs (99%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/heuristics.rs (77%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/lib.rs (95%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/max_image_dimension_subscriber.rs (100%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/mesh_cache.rs (100%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/mesh_loader.rs (100%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/pickable_textured_rect.rs (85%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/picking.rs (99%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/picking_ui.rs (90%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/picking_ui_pixel.rs (98%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/proc_mesh.rs (100%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/scene_bounding_boxes.rs (94%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/space_camera_3d.rs (100%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/spatial_topology.rs (99%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/transform_component_tracker.rs (100%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/ui.rs (93%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/ui_2d.rs (95%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/ui_3d.rs (97%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/view_2d.rs (78%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/view_2d_properties.rs (81%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/view_3d.rs (89%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/view_3d_properties.rs (70%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/arrows2d.rs (93%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/arrows3d.rs (93%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/assets3d.rs (90%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/boxes2d.rs (94%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/boxes3d.rs (93%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/cameras.rs (92%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/capsules3d.rs (93%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/depth_images.rs (95%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/ellipsoids.rs (94%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/encoded_image.rs (92%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/images.rs (91%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/lines2d.rs (93%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/lines3d.rs (93%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/meshes.rs (93%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/mod.rs (95%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/points2d.rs (93%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/points3d.rs (93%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/segmentation_images.rs (91%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/transform3d_arrows.rs (92%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/utilities/entity_iterator.rs (95%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/utilities/labels.rs (100%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/utilities/mod.rs (100%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/utilities/proc_mesh_vis.rs (94%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/utilities/spatial_view_visualizer.rs (88%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/utilities/textured_rect.rs (92%) rename crates/viewer/{re_space_view_spatial => re_view_spatial}/src/visualizers/videos.rs (94%) rename crates/viewer/{re_space_view_tensor => re_view_tensor}/Cargo.toml (84%) create mode 100644 crates/viewer/re_view_tensor/README.md rename crates/viewer/{re_space_view_tensor => re_view_tensor}/src/dimension_mapping.rs (100%) create mode 100644 crates/viewer/re_view_tensor/src/lib.rs rename crates/viewer/{re_space_view_tensor => re_view_tensor}/src/tensor_dimension_mapper.rs (100%) rename crates/viewer/{re_space_view_tensor => re_view_tensor}/src/tensor_slice_to_gpu.rs (99%) rename crates/viewer/{re_space_view_tensor => re_view_tensor}/src/tensor_tests.rs (100%) rename crates/viewer/{re_space_view_tensor/src/space_view_class.rs => re_view_tensor/src/view_class.rs} (90%) rename crates/viewer/{re_space_view_tensor => re_view_tensor}/src/visualizer_system.rs (90%) rename crates/viewer/{re_space_view_text_document => re_view_text_document}/Cargo.toml (81%) create mode 100644 crates/viewer/re_view_text_document/README.md create mode 100644 crates/viewer/re_view_text_document/src/lib.rs rename crates/viewer/{re_space_view_text_document/src/space_view_class.rs => re_view_text_document/src/view_class.rs} (74%) rename crates/viewer/{re_space_view_text_document => re_view_text_document}/src/visualizer_system.rs (87%) rename crates/viewer/{re_space_view_text_log => re_view_text_log}/Cargo.toml (81%) create mode 100644 crates/viewer/re_view_text_log/README.md create mode 100644 crates/viewer/re_view_text_log/src/lib.rs rename crates/viewer/{re_space_view_text_log/src/space_view_class.rs => re_view_text_log/src/view_class.rs} (88%) rename crates/viewer/{re_space_view_text_log => re_view_text_log}/src/visualizer_system.rs (93%) rename crates/viewer/{re_space_view_time_series => re_view_time_series}/Cargo.toml (85%) create mode 100644 crates/viewer/re_view_time_series/README.md rename crates/viewer/{re_space_view_time_series => re_view_time_series}/src/aggregation.rs (100%) rename crates/viewer/{re_space_view_time_series => re_view_time_series}/src/lib.rs (85%) rename crates/viewer/{re_space_view_time_series => re_view_time_series}/src/line_visualizer_system.rs (96%) rename crates/viewer/{re_space_view_time_series => re_view_time_series}/src/point_visualizer_system.rs (96%) rename crates/viewer/{re_space_view_time_series => re_view_time_series}/src/util.rs (98%) rename crates/viewer/{re_space_view_time_series/src/space_view_class.rs => re_view_time_series/src/view_class.rs} (89%) delete mode 100644 crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs delete mode 100644 crates/viewer/re_viewer_context/src/space_view/view_states.rs rename crates/viewer/re_viewer_context/src/{space_view => view}/highlights.rs (79%) rename crates/viewer/re_viewer_context/src/{space_view => view}/mod.rs (66%) rename crates/viewer/re_viewer_context/src/{space_view => view}/named_system.rs (87%) rename crates/viewer/re_viewer_context/src/{space_view => view}/spawn_heuristics.rs (53%) rename crates/viewer/re_viewer_context/src/{space_view => view}/system_execution_output.rs (90%) rename crates/viewer/re_viewer_context/src/{space_view/space_view_class.rs => view/view_class.rs} (66%) create mode 100644 crates/viewer/re_viewer_context/src/view/view_class_placeholder.rs rename crates/viewer/re_viewer_context/src/{space_view/space_view_class_registry.rs => view/view_class_registry.rs} (64%) rename crates/viewer/re_viewer_context/src/{space_view => view}/view_context.rs (93%) rename crates/viewer/re_viewer_context/src/{space_view => view}/view_context_system.rs (76%) rename crates/viewer/re_viewer_context/src/{space_view => view}/view_query.rs (97%) create mode 100644 crates/viewer/re_viewer_context/src/view/view_states.rs rename crates/viewer/re_viewer_context/src/{space_view => view}/visualizer_entity_subscriber.rs (98%) rename crates/viewer/re_viewer_context/src/{space_view => view}/visualizer_system.rs (86%) rename crates/viewer/re_viewport/src/{space_view_highlights.rs => view_highlights.rs} (82%) rename crates/viewer/re_viewport_blueprint/src/ui/{add_space_view_or_container_modal.rs => add_view_or_container_modal.rs} (89%) rename crates/viewer/re_viewport_blueprint/src/{space_view.rs => view.rs} (82%) rename crates/viewer/re_viewport_blueprint/src/{space_view_contents.rs => view_contents.rs} (90%) rename examples/rust/{custom_space_view => custom_view}/Cargo.toml (96%) rename examples/rust/{custom_space_view => custom_view}/README.md (84%) rename examples/rust/{custom_space_view/src/color_coordinates_space_view.rs => custom_view/src/color_coordinates_view.rs} (80%) rename examples/rust/{custom_space_view => custom_view}/src/color_coordinates_visualizer_system.rs (86%) rename examples/rust/{custom_space_view => custom_view}/src/main.rs (89%) rename rerun_cpp/src/rerun/blueprint/archetypes/{space_view_blueprint.cpp => view_blueprint.cpp} (76%) rename rerun_cpp/src/rerun/blueprint/archetypes/{space_view_blueprint.hpp => view_blueprint.hpp} (63%) rename rerun_cpp/src/rerun/blueprint/archetypes/{space_view_contents.cpp => view_contents.cpp} (74%) rename rerun_cpp/src/rerun/blueprint/archetypes/{space_view_contents.hpp => view_contents.hpp} (82%) rename rerun_cpp/src/rerun/blueprint/components/{auto_space_views.hpp => auto_views.hpp} (60%) rename rerun_cpp/src/rerun/blueprint/components/{space_view_class.hpp => view_class.hpp} (72%) rename rerun_cpp/src/rerun/blueprint/components/{space_view_maximized.hpp => view_maximized.hpp} (60%) rename rerun_cpp/src/rerun/blueprint/components/{space_view_origin.hpp => view_origin.hpp} (71%) rename rerun_py/rerun_sdk/rerun/blueprint/archetypes/{space_view_blueprint.py => view_blueprint.py} (73%) rename rerun_py/rerun_sdk/rerun/blueprint/archetypes/{space_view_contents.py => view_contents.py} (83%) delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/auto_space_views.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/auto_views.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/space_view_class.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/space_view_maximized.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/space_view_origin.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/view_class.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/view_maximized.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/view_origin.py rename rerun_py/tests/unit/{test_space_view_blueprint.py => test_view_blueprint.py} (73%) rename rerun_py/tests/unit/{test_space_view_contents.py => test_view_contents.py} (87%) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 9c7f401948e2..f1713242422f 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -88,11 +88,11 @@ Of course, this will only take us so far. In the future we plan on caching queri Here is an overview of the crates included in the project: - - - - - + + + + + @@ -125,25 +125,25 @@ Update instructions: ##### UI crates -| Crate | Description | -|-----------------------------|------------------------------------------------------------------------------------------------------------| -| re_blueprint_tree | The UI for the blueprint tree in the left panel. | -| re_chunk_store_ui | A chunk store browser UI. | -| re_component_ui | Provides UI editors for Rerun component data for registration with the Rerun Viewer component UI registry. | -| re_selection_panel | The UI for the selection panel. | -| re_space_view | Types & utilities for defining Space View classes and communicating with the Viewport. | -| re_space_view_bar_chart | A Space View that shows a single bar chart. | -| re_space_view_dataframe | A Space View that shows the data contained in entities in a table. | -| re_space_view_graph | A Space View that shows a graph (node-link diagram). | -| re_space_view_map | A Space View that shows geospatial data on a map. | -| re_space_view_spatial | Space Views that show entities in a 2D or 3D spatial relationship. | -| re_space_view_tensor | A Space View dedicated to visualizing tensors with arbitrary dimensionality. | -| re_space_view_text_document | A simple Space View that shows a single text box. | -| re_space_view_text_log | A Space View that shows text entries in a table and scrolls with the active time. | -| re_space_view_time_series | A Space View that shows plots over Rerun timelines. | -| re_time_panel | The time panel of the Rerun Viewer, allowing to control the displayed timeline & time. | -| re_viewer | The Rerun Viewer | -| re_viewport | The central viewport panel of the Rerun viewer. | +| Crate | Description | +|-----------------------------|------------------------------------------------------------------------------------------------------| +| re_blueprint_tree | The UI for the blueprint tree in the left panel. | +| re_chunk_store_ui | A chunk store browser UI. | +| re_component_ui | Provides UI editors for Rerun component data for registration with the Rerun Viewer component UI registry. | +| re_selection_panel | The UI for the selection panel. | +| re_view | Types & utilities for defining View classes and communicating with the Viewport. | +| re_view_bar_chart | A View that shows a single bar chart. | +| re_view_dataframe | A View that shows the data contained in entities in a table. | +| re_view_graph | A View that shows a graph (node-link diagram). | +| re_view_map | A View that shows geospatial data on a map. | +| re_view_spatial | Views that show entities in a 2D or 3D spatial relationship. | +| re_view_tensor | A View dedicated to visualizing tensors with arbitrary dimensionality. | +| re_view_text_document | A simple View that shows a single text box. | +| re_view_text_log | A View that shows text entries in a table and scrolls with the active time. | +| re_view_time_series | A View that shows plots over Rerun timelines. | +| re_time_panel | The time panel of the Rerun Viewer, allowing to control the displayed timeline & time. | +| re_viewer | The Rerun Viewer | +| re_viewport | The central viewport panel of the Rerun viewer. | ##### UI support crates diff --git a/Cargo.lock b/Cargo.lock index d552c57b8100..7b97742aa8bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1731,21 +1731,21 @@ dependencies = [ ] [[package]] -name = "custom_space_view" +name = "custom_store_subscriber" version = "0.21.0-alpha.1+dev" dependencies = [ - "mimalloc", - "re_crash_handler", - "re_sdk_comms", - "re_viewer", + "re_build_tools", + "rerun", ] [[package]] -name = "custom_store_subscriber" +name = "custom_view" version = "0.21.0-alpha.1+dev" dependencies = [ - "re_build_tools", - "rerun", + "mimalloc", + "re_crash_handler", + "re_sdk_comms", + "re_viewer", ] [[package]] @@ -6293,12 +6293,12 @@ dependencies = [ "re_format", "re_log", "re_log_types", - "re_space_view", "re_tracing", "re_types", "re_types_blueprint", "re_types_core", "re_ui", + "re_view", "re_viewer_context", "re_viewport_blueprint", "serde", @@ -6316,245 +6316,6 @@ dependencies = [ "web-time", ] -[[package]] -name = "re_space_view" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "ahash", - "arrow", - "bytemuck", - "egui", - "glam", - "itertools 0.13.0", - "nohash-hasher", - "re_chunk_store", - "re_entity_db", - "re_log", - "re_log_types", - "re_query", - "re_renderer", - "re_tracing", - "re_types", - "re_types_core", - "re_ui", - "re_viewer_context", - "re_viewport_blueprint", -] - -[[package]] -name = "re_space_view_bar_chart" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "egui", - "egui_plot", - "re_chunk_store", - "re_entity_db", - "re_log_types", - "re_renderer", - "re_space_view", - "re_tracing", - "re_types", - "re_ui", - "re_viewer_context", - "re_viewport_blueprint", -] - -[[package]] -name = "re_space_view_dataframe" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "anyhow", - "egui", - "egui_table", - "itertools 0.13.0", - "re_chunk_store", - "re_dataframe", - "re_format", - "re_log", - "re_log_types", - "re_renderer", - "re_tracing", - "re_types", - "re_types_core", - "re_ui", - "re_viewer_context", - "re_viewport_blueprint", - "thiserror", -] - -[[package]] -name = "re_space_view_graph" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "ahash", - "egui", - "fjadra", - "nohash-hasher", - "re_chunk", - "re_data_ui", - "re_entity_db", - "re_format", - "re_log", - "re_log_types", - "re_query", - "re_renderer", - "re_space_view", - "re_tracing", - "re_types", - "re_ui", - "re_viewer_context", - "re_viewport_blueprint", -] - -[[package]] -name = "re_space_view_map" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "bytemuck", - "egui", - "glam", - "itertools 0.13.0", - "re_data_ui", - "re_entity_db", - "re_log", - "re_log_types", - "re_math", - "re_query", - "re_renderer", - "re_space_view", - "re_tracing", - "re_types", - "re_ui", - "re_viewer_context", - "re_viewport_blueprint", - "walkers", -] - -[[package]] -name = "re_space_view_spatial" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "ahash", - "anyhow", - "arrow", - "bitflags 2.6.0", - "bytemuck", - "criterion", - "egui", - "glam", - "hexasphere", - "image", - "itertools 0.13.0", - "mimalloc", - "nohash-hasher", - "once_cell", - "ordered-float", - "re_arrow2", - "re_chunk_store", - "re_data_ui", - "re_entity_db", - "re_error", - "re_format", - "re_log", - "re_log_types", - "re_math", - "re_query", - "re_renderer", - "re_space_view", - "re_tracing", - "re_types", - "re_ui", - "re_video", - "re_viewer_context", - "re_viewport_blueprint", - "serde", - "smallvec", - "thiserror", - "vec1", - "web-time", -] - -[[package]] -name = "re_space_view_tensor" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "anyhow", - "bytemuck", - "egui", - "half", - "ndarray", - "re_chunk_store", - "re_data_ui", - "re_log_types", - "re_query", - "re_renderer", - "re_space_view", - "re_tracing", - "re_types", - "re_ui", - "re_viewer_context", - "re_viewport_blueprint", - "thiserror", - "wgpu", -] - -[[package]] -name = "re_space_view_text_document" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "egui", - "egui_commonmark", - "re_chunk_store", - "re_renderer", - "re_space_view", - "re_tracing", - "re_types", - "re_ui", - "re_viewer_context", -] - -[[package]] -name = "re_space_view_text_log" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "egui", - "egui_extras", - "itertools 0.13.0", - "re_chunk_store", - "re_data_ui", - "re_entity_db", - "re_log_types", - "re_query", - "re_renderer", - "re_space_view", - "re_tracing", - "re_types", - "re_ui", - "re_viewer_context", -] - -[[package]] -name = "re_space_view_time_series" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "egui", - "egui_plot", - "itertools 0.13.0", - "rayon", - "re_chunk_store", - "re_format", - "re_log", - "re_log_types", - "re_query", - "re_renderer", - "re_space_view", - "re_tracing", - "re_types", - "re_ui", - "re_viewer_context", - "re_viewport_blueprint", -] - [[package]] name = "re_string_interner" version = "0.21.0-alpha.1+dev" @@ -6783,6 +6544,245 @@ dependencies = [ "web-sys", ] +[[package]] +name = "re_view" +version = "0.21.0-alpha.1+dev" +dependencies = [ + "ahash", + "arrow", + "bytemuck", + "egui", + "glam", + "itertools 0.13.0", + "nohash-hasher", + "re_chunk_store", + "re_entity_db", + "re_log", + "re_log_types", + "re_query", + "re_renderer", + "re_tracing", + "re_types", + "re_types_core", + "re_ui", + "re_viewer_context", + "re_viewport_blueprint", +] + +[[package]] +name = "re_view_bar_chart" +version = "0.21.0-alpha.1+dev" +dependencies = [ + "egui", + "egui_plot", + "re_chunk_store", + "re_entity_db", + "re_log_types", + "re_renderer", + "re_tracing", + "re_types", + "re_ui", + "re_view", + "re_viewer_context", + "re_viewport_blueprint", +] + +[[package]] +name = "re_view_dataframe" +version = "0.21.0-alpha.1+dev" +dependencies = [ + "anyhow", + "egui", + "egui_table", + "itertools 0.13.0", + "re_chunk_store", + "re_dataframe", + "re_format", + "re_log", + "re_log_types", + "re_renderer", + "re_tracing", + "re_types", + "re_types_core", + "re_ui", + "re_viewer_context", + "re_viewport_blueprint", + "thiserror", +] + +[[package]] +name = "re_view_graph" +version = "0.21.0-alpha.1+dev" +dependencies = [ + "ahash", + "egui", + "fjadra", + "nohash-hasher", + "re_chunk", + "re_data_ui", + "re_entity_db", + "re_format", + "re_log", + "re_log_types", + "re_query", + "re_renderer", + "re_tracing", + "re_types", + "re_ui", + "re_view", + "re_viewer_context", + "re_viewport_blueprint", +] + +[[package]] +name = "re_view_map" +version = "0.21.0-alpha.1+dev" +dependencies = [ + "bytemuck", + "egui", + "glam", + "itertools 0.13.0", + "re_data_ui", + "re_entity_db", + "re_log", + "re_log_types", + "re_math", + "re_query", + "re_renderer", + "re_tracing", + "re_types", + "re_ui", + "re_view", + "re_viewer_context", + "re_viewport_blueprint", + "walkers", +] + +[[package]] +name = "re_view_spatial" +version = "0.21.0-alpha.1+dev" +dependencies = [ + "ahash", + "anyhow", + "arrow", + "bitflags 2.6.0", + "bytemuck", + "criterion", + "egui", + "glam", + "hexasphere", + "image", + "itertools 0.13.0", + "mimalloc", + "nohash-hasher", + "once_cell", + "ordered-float", + "re_arrow2", + "re_chunk_store", + "re_data_ui", + "re_entity_db", + "re_error", + "re_format", + "re_log", + "re_log_types", + "re_math", + "re_query", + "re_renderer", + "re_tracing", + "re_types", + "re_ui", + "re_video", + "re_view", + "re_viewer_context", + "re_viewport_blueprint", + "serde", + "smallvec", + "thiserror", + "vec1", + "web-time", +] + +[[package]] +name = "re_view_tensor" +version = "0.21.0-alpha.1+dev" +dependencies = [ + "anyhow", + "bytemuck", + "egui", + "half", + "ndarray", + "re_chunk_store", + "re_data_ui", + "re_log_types", + "re_query", + "re_renderer", + "re_tracing", + "re_types", + "re_ui", + "re_view", + "re_viewer_context", + "re_viewport_blueprint", + "thiserror", + "wgpu", +] + +[[package]] +name = "re_view_text_document" +version = "0.21.0-alpha.1+dev" +dependencies = [ + "egui", + "egui_commonmark", + "re_chunk_store", + "re_renderer", + "re_tracing", + "re_types", + "re_ui", + "re_view", + "re_viewer_context", +] + +[[package]] +name = "re_view_text_log" +version = "0.21.0-alpha.1+dev" +dependencies = [ + "egui", + "egui_extras", + "itertools 0.13.0", + "re_chunk_store", + "re_data_ui", + "re_entity_db", + "re_log_types", + "re_query", + "re_renderer", + "re_tracing", + "re_types", + "re_ui", + "re_view", + "re_viewer_context", +] + +[[package]] +name = "re_view_time_series" +version = "0.21.0-alpha.1+dev" +dependencies = [ + "egui", + "egui_plot", + "itertools 0.13.0", + "rayon", + "re_chunk_store", + "re_format", + "re_log", + "re_log_types", + "re_query", + "re_renderer", + "re_tracing", + "re_types", + "re_ui", + "re_view", + "re_viewer_context", + "re_viewport_blueprint", +] + [[package]] name = "re_viewer" version = "0.21.0-alpha.1+dev" @@ -6825,15 +6825,6 @@ dependencies = [ "re_sdk_comms", "re_selection_panel", "re_smart_channel", - "re_space_view_bar_chart", - "re_space_view_dataframe", - "re_space_view_graph", - "re_space_view_map", - "re_space_view_spatial", - "re_space_view_tensor", - "re_space_view_text_document", - "re_space_view_text_log", - "re_space_view_time_series", "re_time_panel", "re_tracing", "re_types", @@ -6841,6 +6832,15 @@ dependencies = [ "re_types_core", "re_ui", "re_video", + "re_view_bar_chart", + "re_view_dataframe", + "re_view_graph", + "re_view_map", + "re_view_spatial", + "re_view_tensor", + "re_view_text_document", + "re_view_text_log", + "re_view_time_series", "re_viewer_context", "re_viewport", "re_viewport_blueprint", @@ -6930,11 +6930,11 @@ dependencies = [ "re_log", "re_log_types", "re_renderer", - "re_space_view", "re_tracing", "re_types", "re_types_blueprint", "re_ui", + "re_view", "re_viewer_context", "re_viewport_blueprint", ] diff --git a/Cargo.toml b/Cargo.toml index 75aebebf1c04..1cfd5e77a724 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,16 +95,16 @@ re_chunk_store_ui = { path = "crates/viewer/re_chunk_store_ui", version = "=0.21 re_renderer = { path = "crates/viewer/re_renderer", version = "=0.21.0-alpha.1", default-features = false } re_renderer_examples = { path = "crates/viewer/re_renderer_examples", version = "=0.21.0-alpha.1", default-features = false } re_selection_panel = { path = "crates/viewer/re_selection_panel", version = "=0.21.0-alpha.1", default-features = false } -re_space_view = { path = "crates/viewer/re_space_view", version = "=0.21.0-alpha.1", default-features = false } -re_space_view_bar_chart = { path = "crates/viewer/re_space_view_bar_chart", version = "=0.21.0-alpha.1", default-features = false } -re_space_view_spatial = { path = "crates/viewer/re_space_view_spatial", version = "=0.21.0-alpha.1", default-features = false } -re_space_view_dataframe = { path = "crates/viewer/re_space_view_dataframe", version = "=0.21.0-alpha.1", default-features = false } -re_space_view_graph = { path = "crates/viewer/re_space_view_graph", version = "=0.21.0-alpha.1", default-features = false } -re_space_view_map = { path = "crates/viewer/re_space_view_map", version = "=0.21.0-alpha.1", default-features = false } -re_space_view_tensor = { path = "crates/viewer/re_space_view_tensor", version = "=0.21.0-alpha.1", default-features = false } -re_space_view_text_document = { path = "crates/viewer/re_space_view_text_document", version = "=0.21.0-alpha.1", default-features = false } -re_space_view_text_log = { path = "crates/viewer/re_space_view_text_log", version = "=0.21.0-alpha.1", default-features = false } -re_space_view_time_series = { path = "crates/viewer/re_space_view_time_series", version = "=0.21.0-alpha.1", default-features = false } +re_view = { path = "crates/viewer/re_view", version = "=0.21.0-alpha.1", default-features = false } +re_view_bar_chart = { path = "crates/viewer/re_view_bar_chart", version = "=0.21.0-alpha.1", default-features = false } +re_view_spatial = { path = "crates/viewer/re_view_spatial", version = "=0.21.0-alpha.1", default-features = false } +re_view_dataframe = { path = "crates/viewer/re_view_dataframe", version = "=0.21.0-alpha.1", default-features = false } +re_view_graph = { path = "crates/viewer/re_view_graph", version = "=0.21.0-alpha.1", default-features = false } +re_view_map = { path = "crates/viewer/re_view_map", version = "=0.21.0-alpha.1", default-features = false } +re_view_tensor = { path = "crates/viewer/re_view_tensor", version = "=0.21.0-alpha.1", default-features = false } +re_view_text_document = { path = "crates/viewer/re_view_text_document", version = "=0.21.0-alpha.1", default-features = false } +re_view_text_log = { path = "crates/viewer/re_view_text_log", version = "=0.21.0-alpha.1", default-features = false } +re_view_time_series = { path = "crates/viewer/re_view_time_series", version = "=0.21.0-alpha.1", default-features = false } re_time_panel = { path = "crates/viewer/re_time_panel", version = "=0.21.0-alpha.1", default-features = false } re_ui = { path = "crates/viewer/re_ui", version = "=0.21.0-alpha.1", default-features = false } re_viewer = { path = "crates/viewer/re_viewer", version = "=0.21.0-alpha.1", default-features = false } diff --git a/DESIGN.md b/DESIGN.md index 5d4a0f81fdec..601eb03966a1 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -10,7 +10,7 @@ Multi-sentence text ALWAYS ends in a period. #### Casing We prefer normal casing, and avoid Title Casing. -We only use Title Casing for company and product names (Rerun, Rerun Viewer, Discord, …), but NOT for concepts like “container”, “space view”, etc. +We only use Title Casing for company and product names (Rerun, Rerun Viewer, Discord, …), but NOT for concepts like “container”, “view”, etc. #### Examples Good: `log("File saved")` diff --git a/crates/build/re_types_builder/src/codegen/python/mod.rs b/crates/build/re_types_builder/src/codegen/python/mod.rs index 1b0eeb135435..59f5be324598 100644 --- a/crates/build/re_types_builder/src/codegen/python/mod.rs +++ b/crates/build/re_types_builder/src/codegen/python/mod.rs @@ -490,7 +490,7 @@ impl PythonCodeGenerator { files_to_write.insert(filepath.clone(), code); } - // rerun/[{scope}]/{datatypes|components|archetypes|space_views}/__init__.py + // rerun/[{scope}]/{datatypes|components|archetypes|views}/__init__.py write_init_file(&kind_path, &mods, files_to_write); write_init_file(&test_kind_path, &test_mods, files_to_write); for (scope, mods) in scoped_mods { diff --git a/crates/build/re_types_builder/src/codegen/python/views.rs b/crates/build/re_types_builder/src/codegen/python/views.rs index 1f464d99cc3c..d0a1d299616a 100644 --- a/crates/build/re_types_builder/src/codegen/python/views.rs +++ b/crates/build/re_types_builder/src/codegen/python/views.rs @@ -28,7 +28,7 @@ from ... import datatypes from ... import components from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike ", 1, ); @@ -40,7 +40,7 @@ from ..api import SpaceView, SpaceViewContentsLike // Extension class needs to come first, so its __init__ method is called if there is one. superclasses.push(ext_class.name.clone()); } - superclasses.push("SpaceView".to_owned()); + superclasses.push("View".to_owned()); superclasses.join(",") }; code.push_indented(0, format!("class {}({superclasses}):", obj.name), 1); @@ -55,7 +55,7 @@ fn init_method(reporter: &Reporter, objects: &Objects, obj: &Object) -> String { let mut code = r#"def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -77,7 +77,7 @@ fn init_method(reporter: &Reporter, objects: &Objects, obj: &Object) -> String { // Right now we don't create "Like" type aliases for archetypes. // So we have to list all the possible types here. - // For archetypes in general this would only be confusing, but for Space View properties it + // For archetypes in general this would only be confusing, but for View properties it // could be useful to make the annotation here shorter. let additional_type_annotations = property_type .try_get_attr::(ATTR_PYTHON_ALIASES) @@ -117,7 +117,7 @@ All other entities will be transformed to be displayed relative to this origin." "contents", "The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. -See [rerun.blueprint.archetypes.SpaceViewContents][]." +See [rerun.blueprint.archetypes.ViewContents][]." .to_owned(), ), ("name", "The display name of the view.".to_owned()), @@ -130,13 +130,13 @@ Defaults to true if not specified." ), ( "defaults", - "List of default components or component batches to add to the space view. When an archetype + "List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer.".to_owned(), ), ( "overrides", - "Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + "Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/crates/build/re_types_builder/src/codegen/rust/api.rs b/crates/build/re_types_builder/src/codegen/rust/api.rs index 1f6d2c754f7e..058dce7b7a89 100644 --- a/crates/build/re_types_builder/src/codegen/rust/api.rs +++ b/crates/build/re_types_builder/src/codegen/rust/api.rs @@ -1378,7 +1378,7 @@ fn quote_trait_impls_for_view(reporter: &Reporter, obj: &Object) -> TokenStream quote! { impl ::re_types_core::View for #name { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { #identifier .into() } } diff --git a/crates/build/re_types_builder/src/docs.rs b/crates/build/re_types_builder/src/docs.rs index e22558450a02..37aeb14633c1 100644 --- a/crates/build/re_types_builder/src/docs.rs +++ b/crates/build/re_types_builder/src/docs.rs @@ -184,10 +184,10 @@ fn find_and_recommend_doclinks( && content.chars().next().unwrap().is_ascii_uppercase() // TODO(emilk): support references to things outside the default `rerun.scope`. - && !matches!(content, "SpaceViewContents" | "VisibleTimeRanges" | "QueryExpression") + && !matches!(content, "ViewContents" | "VisibleTimeRanges" | "QueryExpression") // In some blueprint code we refer to stuff in Rerun. - && !matches!(content, "ChunkStore" | "ContainerId" | "EntityPathFilter" | "Spatial2DView" | "SpaceViewId" | "SpaceView") + && !matches!(content, "ChunkStore" | "ContainerId" | "EntityPathFilter" | "Spatial2DView" | "ViewId" | "View") // Doc links to OpenStreetMap may show up && !matches!(content, "OpenStreetMap"); diff --git a/crates/store/re_log_types/src/lib.rs b/crates/store/re_log_types/src/lib.rs index bdbf8bab6510..3b708c10a2f1 100644 --- a/crates/store/re_log_types/src/lib.rs +++ b/crates/store/re_log_types/src/lib.rs @@ -208,7 +208,7 @@ impl std::fmt::Display for ApplicationId { /// This command serves two purposes: /// - It is important that a blueprint is never activated before it has been fully /// transmitted. Displaying, or allowing a user to modify, a half-transmitted -/// blueprint can cause confusion and bad interactions with the space view heuristics. +/// blueprint can cause confusion and bad interactions with the view heuristics. /// - Additionally, this command allows fine-tuning the activation behavior itself /// by specifying whether the blueprint should be immediately activated, or only /// become the default for future activations. @@ -275,7 +275,7 @@ pub enum LogMsg { /// /// This is so that the viewer can wait with activating the blueprint until it is /// fully transmitted. Showing a half-transmitted blueprint can cause confusion, - /// and also lead to problems with space-view heuristics. + /// and also lead to problems with view heuristics. BlueprintActivationCommand(BlueprintActivationCommand), } diff --git a/crates/store/re_types/.gitattributes b/crates/store/re_types/.gitattributes index 1518a21bed68..49211261b184 100644 --- a/crates/store/re_types/.gitattributes +++ b/crates/store/re_types/.gitattributes @@ -25,7 +25,7 @@ src/archetypes/text_log.rs linguist-generated=true src/archetypes/time_series_scalar.rs linguist-generated=true src/archetypes/transform3d.rs linguist-generated=true src/archetypes/view_coordinates.rs linguist-generated=true -src/blueprint/auto_space_views.rs linguist-generated=true +src/blueprint/auto_views.rs linguist-generated=true src/blueprint/mod.rs linguist-generated=true src/blueprint/panel_view.rs linguist-generated=true src/components/annotation_context.rs linguist-generated=true diff --git a/crates/store/re_types/definitions/rerun/archetypes/disconnected_space.fbs b/crates/store/re_types/definitions/rerun/archetypes/disconnected_space.fbs index 94fe388c0b4d..e7b3ad037301 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/disconnected_space.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/disconnected_space.fbs @@ -4,7 +4,7 @@ namespace rerun.archetypes; /// /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, /// making it impossible to transform the entity path into its parent's space and vice versa. -/// It *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views. +/// It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. /// This is useful for specifying that a subgraph is independent of the rest of the scene. /// /// \example archetypes/disconnected_space title="Disconnected space" image="https://static.rerun.io/disconnected_space/709041fc304b50c74db773b780e32294fe90c95f/1200w.png" diff --git a/crates/store/re_types/definitions/rerun/attributes.fbs b/crates/store/re_types/definitions/rerun/attributes.fbs index f06db7357941..4545ed82d09f 100644 --- a/crates/store/re_types/definitions/rerun/attributes.fbs +++ b/crates/store/re_types/definitions/rerun/attributes.fbs @@ -38,9 +38,9 @@ attribute "attr.rerun.override_type"; /// This is used for example to scope blueprint types. attribute "attr.rerun.scope"; -/// Specifies the type identifier for a space view type. +/// Specifies the type identifier for a view type. /// -/// This is mandatory for space view types. +/// This is mandatory for view types. attribute "attr.rerun.view_identifier"; /// Marks something as deprecated followed by a (mandatory!) migration note. diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs index ec814ca64051..fbbed167ca0c 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs @@ -14,11 +14,11 @@ include "./archetypes/map_zoom.fbs"; include "./archetypes/panel_blueprint.fbs"; include "./archetypes/plot_legend.fbs"; include "./archetypes/scalar_axis.fbs"; -include "./archetypes/space_view_blueprint.fbs"; -include "./archetypes/space_view_contents.fbs"; include "./archetypes/tensor_scalar_mapping.fbs"; include "./archetypes/tensor_slice_selection.fbs"; include "./archetypes/tensor_view_fit.fbs"; +include "./archetypes/view_blueprint.fbs"; +include "./archetypes/view_contents.fbs"; include "./archetypes/viewport_blueprint.fbs"; include "./archetypes/visible_time_ranges.fbs"; include "./archetypes/visual_bounds2d.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs index e2d5afad0bb5..a1b95850a063 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs @@ -17,7 +17,7 @@ table ContainerBlueprint ( /// The name of the container. display_name: rerun.components.Name ("attr.rerun.component_optional", nullable, order: 200); - /// `ContainerId`s or `SpaceViewId`s that are children of this container. + /// `ContainerId`s or `ViewId`s that are children of this container. contents: [rerun.blueprint.components.IncludedContent] ("attr.rerun.component_optional", nullable, order: 300); /// The layout shares of each column in the container. diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_blueprint.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/view_blueprint.fbs similarity index 60% rename from crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_blueprint.fbs rename to crates/store/re_types/definitions/rerun/blueprint/archetypes/view_blueprint.fbs index 9d07de1355fc..87b258633e94 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_blueprint.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/view_blueprint.fbs @@ -3,29 +3,29 @@ namespace rerun.blueprint.archetypes; // --- /// The description of a single view. -table SpaceViewBlueprint ( +table ViewBlueprint ( "attr.rerun.scope": "blueprint" ) { // --- Required --- /// The class of the view. - class_identifier: rerun.blueprint.components.SpaceViewClass ("attr.rerun.component_required", order: 100); + class_identifier: rerun.blueprint.components.ViewClass ("attr.rerun.component_required", order: 100); // --- Optional --- /// The name of the view. display_name: rerun.components.Name ("attr.rerun.component_optional", nullable, order: 200); - /// The "anchor point" of this space view. + /// The "anchor point" of this view. /// /// Defaults to the root path '/' if not specified. /// - /// The transform at this path forms the reference point for all scene->world transforms in this space view. - /// I.e. the position of this entity path in space forms the origin of the coordinate system in this space view. - /// Furthermore, this is the primary indicator for heuristics on what entities we show in this space view. - space_origin: rerun.blueprint.components.SpaceViewOrigin ("attr.rerun.component_optional", nullable, order: 300); + /// The transform at this path forms the reference point for all scene->world transforms in this view. + /// I.e. the position of this entity path in space forms the origin of the coordinate system in this view. + /// Furthermore, this is the primary indicator for heuristics on what entities we show in this view. + space_origin: rerun.blueprint.components.ViewOrigin ("attr.rerun.component_optional", nullable, order: 300); - /// Whether this space view is visible. + /// Whether this view is visible. /// /// Defaults to true if not specified. visible: rerun.blueprint.components.Visible ("attr.rerun.component_optional", nullable, order: 600); diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_contents.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/view_contents.fbs similarity index 92% rename from crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_contents.fbs rename to crates/store/re_types/definitions/rerun/blueprint/archetypes/view_contents.fbs index 42a772c51e73..2c9509dee26b 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_contents.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/view_contents.fbs @@ -2,7 +2,7 @@ namespace rerun.blueprint.archetypes; // --- -/// The contents of a `SpaceView`. +/// The contents of a `View`. /// /// The contents are found by combining a collection of `QueryExpression`s. /// @@ -40,7 +40,7 @@ namespace rerun.blueprint.archetypes; /// The last rule matching `/world/car/hood` is `- /world/car/**`, so it is excluded. /// The last rule matching `/world` is `- /world`, so it is excluded. /// The last rule matching `/world/house` is `+ /world/**`, so it is included. -table SpaceViewContents ( +table ViewContents ( "attr.rerun.scope": "blueprint", "attr.rust.derive": "Default" ) { @@ -48,8 +48,8 @@ table SpaceViewContents ( // --- Optional --- - /// The `QueryExpression` that populates the contents for the `SpaceView`. + /// The `QueryExpression` that populates the contents for the view. /// - /// They determine which entities are part of the spaceview. + /// They determine which entities are part of the view. query: [rerun.blueprint.components.QueryExpression] ("attr.rerun.component_optional", order: 1000); } diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/viewport_blueprint.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/viewport_blueprint.fbs index 4d514ed62cf0..8b1d46d6e9a1 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/viewport_blueprint.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/viewport_blueprint.fbs @@ -11,33 +11,33 @@ table ViewportBlueprint ( // --- Required --- // --- Optional --- - /// The layout of the space-views + /// The layout of the views root_container: rerun.blueprint.components.RootContainer ("attr.rerun.component_optional", nullable, order: 2500); /// Show one tab as maximized? - maximized: rerun.blueprint.components.SpaceViewMaximized ("attr.rerun.component_optional", nullable, order: 3000); + maximized: rerun.blueprint.components.ViewMaximized ("attr.rerun.component_optional", nullable, order: 3000); - // TODO(andreas): This is to be removed in the future, all new space views without an explicit container + // TODO(andreas): This is to be removed in the future, all new views without an explicit container // should always insert themselves using a heuristic. /// Whether the viewport layout is determined automatically. /// - /// If `true`, the container layout will be reset whenever a new space view is added or removed. + /// If `true`, the container layout will be reset whenever a new view is added or removed. /// This defaults to `false` and is automatically set to `false` when there is user determined layout. auto_layout: rerun.blueprint.components.AutoLayout ("attr.rerun.component_optional", nullable, order: 4000); - // TODO(jleibs): This should come with an optional container id that specifies where to insert new space views. - /// Whether or not space views should be created automatically. + // TODO(jleibs): This should come with an optional container id that specifies where to insert new views. + /// Whether or not views should be created automatically. /// - /// If `true`, the viewer will only add space views that it hasn't considered previously (as identified by `past_viewer_recommendations`) - /// and which aren't deemed redundant to existing space views. - /// This defaults to `false` and is automatically set to `false` when the user adds space views manually in the viewer. - auto_space_views: rerun.blueprint.components.AutoSpaceViews ("attr.rerun.component_optional", nullable, order: 5000); + /// If `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`) + /// and which aren't deemed redundant to existing views. + /// This defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer. + auto_views: rerun.blueprint.components.AutoViews ("attr.rerun.component_optional", nullable, order: 5000); - /// Hashes of all recommended space views the viewer has already added and that should not be added again. + /// Hashes of all recommended views the viewer has already added and that should not be added again. /// /// This is an internal field and should not be set usually. - /// If you want the viewer from stopping to add space views, you should set `auto_space_views` to `false`. + /// If you want the viewer from stopping to add views, you should set `auto_views` to `false`. /// - /// The viewer uses this to determine whether it should keep adding space views. + /// The viewer uses this to determine whether it should keep adding views. past_viewer_recommendations: [rerun.blueprint.components.ViewerRecommendationHash] ("attr.rerun.component_optional", nullable, order: 6000); } diff --git a/crates/store/re_types/definitions/rerun/blueprint/components.fbs b/crates/store/re_types/definitions/rerun/blueprint/components.fbs index 55db3d7a4e50..8ebac64a10c8 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components.fbs @@ -3,7 +3,7 @@ include "./components/active_tab.fbs"; include "./components/apply_latest_at.fbs"; include "./components/auto_layout.fbs"; -include "./components/auto_space_views.fbs"; +include "./components/auto_views.fbs"; include "./components/background_kind.fbs"; include "./components/column_share.fbs"; include "./components/component_column_selector.fbs"; @@ -27,12 +27,12 @@ include "./components/query_expression.fbs"; include "./components/root_container.fbs"; include "./components/row_share.fbs"; include "./components/selected_columns.fbs"; -include "./components/space_view_class.fbs"; -include "./components/space_view_maximized.fbs"; -include "./components/space_view_origin.fbs"; include "./components/tensor_dimension_index_slider.fbs"; include "./components/timeline_name.fbs"; +include "./components/view_class.fbs"; include "./components/view_fit.fbs"; +include "./components/view_maximized.fbs"; +include "./components/view_origin.fbs"; include "./components/viewer_recommendation_hash.fbs"; include "./components/visible.fbs"; include "./components/visible_time_range.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/auto_views.fbs similarity index 68% rename from crates/store/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs rename to crates/store/re_types/definitions/rerun/blueprint/components/auto_views.fbs index 6a637d9b7ab7..ce4a452dd4c3 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/auto_views.fbs @@ -1,10 +1,8 @@ namespace rerun.blueprint.components; -// --- - -/// Whether or not space views should be created automatically. -struct AutoSpaceViews ( +/// Whether or not views should be created automatically. +struct AutoViews ( "attr.arrow.transparent", "attr.rerun.scope": "blueprint", "attr.python.aliases": "bool", @@ -13,5 +11,5 @@ struct AutoSpaceViews ( "attr.rust.repr": "transparent", "attr.rust.tuple_struct" ) { - auto_space_views: rerun.datatypes.Bool (order: 100); + auto_views: rerun.datatypes.Bool (order: 100); } diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/query_expression.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/query_expression.fbs index 2e102dbc6d0a..285f2d532cd0 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/query_expression.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/query_expression.fbs @@ -6,7 +6,7 @@ namespace rerun.blueprint.components; /// Each expression is either an inclusion or an exclusion expression. /// Inclusions start with an optional `+` and exclusions must start with a `-`. /// -/// Multiple expressions are combined together as part of `SpaceViewContents`. +/// Multiple expressions are combined together as part of [archetypes.ViewContents]. /// /// The `/**` suffix matches the whole subtree, i.e. self and any child, recursively /// (`/world/**` matches both `/world` and `/world/car/driver`). diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/space_view_class.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/view_class.fbs similarity index 91% rename from crates/store/re_types/definitions/rerun/blueprint/components/space_view_class.fbs rename to crates/store/re_types/definitions/rerun/blueprint/components/view_class.fbs index 388e53727ac7..b41956c2ef8d 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/space_view_class.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/view_class.fbs @@ -1,9 +1,7 @@ namespace rerun.blueprint.components; -// --- - /// The class identifier of view, e.g. `"2D"`, `"TextLog"`, …. -table SpaceViewClass ( +table ViewClass ( "attr.arrow.transparent", "attr.rerun.scope": "blueprint", "attr.python.aliases": "str", diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/view_maximized.fbs similarity index 69% rename from crates/store/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs rename to crates/store/re_types/definitions/rerun/blueprint/components/view_maximized.fbs index e873fe49e349..405e62cbcbc7 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/view_maximized.fbs @@ -1,14 +1,12 @@ namespace rerun.blueprint.components; -// --- - -/// Whether a space view is maximized. -table SpaceViewMaximized ( +/// Whether a view is maximized. +table ViewMaximized ( "attr.rerun.scope": "blueprint", "attr.python.aliases": "npt.NDArray[np.uint8], npt.ArrayLike, Sequence[int], bytes", "attr.rust.derive": "Default", "attr.rust.override_crate": "re_types_blueprint", "attr.rust.repr": "transparent" ) { - space_view_id: rerun.datatypes.Uuid (order: 100); + view_id: rerun.datatypes.Uuid (order: 100); } diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/space_view_origin.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/view_origin.fbs similarity index 81% rename from crates/store/re_types/definitions/rerun/blueprint/components/space_view_origin.fbs rename to crates/store/re_types/definitions/rerun/blueprint/components/view_origin.fbs index 26f02d482e2b..caa033b36605 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/space_view_origin.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/view_origin.fbs @@ -1,9 +1,7 @@ namespace rerun.blueprint.components; -// --- - -/// The origin of a `SpaceView`. -table SpaceViewOrigin ( +/// The origin of a view. +table ViewOrigin ( "attr.arrow.transparent", "attr.rerun.scope": "blueprint", "attr.python.aliases": "str", diff --git a/crates/store/re_types/definitions/rerun/components/disconnected_space.fbs b/crates/store/re_types/definitions/rerun/components/disconnected_space.fbs index 45449161ed9c..2aef729a83ae 100644 --- a/crates/store/re_types/definitions/rerun/components/disconnected_space.fbs +++ b/crates/store/re_types/definitions/rerun/components/disconnected_space.fbs @@ -7,7 +7,7 @@ namespace rerun.components; /// /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, /// making it impossible to transform the entity path into its parent's space and vice versa. -/// It *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views. +/// It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. /// This is useful for specifying that a subgraph is independent of the rest of the scene. struct DisconnectedSpace ( "attr.python.aliases": "bool", diff --git a/crates/store/re_types/src/archetypes/disconnected_space.rs b/crates/store/re_types/src/archetypes/disconnected_space.rs index 06e7a14804bb..58d59fa1b79a 100644 --- a/crates/store/re_types/src/archetypes/disconnected_space.rs +++ b/crates/store/re_types/src/archetypes/disconnected_space.rs @@ -22,7 +22,7 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, /// making it impossible to transform the entity path into its parent's space and vice versa. -/// It *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views. +/// It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. /// This is useful for specifying that a subgraph is independent of the rest of the scene. /// /// ## Example diff --git a/crates/store/re_types/src/archetypes/transform3d.rs b/crates/store/re_types/src/archetypes/transform3d.rs index 19bea105a99f..81eeef4990e0 100644 --- a/crates/store/re_types/src/archetypes/transform3d.rs +++ b/crates/store/re_types/src/archetypes/transform3d.rs @@ -79,7 +79,7 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// fn main() -> Result<(), Box> { /// let rec = rerun::RecordingStreamBuilder::new("rerun_example_transform3d_hierarchy").spawn()?; /// -/// // TODO(#5521): log two space views as in the python example +/// // TODO(#5521): log two views as in the python example /// /// rec.set_time_seconds("sim_time", 0.0); /// diff --git a/crates/store/re_types/src/blueprint/archetypes/.gitattributes b/crates/store/re_types/src/blueprint/archetypes/.gitattributes index 4ef9cf481468..1065a18b6415 100644 --- a/crates/store/re_types/src/blueprint/archetypes/.gitattributes +++ b/crates/store/re_types/src/blueprint/archetypes/.gitattributes @@ -14,10 +14,10 @@ map_zoom.rs linguist-generated=true mod.rs linguist-generated=true plot_legend.rs linguist-generated=true scalar_axis.rs linguist-generated=true -space_view_blueprint.rs linguist-generated=true -space_view_contents.rs linguist-generated=true tensor_scalar_mapping.rs linguist-generated=true tensor_slice_selection.rs linguist-generated=true tensor_view_fit.rs linguist-generated=true +view_blueprint.rs linguist-generated=true +view_contents.rs linguist-generated=true visible_time_ranges.rs linguist-generated=true visual_bounds2d.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/archetypes/mod.rs b/crates/store/re_types/src/blueprint/archetypes/mod.rs index 24cd2e1518c5..3590029048a5 100644 --- a/crates/store/re_types/src/blueprint/archetypes/mod.rs +++ b/crates/store/re_types/src/blueprint/archetypes/mod.rs @@ -12,11 +12,11 @@ mod map_background; mod map_zoom; mod plot_legend; mod scalar_axis; -mod space_view_blueprint; -mod space_view_contents; mod tensor_scalar_mapping; mod tensor_slice_selection; mod tensor_view_fit; +mod view_blueprint; +mod view_contents; mod visible_time_ranges; mod visible_time_ranges_ext; mod visual_bounds2d; @@ -33,10 +33,10 @@ pub use self::map_background::MapBackground; pub use self::map_zoom::MapZoom; pub use self::plot_legend::PlotLegend; pub use self::scalar_axis::ScalarAxis; -pub use self::space_view_blueprint::SpaceViewBlueprint; -pub use self::space_view_contents::SpaceViewContents; pub use self::tensor_scalar_mapping::TensorScalarMapping; pub use self::tensor_slice_selection::TensorSliceSelection; pub use self::tensor_view_fit::TensorViewFit; +pub use self::view_blueprint::ViewBlueprint; +pub use self::view_contents::ViewContents; pub use self::visible_time_ranges::VisibleTimeRanges; pub use self::visual_bounds2d::VisualBounds2D; diff --git a/crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs b/crates/store/re_types/src/blueprint/archetypes/view_blueprint.rs similarity index 73% rename from crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs rename to crates/store/re_types/src/blueprint/archetypes/view_blueprint.rs index 996c0d54dd19..2cc4714acc07 100644 --- a/crates/store/re_types/src/blueprint/archetypes/space_view_blueprint.rs +++ b/crates/store/re_types/src/blueprint/archetypes/view_blueprint.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_blueprint.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/view_blueprint.fbs". #![allow(unused_imports)] #![allow(unused_parens)] @@ -20,23 +20,23 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: The description of a single view. #[derive(Clone, Debug)] -pub struct SpaceViewBlueprint { +pub struct ViewBlueprint { /// The class of the view. - pub class_identifier: crate::blueprint::components::SpaceViewClass, + pub class_identifier: crate::blueprint::components::ViewClass, /// The name of the view. pub display_name: Option, - /// The "anchor point" of this space view. + /// The "anchor point" of this view. /// /// Defaults to the root path '/' if not specified. /// - /// The transform at this path forms the reference point for all scene->world transforms in this space view. - /// I.e. the position of this entity path in space forms the origin of the coordinate system in this space view. - /// Furthermore, this is the primary indicator for heuristics on what entities we show in this space view. - pub space_origin: Option, + /// The transform at this path forms the reference point for all scene->world transforms in this view. + /// I.e. the position of this entity path in space forms the origin of the coordinate system in this view. + /// Furthermore, this is the primary indicator for heuristics on what entities we show in this view. + pub space_origin: Option, - /// Whether this space view is visible. + /// Whether this view is visible. /// /// Defaults to true if not specified. pub visible: Option, @@ -45,8 +45,8 @@ pub struct SpaceViewBlueprint { static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = once_cell::sync::Lazy::new(|| { [ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), - component_name: "rerun.blueprint.components.SpaceViewClass".into(), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), + component_name: "rerun.blueprint.components.ViewClass".into(), archetype_field_name: Some("class_identifier".into()), }] }); @@ -54,8 +54,8 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = once_cell::sync::Lazy::new(|| { [ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), - component_name: "rerun.blueprint.components.SpaceViewBlueprintIndicator".into(), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), + component_name: "rerun.blueprint.components.ViewBlueprintIndicator".into(), archetype_field_name: None, }] }); @@ -64,17 +64,17 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> once_cell::sync::Lazy::new(|| { [ ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), component_name: "rerun.components.Name".into(), archetype_field_name: Some("display_name".into()), }, ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), - component_name: "rerun.blueprint.components.SpaceViewOrigin".into(), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), + component_name: "rerun.blueprint.components.ViewOrigin".into(), archetype_field_name: Some("space_origin".into()), }, ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), component_name: "rerun.blueprint.components.Visible".into(), archetype_field_name: Some("visible".into()), }, @@ -85,58 +85,57 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> = once_cell::sync::Lazy::new(|| { [ ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), - component_name: "rerun.blueprint.components.SpaceViewClass".into(), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), + component_name: "rerun.blueprint.components.ViewClass".into(), archetype_field_name: Some("class_identifier".into()), }, ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), - component_name: "rerun.blueprint.components.SpaceViewBlueprintIndicator".into(), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), + component_name: "rerun.blueprint.components.ViewBlueprintIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), component_name: "rerun.components.Name".into(), archetype_field_name: Some("display_name".into()), }, ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), - component_name: "rerun.blueprint.components.SpaceViewOrigin".into(), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), + component_name: "rerun.blueprint.components.ViewOrigin".into(), archetype_field_name: Some("space_origin".into()), }, ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), component_name: "rerun.blueprint.components.Visible".into(), archetype_field_name: Some("visible".into()), }, ] }); -impl SpaceViewBlueprint { +impl ViewBlueprint { /// The total number of components in the archetype: 1 required, 1 recommended, 3 optional pub const NUM_COMPONENTS: usize = 5usize; } -/// Indicator component for the [`SpaceViewBlueprint`] [`::re_types_core::Archetype`] -pub type SpaceViewBlueprintIndicator = - ::re_types_core::GenericIndicatorComponent; +/// Indicator component for the [`ViewBlueprint`] [`::re_types_core::Archetype`] +pub type ViewBlueprintIndicator = ::re_types_core::GenericIndicatorComponent; -impl ::re_types_core::Archetype for SpaceViewBlueprint { - type Indicator = SpaceViewBlueprintIndicator; +impl ::re_types_core::Archetype for ViewBlueprint { + type Indicator = ViewBlueprintIndicator; #[inline] fn name() -> ::re_types_core::ArchetypeName { - "rerun.blueprint.archetypes.SpaceViewBlueprint".into() + "rerun.blueprint.archetypes.ViewBlueprint".into() } #[inline] fn display_name() -> &'static str { - "Space view blueprint" + "View blueprint" } #[inline] fn indicator() -> ComponentBatchCowWithDescriptor<'static> { - static INDICATOR: SpaceViewBlueprintIndicator = SpaceViewBlueprintIndicator::DEFAULT; + static INDICATOR: ViewBlueprintIndicator = ViewBlueprintIndicator::DEFAULT; ComponentBatchCowWithDescriptor::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } @@ -172,20 +171,20 @@ impl ::re_types_core::Archetype for SpaceViewBlueprint { .collect(); let class_identifier = { let array = arrays_by_name - .get("rerun.blueprint.components.SpaceViewClass") + .get("rerun.blueprint.components.ViewClass") .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.archetypes.SpaceViewBlueprint#class_identifier")?; - ::from_arrow2_opt(&**array) - .with_context("rerun.blueprint.archetypes.SpaceViewBlueprint#class_identifier")? + .with_context("rerun.blueprint.archetypes.ViewBlueprint#class_identifier")?; + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ViewBlueprint#class_identifier")? .into_iter() .next() .flatten() .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.archetypes.SpaceViewBlueprint#class_identifier")? + .with_context("rerun.blueprint.archetypes.ViewBlueprint#class_identifier")? }; let display_name = if let Some(array) = arrays_by_name.get("rerun.components.Name") { ::from_arrow2_opt(&**array) - .with_context("rerun.blueprint.archetypes.SpaceViewBlueprint#display_name")? + .with_context("rerun.blueprint.archetypes.ViewBlueprint#display_name")? .into_iter() .next() .flatten() @@ -193,9 +192,9 @@ impl ::re_types_core::Archetype for SpaceViewBlueprint { None }; let space_origin = - if let Some(array) = arrays_by_name.get("rerun.blueprint.components.SpaceViewOrigin") { - ::from_arrow2_opt(&**array) - .with_context("rerun.blueprint.archetypes.SpaceViewBlueprint#space_origin")? + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.ViewOrigin") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ViewBlueprint#space_origin")? .into_iter() .next() .flatten() @@ -205,7 +204,7 @@ impl ::re_types_core::Archetype for SpaceViewBlueprint { let visible = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.Visible") { ::from_arrow2_opt(&**array) - .with_context("rerun.blueprint.archetypes.SpaceViewBlueprint#visible")? + .with_context("rerun.blueprint.archetypes.ViewBlueprint#visible")? .into_iter() .next() .flatten() @@ -221,7 +220,7 @@ impl ::re_types_core::Archetype for SpaceViewBlueprint { } } -impl ::re_types_core::AsComponents for SpaceViewBlueprint { +impl ::re_types_core::AsComponents for ViewBlueprint { fn as_component_batches(&self) -> Vec> { re_tracing::profile_function!(); use ::re_types_core::Archetype as _; @@ -231,11 +230,9 @@ impl ::re_types_core::AsComponents for SpaceViewBlueprint { ::re_types_core::ComponentBatchCowWithDescriptor { batch: batch.into(), descriptor_override: Some(ComponentDescriptor { - archetype_name: Some( - "rerun.blueprint.archetypes.SpaceViewBlueprint".into(), - ), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), archetype_field_name: Some(("class_identifier").into()), - component_name: ("rerun.blueprint.components.SpaceViewClass").into(), + component_name: ("rerun.blueprint.components.ViewClass").into(), }), } }), @@ -246,7 +243,7 @@ impl ::re_types_core::AsComponents for SpaceViewBlueprint { .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { batch: batch.into(), descriptor_override: Some(ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), archetype_field_name: Some(("display_name").into()), component_name: ("rerun.components.Name").into(), }), @@ -258,9 +255,9 @@ impl ::re_types_core::AsComponents for SpaceViewBlueprint { .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { batch: batch.into(), descriptor_override: Some(ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), archetype_field_name: Some(("space_origin").into()), - component_name: ("rerun.blueprint.components.SpaceViewOrigin").into(), + component_name: ("rerun.blueprint.components.ViewOrigin").into(), }), }), (self @@ -270,7 +267,7 @@ impl ::re_types_core::AsComponents for SpaceViewBlueprint { .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { batch: batch.into(), descriptor_override: Some(ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewBlueprint".into()), + archetype_name: Some("rerun.blueprint.archetypes.ViewBlueprint".into()), archetype_field_name: Some(("visible").into()), component_name: ("rerun.blueprint.components.Visible").into(), }), @@ -282,12 +279,12 @@ impl ::re_types_core::AsComponents for SpaceViewBlueprint { } } -impl ::re_types_core::ArchetypeReflectionMarker for SpaceViewBlueprint {} +impl ::re_types_core::ArchetypeReflectionMarker for ViewBlueprint {} -impl SpaceViewBlueprint { - /// Create a new `SpaceViewBlueprint`. +impl ViewBlueprint { + /// Create a new `ViewBlueprint`. #[inline] - pub fn new(class_identifier: impl Into) -> Self { + pub fn new(class_identifier: impl Into) -> Self { Self { class_identifier: class_identifier.into(), display_name: None, @@ -303,23 +300,23 @@ impl SpaceViewBlueprint { self } - /// The "anchor point" of this space view. + /// The "anchor point" of this view. /// /// Defaults to the root path '/' if not specified. /// - /// The transform at this path forms the reference point for all scene->world transforms in this space view. - /// I.e. the position of this entity path in space forms the origin of the coordinate system in this space view. - /// Furthermore, this is the primary indicator for heuristics on what entities we show in this space view. + /// The transform at this path forms the reference point for all scene->world transforms in this view. + /// I.e. the position of this entity path in space forms the origin of the coordinate system in this view. + /// Furthermore, this is the primary indicator for heuristics on what entities we show in this view. #[inline] pub fn with_space_origin( mut self, - space_origin: impl Into, + space_origin: impl Into, ) -> Self { self.space_origin = Some(space_origin.into()); self } - /// Whether this space view is visible. + /// Whether this view is visible. /// /// Defaults to true if not specified. #[inline] @@ -332,7 +329,7 @@ impl SpaceViewBlueprint { } } -impl ::re_types_core::SizeBytes for SpaceViewBlueprint { +impl ::re_types_core::SizeBytes for ViewBlueprint { #[inline] fn heap_size_bytes(&self) -> u64 { self.class_identifier.heap_size_bytes() @@ -343,9 +340,9 @@ impl ::re_types_core::SizeBytes for SpaceViewBlueprint { #[inline] fn is_pod() -> bool { - ::is_pod() + ::is_pod() && >::is_pod() - && >::is_pod() + && >::is_pod() && >::is_pod() } } diff --git a/crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs b/crates/store/re_types/src/blueprint/archetypes/view_contents.rs similarity index 80% rename from crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs rename to crates/store/re_types/src/blueprint/archetypes/view_contents.rs index 6d0561e4c87f..a748140632bd 100644 --- a/crates/store/re_types/src/blueprint/archetypes/space_view_contents.rs +++ b/crates/store/re_types/src/blueprint/archetypes/view_contents.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_contents.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/view_contents.fbs". #![allow(unused_imports)] #![allow(unused_parens)] @@ -18,7 +18,7 @@ use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; -/// **Archetype**: The contents of a `SpaceView`. +/// **Archetype**: The contents of a `View`. /// /// The contents are found by combining a collection of `QueryExpression`s. /// @@ -57,10 +57,10 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// The last rule matching `/world` is `- /world`, so it is excluded. /// The last rule matching `/world/house` is `+ /world/**`, so it is included. #[derive(Clone, Debug, Default)] -pub struct SpaceViewContents { - /// The `QueryExpression` that populates the contents for the `SpaceView`. +pub struct ViewContents { + /// The `QueryExpression` that populates the contents for the view. /// - /// They determine which entities are part of the spaceview. + /// They determine which entities are part of the view. pub query: Vec, } @@ -70,8 +70,8 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = once_cell::sync::Lazy::new(|| { [ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), - component_name: "rerun.blueprint.components.SpaceViewContentsIndicator".into(), + archetype_name: Some("rerun.blueprint.archetypes.ViewContents".into()), + component_name: "rerun.blueprint.components.ViewContentsIndicator".into(), archetype_field_name: None, }] }); @@ -79,7 +79,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = once_cell::sync::Lazy::new(|| { [ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), + archetype_name: Some("rerun.blueprint.archetypes.ViewContents".into()), component_name: "rerun.blueprint.components.QueryExpression".into(), archetype_field_name: Some("query".into()), }] @@ -89,42 +89,42 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), - component_name: "rerun.blueprint.components.SpaceViewContentsIndicator".into(), + archetype_name: Some("rerun.blueprint.archetypes.ViewContents".into()), + component_name: "rerun.blueprint.components.ViewContentsIndicator".into(), archetype_field_name: None, }, ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), + archetype_name: Some("rerun.blueprint.archetypes.ViewContents".into()), component_name: "rerun.blueprint.components.QueryExpression".into(), archetype_field_name: Some("query".into()), }, ] }); -impl SpaceViewContents { +impl ViewContents { /// The total number of components in the archetype: 0 required, 1 recommended, 1 optional pub const NUM_COMPONENTS: usize = 2usize; } -/// Indicator component for the [`SpaceViewContents`] [`::re_types_core::Archetype`] -pub type SpaceViewContentsIndicator = ::re_types_core::GenericIndicatorComponent; +/// Indicator component for the [`ViewContents`] [`::re_types_core::Archetype`] +pub type ViewContentsIndicator = ::re_types_core::GenericIndicatorComponent; -impl ::re_types_core::Archetype for SpaceViewContents { - type Indicator = SpaceViewContentsIndicator; +impl ::re_types_core::Archetype for ViewContents { + type Indicator = ViewContentsIndicator; #[inline] fn name() -> ::re_types_core::ArchetypeName { - "rerun.blueprint.archetypes.SpaceViewContents".into() + "rerun.blueprint.archetypes.ViewContents".into() } #[inline] fn display_name() -> &'static str { - "Space view contents" + "View contents" } #[inline] fn indicator() -> ComponentBatchCowWithDescriptor<'static> { - static INDICATOR: SpaceViewContentsIndicator = SpaceViewContentsIndicator::DEFAULT; + static INDICATOR: ViewContentsIndicator = ViewContentsIndicator::DEFAULT; ComponentBatchCowWithDescriptor::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) } @@ -162,19 +162,19 @@ impl ::re_types_core::Archetype for SpaceViewContents { let array = arrays_by_name .get("rerun.blueprint.components.QueryExpression") .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.archetypes.SpaceViewContents#query")?; + .with_context("rerun.blueprint.archetypes.ViewContents#query")?; ::from_arrow2_opt(&**array) - .with_context("rerun.blueprint.archetypes.SpaceViewContents#query")? + .with_context("rerun.blueprint.archetypes.ViewContents#query")? .into_iter() .map(|v| v.ok_or_else(DeserializationError::missing_data)) .collect::>>() - .with_context("rerun.blueprint.archetypes.SpaceViewContents#query")? + .with_context("rerun.blueprint.archetypes.ViewContents#query")? }; Ok(Self { query }) } } -impl ::re_types_core::AsComponents for SpaceViewContents { +impl ::re_types_core::AsComponents for ViewContents { fn as_component_batches(&self) -> Vec> { re_tracing::profile_function!(); use ::re_types_core::Archetype as _; @@ -184,7 +184,7 @@ impl ::re_types_core::AsComponents for SpaceViewContents { ::re_types_core::ComponentBatchCowWithDescriptor { batch: batch.into(), descriptor_override: Some(ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.SpaceViewContents".into()), + archetype_name: Some("rerun.blueprint.archetypes.ViewContents".into()), archetype_field_name: Some(("query").into()), component_name: ("rerun.blueprint.components.QueryExpression").into(), }), @@ -197,10 +197,10 @@ impl ::re_types_core::AsComponents for SpaceViewContents { } } -impl ::re_types_core::ArchetypeReflectionMarker for SpaceViewContents {} +impl ::re_types_core::ArchetypeReflectionMarker for ViewContents {} -impl SpaceViewContents { - /// Create a new `SpaceViewContents`. +impl ViewContents { + /// Create a new `ViewContents`. #[inline] pub fn new( query: impl IntoIterator>, @@ -211,7 +211,7 @@ impl SpaceViewContents { } } -impl ::re_types_core::SizeBytes for SpaceViewContents { +impl ::re_types_core::SizeBytes for ViewContents { #[inline] fn heap_size_bytes(&self) -> u64 { self.query.heap_size_bytes() diff --git a/crates/store/re_types/src/blueprint/components/.gitattributes b/crates/store/re_types/src/blueprint/components/.gitattributes index 38cab9cb557b..8ad1b4e0df36 100644 --- a/crates/store/re_types/src/blueprint/components/.gitattributes +++ b/crates/store/re_types/src/blueprint/components/.gitattributes @@ -24,11 +24,11 @@ panel_state.rs linguist-generated=true query_expression.rs linguist-generated=true row_share.rs linguist-generated=true selected_columns.rs linguist-generated=true -space_view_class.rs linguist-generated=true -space_view_origin.rs linguist-generated=true tensor_dimension_index_slider.rs linguist-generated=true timeline_name.rs linguist-generated=true +view_class.rs linguist-generated=true view_fit.rs linguist-generated=true +view_origin.rs linguist-generated=true viewer_recommendation_hash.rs linguist-generated=true visible.rs linguist-generated=true visible_time_range.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/components/mod.rs b/crates/store/re_types/src/blueprint/components/mod.rs index 0fb6d14946dc..78723bc794d0 100644 --- a/crates/store/re_types/src/blueprint/components/mod.rs +++ b/crates/store/re_types/src/blueprint/components/mod.rs @@ -31,15 +31,15 @@ mod panel_state_ext; mod query_expression; mod row_share; mod selected_columns; -mod space_view_class; -mod space_view_class_ext; -mod space_view_origin; -mod space_view_origin_ext; mod tensor_dimension_index_slider; mod tensor_dimension_index_slider_ext; mod timeline_name; mod timeline_name_ext; +mod view_class; +mod view_class_ext; mod view_fit; +mod view_origin; +mod view_origin_ext; mod viewer_recommendation_hash; mod viewer_recommendation_hash_ext; mod visible; @@ -71,11 +71,11 @@ pub use self::panel_state::PanelState; pub use self::query_expression::QueryExpression; pub use self::row_share::RowShare; pub use self::selected_columns::SelectedColumns; -pub use self::space_view_class::SpaceViewClass; -pub use self::space_view_origin::SpaceViewOrigin; pub use self::tensor_dimension_index_slider::TensorDimensionIndexSlider; pub use self::timeline_name::TimelineName; +pub use self::view_class::ViewClass; pub use self::view_fit::ViewFit; +pub use self::view_origin::ViewOrigin; pub use self::viewer_recommendation_hash::ViewerRecommendationHash; pub use self::visible::Visible; pub use self::visible_time_range::VisibleTimeRange; diff --git a/crates/store/re_types/src/blueprint/components/query_expression.rs b/crates/store/re_types/src/blueprint/components/query_expression.rs index 3b23d624b848..d3684644b5d4 100644 --- a/crates/store/re_types/src/blueprint/components/query_expression.rs +++ b/crates/store/re_types/src/blueprint/components/query_expression.rs @@ -23,7 +23,7 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// Each expression is either an inclusion or an exclusion expression. /// Inclusions start with an optional `+` and exclusions must start with a `-`. /// -/// Multiple expressions are combined together as part of `SpaceViewContents`. +/// Multiple expressions are combined together as part of [`archetypes::ViewContents`][crate::blueprint::archetypes::ViewContents]. /// /// The `/**` suffix matches the whole subtree, i.e. self and any child, recursively /// (`/world/**` matches both `/world` and `/world/car/driver`). diff --git a/crates/store/re_types/src/blueprint/components/space_view_class.rs b/crates/store/re_types/src/blueprint/components/view_class.rs similarity index 80% rename from crates/store/re_types/src/blueprint/components/space_view_class.rs rename to crates/store/re_types/src/blueprint/components/view_class.rs index 53c262a11de7..4496488e546b 100644 --- a/crates/store/re_types/src/blueprint/components/space_view_class.rs +++ b/crates/store/re_types/src/blueprint/components/view_class.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/space_view_class.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/view_class.fbs". #![allow(unused_imports)] #![allow(unused_parens)] @@ -21,18 +21,18 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The class identifier of view, e.g. `"2D"`, `"TextLog"`, …. #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] #[repr(transparent)] -pub struct SpaceViewClass(pub crate::datatypes::Utf8); +pub struct ViewClass(pub crate::datatypes::Utf8); -impl ::re_types_core::Component for SpaceViewClass { +impl ::re_types_core::Component for ViewClass { #[inline] fn descriptor() -> ComponentDescriptor { - ComponentDescriptor::new("rerun.blueprint.components.SpaceViewClass") + ComponentDescriptor::new("rerun.blueprint.components.ViewClass") } } -::re_types_core::macros::impl_into_cow!(SpaceViewClass); +::re_types_core::macros::impl_into_cow!(ViewClass); -impl ::re_types_core::Loggable for SpaceViewClass { +impl ::re_types_core::Loggable for ViewClass { #[inline] fn arrow_datatype() -> arrow::datatypes::DataType { crate::datatypes::Utf8::arrow_datatype() @@ -63,20 +63,20 @@ impl ::re_types_core::Loggable for SpaceViewClass { } } -impl> From for SpaceViewClass { +impl> From for ViewClass { fn from(v: T) -> Self { Self(v.into()) } } -impl std::borrow::Borrow for SpaceViewClass { +impl std::borrow::Borrow for ViewClass { #[inline] fn borrow(&self) -> &crate::datatypes::Utf8 { &self.0 } } -impl std::ops::Deref for SpaceViewClass { +impl std::ops::Deref for ViewClass { type Target = crate::datatypes::Utf8; #[inline] @@ -85,14 +85,14 @@ impl std::ops::Deref for SpaceViewClass { } } -impl std::ops::DerefMut for SpaceViewClass { +impl std::ops::DerefMut for ViewClass { #[inline] fn deref_mut(&mut self) -> &mut crate::datatypes::Utf8 { &mut self.0 } } -impl ::re_types_core::SizeBytes for SpaceViewClass { +impl ::re_types_core::SizeBytes for ViewClass { #[inline] fn heap_size_bytes(&self) -> u64 { self.0.heap_size_bytes() diff --git a/crates/store/re_types/src/blueprint/components/space_view_class_ext.rs b/crates/store/re_types/src/blueprint/components/view_class_ext.rs similarity index 55% rename from crates/store/re_types/src/blueprint/components/space_view_class_ext.rs rename to crates/store/re_types/src/blueprint/components/view_class_ext.rs index 6ffb350e5db3..add7b13ae123 100644 --- a/crates/store/re_types/src/blueprint/components/space_view_class_ext.rs +++ b/crates/store/re_types/src/blueprint/components/view_class_ext.rs @@ -1,6 +1,6 @@ -use super::SpaceViewClass; +use super::ViewClass; -impl Default for SpaceViewClass { +impl Default for ViewClass { #[inline] fn default() -> Self { "Dataframe".into() diff --git a/crates/store/re_types/src/blueprint/components/space_view_origin.rs b/crates/store/re_types/src/blueprint/components/view_origin.rs similarity index 78% rename from crates/store/re_types/src/blueprint/components/space_view_origin.rs rename to crates/store/re_types/src/blueprint/components/view_origin.rs index 0ed00315987d..09d16f92615d 100644 --- a/crates/store/re_types/src/blueprint/components/space_view_origin.rs +++ b/crates/store/re_types/src/blueprint/components/view_origin.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/space_view_origin.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/view_origin.fbs". #![allow(unused_imports)] #![allow(unused_parens)] @@ -18,21 +18,21 @@ use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; -/// **Component**: The origin of a `SpaceView`. +/// **Component**: The origin of a view. #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] #[repr(transparent)] -pub struct SpaceViewOrigin(pub crate::datatypes::EntityPath); +pub struct ViewOrigin(pub crate::datatypes::EntityPath); -impl ::re_types_core::Component for SpaceViewOrigin { +impl ::re_types_core::Component for ViewOrigin { #[inline] fn descriptor() -> ComponentDescriptor { - ComponentDescriptor::new("rerun.blueprint.components.SpaceViewOrigin") + ComponentDescriptor::new("rerun.blueprint.components.ViewOrigin") } } -::re_types_core::macros::impl_into_cow!(SpaceViewOrigin); +::re_types_core::macros::impl_into_cow!(ViewOrigin); -impl ::re_types_core::Loggable for SpaceViewOrigin { +impl ::re_types_core::Loggable for ViewOrigin { #[inline] fn arrow_datatype() -> arrow::datatypes::DataType { crate::datatypes::EntityPath::arrow_datatype() @@ -63,20 +63,20 @@ impl ::re_types_core::Loggable for SpaceViewOrigin { } } -impl> From for SpaceViewOrigin { +impl> From for ViewOrigin { fn from(v: T) -> Self { Self(v.into()) } } -impl std::borrow::Borrow for SpaceViewOrigin { +impl std::borrow::Borrow for ViewOrigin { #[inline] fn borrow(&self) -> &crate::datatypes::EntityPath { &self.0 } } -impl std::ops::Deref for SpaceViewOrigin { +impl std::ops::Deref for ViewOrigin { type Target = crate::datatypes::EntityPath; #[inline] @@ -85,14 +85,14 @@ impl std::ops::Deref for SpaceViewOrigin { } } -impl std::ops::DerefMut for SpaceViewOrigin { +impl std::ops::DerefMut for ViewOrigin { #[inline] fn deref_mut(&mut self) -> &mut crate::datatypes::EntityPath { &mut self.0 } } -impl ::re_types_core::SizeBytes for SpaceViewOrigin { +impl ::re_types_core::SizeBytes for ViewOrigin { #[inline] fn heap_size_bytes(&self) -> u64 { self.0.heap_size_bytes() diff --git a/crates/store/re_types/src/blueprint/components/space_view_origin_ext.rs b/crates/store/re_types/src/blueprint/components/view_origin_ext.rs similarity index 69% rename from crates/store/re_types/src/blueprint/components/space_view_origin_ext.rs rename to crates/store/re_types/src/blueprint/components/view_origin_ext.rs index 93b95ff95756..f8d81c965504 100644 --- a/crates/store/re_types/src/blueprint/components/space_view_origin_ext.rs +++ b/crates/store/re_types/src/blueprint/components/view_origin_ext.rs @@ -1,8 +1,8 @@ use re_types_core::datatypes::EntityPath; -use super::SpaceViewOrigin; +use super::ViewOrigin; -impl Default for SpaceViewOrigin { +impl Default for ViewOrigin { #[inline] fn default() -> Self { Self(EntityPath("/*".to_owned().into())) diff --git a/crates/store/re_types/src/blueprint/views/bar_chart_view.rs b/crates/store/re_types/src/blueprint/views/bar_chart_view.rs index bf2cd5259b88..6bee621d477e 100644 --- a/crates/store/re_types/src/blueprint/views/bar_chart_view.rs +++ b/crates/store/re_types/src/blueprint/views/bar_chart_view.rs @@ -27,7 +27,7 @@ pub struct BarChartView { impl ::re_types_core::View for BarChartView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { "BarChart".into() } } diff --git a/crates/store/re_types/src/blueprint/views/dataframe_view.rs b/crates/store/re_types/src/blueprint/views/dataframe_view.rs index 003644526a97..0c2cb2b288ba 100644 --- a/crates/store/re_types/src/blueprint/views/dataframe_view.rs +++ b/crates/store/re_types/src/blueprint/views/dataframe_view.rs @@ -29,7 +29,7 @@ pub struct DataframeView { impl ::re_types_core::View for DataframeView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { "Dataframe".into() } } diff --git a/crates/store/re_types/src/blueprint/views/graph_view.rs b/crates/store/re_types/src/blueprint/views/graph_view.rs index 74e6771dc9b2..3ff1d79abf64 100644 --- a/crates/store/re_types/src/blueprint/views/graph_view.rs +++ b/crates/store/re_types/src/blueprint/views/graph_view.rs @@ -44,7 +44,7 @@ pub struct GraphView { impl ::re_types_core::View for GraphView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { "Graph".into() } } diff --git a/crates/store/re_types/src/blueprint/views/map_view.rs b/crates/store/re_types/src/blueprint/views/map_view.rs index 35987298e3b9..749234094780 100644 --- a/crates/store/re_types/src/blueprint/views/map_view.rs +++ b/crates/store/re_types/src/blueprint/views/map_view.rs @@ -30,7 +30,7 @@ pub struct MapView { impl ::re_types_core::View for MapView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { "Map".into() } } diff --git a/crates/store/re_types/src/blueprint/views/spatial2d_view.rs b/crates/store/re_types/src/blueprint/views/spatial2d_view.rs index 2e416e460697..68dce6e28e47 100644 --- a/crates/store/re_types/src/blueprint/views/spatial2d_view.rs +++ b/crates/store/re_types/src/blueprint/views/spatial2d_view.rs @@ -39,7 +39,7 @@ pub struct Spatial2DView { impl ::re_types_core::View for Spatial2DView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { "2D".into() } } diff --git a/crates/store/re_types/src/blueprint/views/spatial3d_view.rs b/crates/store/re_types/src/blueprint/views/spatial3d_view.rs index fd07c068bfda..8f562935cf37 100644 --- a/crates/store/re_types/src/blueprint/views/spatial3d_view.rs +++ b/crates/store/re_types/src/blueprint/views/spatial3d_view.rs @@ -36,7 +36,7 @@ pub struct Spatial3DView { impl ::re_types_core::View for Spatial3DView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { "3D".into() } } diff --git a/crates/store/re_types/src/blueprint/views/tensor_view.rs b/crates/store/re_types/src/blueprint/views/tensor_view.rs index f9b502c012e6..efdf00a55232 100644 --- a/crates/store/re_types/src/blueprint/views/tensor_view.rs +++ b/crates/store/re_types/src/blueprint/views/tensor_view.rs @@ -33,7 +33,7 @@ pub struct TensorView { impl ::re_types_core::View for TensorView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { "Tensor".into() } } diff --git a/crates/store/re_types/src/blueprint/views/text_document_view.rs b/crates/store/re_types/src/blueprint/views/text_document_view.rs index 532f3b91342e..ef82928a58c9 100644 --- a/crates/store/re_types/src/blueprint/views/text_document_view.rs +++ b/crates/store/re_types/src/blueprint/views/text_document_view.rs @@ -24,7 +24,7 @@ pub struct TextDocumentView {} impl ::re_types_core::View for TextDocumentView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { "TextDocument".into() } } diff --git a/crates/store/re_types/src/blueprint/views/text_log_view.rs b/crates/store/re_types/src/blueprint/views/text_log_view.rs index d60a97a04f4d..044b5f916b52 100644 --- a/crates/store/re_types/src/blueprint/views/text_log_view.rs +++ b/crates/store/re_types/src/blueprint/views/text_log_view.rs @@ -24,7 +24,7 @@ pub struct TextLogView {} impl ::re_types_core::View for TextLogView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { "TextLog".into() } } diff --git a/crates/store/re_types/src/blueprint/views/time_series_view.rs b/crates/store/re_types/src/blueprint/views/time_series_view.rs index c1d113c5f0af..fc81295ba79e 100644 --- a/crates/store/re_types/src/blueprint/views/time_series_view.rs +++ b/crates/store/re_types/src/blueprint/views/time_series_view.rs @@ -36,7 +36,7 @@ pub struct TimeSeriesView { impl ::re_types_core::View for TimeSeriesView { #[inline] - fn identifier() -> ::re_types_core::SpaceViewClassIdentifier { + fn identifier() -> ::re_types_core::ViewClassIdentifier { "TimeSeries".into() } } diff --git a/crates/store/re_types/src/components/disconnected_space.rs b/crates/store/re_types/src/components/disconnected_space.rs index 7ecdbb599ce9..0b890cf60318 100644 --- a/crates/store/re_types/src/components/disconnected_space.rs +++ b/crates/store/re_types/src/components/disconnected_space.rs @@ -22,7 +22,7 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, /// making it impossible to transform the entity path into its parent's space and vice versa. -/// It *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views. +/// It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. /// This is useful for specifying that a subgraph is independent of the rest of the scene. #[derive(Clone, Debug, Copy, PartialEq, Eq)] pub struct DisconnectedSpace( diff --git a/crates/store/re_types/src/lib.rs b/crates/store/re_types/src/lib.rs index aa1fd5999373..f6e07a7d97f0 100644 --- a/crates/store/re_types/src/lib.rs +++ b/crates/store/re_types/src/lib.rs @@ -3,7 +3,7 @@ //! This crate contains both the IDL definitions for Rerun types (flatbuffers) as well as the code //! generated from those using `re_types_builder`. //! -//! All builtin archetypes, components, datatypes and space view definitions can be found in their +//! All builtin archetypes, components, datatypes and view definitions can be found in their //! respective top-level modules. //! //! ## Contributing diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs b/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs index c7327f7eb3d2..2971a46e1150 100644 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs +++ b/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs @@ -27,7 +27,7 @@ pub struct ContainerBlueprint { /// The name of the container. pub display_name: Option, - /// `ContainerId`s or `SpaceViewId`s that are children of this container. + /// `ContainerId`s or `ViewId`s that are children of this container. pub contents: Option>, /// The layout shares of each column in the container. @@ -468,7 +468,7 @@ impl ContainerBlueprint { self } - /// `ContainerId`s or `SpaceViewId`s that are children of this container. + /// `ContainerId`s or `ViewId`s that are children of this container. #[inline] pub fn with_contents( mut self, diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs b/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs index 0f70ecad33dc..5c75fa92e887 100644 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs +++ b/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs @@ -21,31 +21,31 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: The top-level description of the viewport. #[derive(Clone, Debug, Default)] pub struct ViewportBlueprint { - /// The layout of the space-views + /// The layout of the views pub root_container: Option, /// Show one tab as maximized? - pub maximized: Option, + pub maximized: Option, /// Whether the viewport layout is determined automatically. /// - /// If `true`, the container layout will be reset whenever a new space view is added or removed. + /// If `true`, the container layout will be reset whenever a new view is added or removed. /// This defaults to `false` and is automatically set to `false` when there is user determined layout. pub auto_layout: Option, - /// Whether or not space views should be created automatically. + /// Whether or not views should be created automatically. /// - /// If `true`, the viewer will only add space views that it hasn't considered previously (as identified by `past_viewer_recommendations`) - /// and which aren't deemed redundant to existing space views. - /// This defaults to `false` and is automatically set to `false` when the user adds space views manually in the viewer. - pub auto_space_views: Option, + /// If `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`) + /// and which aren't deemed redundant to existing views. + /// This defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer. + pub auto_views: Option, - /// Hashes of all recommended space views the viewer has already added and that should not be added again. + /// Hashes of all recommended views the viewer has already added and that should not be added again. /// /// This is an internal field and should not be set usually. - /// If you want the viewer from stopping to add space views, you should set `auto_space_views` to `false`. + /// If you want the viewer from stopping to add views, you should set `auto_views` to `false`. /// - /// The viewer uses this to determine whether it should keep adding space views. + /// The viewer uses this to determine whether it should keep adding views. pub past_viewer_recommendations: Option>, } @@ -72,7 +72,7 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), - component_name: "rerun.blueprint.components.SpaceViewMaximized".into(), + component_name: "rerun.blueprint.components.ViewMaximized".into(), archetype_field_name: Some("maximized".into()), }, ComponentDescriptor { @@ -82,8 +82,8 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 5usize]> }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), - component_name: "rerun.blueprint.components.AutoSpaceViews".into(), - archetype_field_name: Some("auto_space_views".into()), + component_name: "rerun.blueprint.components.AutoViews".into(), + archetype_field_name: Some("auto_views".into()), }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), @@ -108,7 +108,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), - component_name: "rerun.blueprint.components.SpaceViewMaximized".into(), + component_name: "rerun.blueprint.components.ViewMaximized".into(), archetype_field_name: Some("maximized".into()), }, ComponentDescriptor { @@ -118,8 +118,8 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 6usize]> = }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), - component_name: "rerun.blueprint.components.AutoSpaceViews".into(), - archetype_field_name: Some("auto_space_views".into()), + component_name: "rerun.blueprint.components.AutoViews".into(), + archetype_field_name: Some("auto_views".into()), }, ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), @@ -196,17 +196,16 @@ impl ::re_types_core::Archetype for ViewportBlueprint { } else { None }; - let maximized = if let Some(array) = - arrays_by_name.get("rerun.blueprint.components.SpaceViewMaximized") - { - ::from_arrow2_opt(&**array) - .with_context("rerun.blueprint.archetypes.ViewportBlueprint#maximized")? - .into_iter() - .next() - .flatten() - } else { - None - }; + let maximized = + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.ViewMaximized") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ViewportBlueprint#maximized")? + .into_iter() + .next() + .flatten() + } else { + None + }; let auto_layout = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.AutoLayout") { ::from_arrow2_opt(&**array) @@ -217,10 +216,10 @@ impl ::re_types_core::Archetype for ViewportBlueprint { } else { None }; - let auto_space_views = - if let Some(array) = arrays_by_name.get("rerun.blueprint.components.AutoSpaceViews") { - ::from_arrow2_opt(&**array) - .with_context("rerun.blueprint.archetypes.ViewportBlueprint#auto_space_views")? + let auto_views = + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.AutoViews") { + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.ViewportBlueprint#auto_views")? .into_iter() .next() .flatten() @@ -249,7 +248,7 @@ impl ::re_types_core::Archetype for ViewportBlueprint { root_container, maximized, auto_layout, - auto_space_views, + auto_views, past_viewer_recommendations, }) } @@ -282,7 +281,7 @@ impl ::re_types_core::AsComponents for ViewportBlueprint { descriptor_override: Some(ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), archetype_field_name: Some(("maximized").into()), - component_name: ("rerun.blueprint.components.SpaceViewMaximized").into(), + component_name: ("rerun.blueprint.components.ViewMaximized").into(), }), }), (self @@ -298,15 +297,15 @@ impl ::re_types_core::AsComponents for ViewportBlueprint { }), }), (self - .auto_space_views + .auto_views .as_ref() .map(|comp| (comp as &dyn ComponentBatch))) .map(|batch| ::re_types_core::ComponentBatchCowWithDescriptor { batch: batch.into(), descriptor_override: Some(ComponentDescriptor { archetype_name: Some("rerun.blueprint.archetypes.ViewportBlueprint".into()), - archetype_field_name: Some(("auto_space_views").into()), - component_name: ("rerun.blueprint.components.AutoSpaceViews").into(), + archetype_field_name: Some(("auto_views").into()), + component_name: ("rerun.blueprint.components.AutoViews").into(), }), }), (self @@ -338,12 +337,12 @@ impl ViewportBlueprint { root_container: None, maximized: None, auto_layout: None, - auto_space_views: None, + auto_views: None, past_viewer_recommendations: None, } } - /// The layout of the space-views + /// The layout of the views #[inline] pub fn with_root_container( mut self, @@ -357,7 +356,7 @@ impl ViewportBlueprint { #[inline] pub fn with_maximized( mut self, - maximized: impl Into, + maximized: impl Into, ) -> Self { self.maximized = Some(maximized.into()); self @@ -365,7 +364,7 @@ impl ViewportBlueprint { /// Whether the viewport layout is determined automatically. /// - /// If `true`, the container layout will be reset whenever a new space view is added or removed. + /// If `true`, the container layout will be reset whenever a new view is added or removed. /// This defaults to `false` and is automatically set to `false` when there is user determined layout. #[inline] pub fn with_auto_layout( @@ -376,26 +375,26 @@ impl ViewportBlueprint { self } - /// Whether or not space views should be created automatically. + /// Whether or not views should be created automatically. /// - /// If `true`, the viewer will only add space views that it hasn't considered previously (as identified by `past_viewer_recommendations`) - /// and which aren't deemed redundant to existing space views. - /// This defaults to `false` and is automatically set to `false` when the user adds space views manually in the viewer. + /// If `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`) + /// and which aren't deemed redundant to existing views. + /// This defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer. #[inline] - pub fn with_auto_space_views( + pub fn with_auto_views( mut self, - auto_space_views: impl Into, + auto_views: impl Into, ) -> Self { - self.auto_space_views = Some(auto_space_views.into()); + self.auto_views = Some(auto_views.into()); self } - /// Hashes of all recommended space views the viewer has already added and that should not be added again. + /// Hashes of all recommended views the viewer has already added and that should not be added again. /// /// This is an internal field and should not be set usually. - /// If you want the viewer from stopping to add space views, you should set `auto_space_views` to `false`. + /// If you want the viewer from stopping to add views, you should set `auto_views` to `false`. /// - /// The viewer uses this to determine whether it should keep adding space views. + /// The viewer uses this to determine whether it should keep adding views. #[inline] pub fn with_past_viewer_recommendations( mut self, @@ -419,16 +418,16 @@ impl ::re_types_core::SizeBytes for ViewportBlueprint { self.root_container.heap_size_bytes() + self.maximized.heap_size_bytes() + self.auto_layout.heap_size_bytes() - + self.auto_space_views.heap_size_bytes() + + self.auto_views.heap_size_bytes() + self.past_viewer_recommendations.heap_size_bytes() } #[inline] fn is_pod() -> bool { >::is_pod() - && >::is_pod() + && >::is_pod() && >::is_pod() - && >::is_pod() + && >::is_pod() && >>::is_pod() } } diff --git a/crates/store/re_types_blueprint/src/blueprint/components/.gitattributes b/crates/store/re_types_blueprint/src/blueprint/components/.gitattributes index 85c73e519ba2..2978e26ea33d 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/.gitattributes +++ b/crates/store/re_types_blueprint/src/blueprint/components/.gitattributes @@ -2,10 +2,10 @@ .gitattributes linguist-generated=true auto_layout.rs linguist-generated=true -auto_space_views.rs linguist-generated=true +auto_views.rs linguist-generated=true container_kind.rs linguist-generated=true grid_columns.rs linguist-generated=true mod.rs linguist-generated=true root_container.rs linguist-generated=true -space_view_maximized.rs linguist-generated=true +view_maximized.rs linguist-generated=true visualizer_overrides.rs linguist-generated=true diff --git a/crates/store/re_types_blueprint/src/blueprint/components/auto_space_views.rs b/crates/store/re_types_blueprint/src/blueprint/components/auto_views.rs similarity index 80% rename from crates/store/re_types_blueprint/src/blueprint/components/auto_space_views.rs rename to crates/store/re_types_blueprint/src/blueprint/components/auto_views.rs index 257c5c5fd4b2..a25155016fc0 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/auto_space_views.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/auto_views.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/auto_views.fbs". #![allow(unused_imports)] #![allow(unused_parens)] @@ -18,21 +18,21 @@ use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; -/// **Component**: Whether or not space views should be created automatically. +/// **Component**: Whether or not views should be created automatically. #[derive(Clone, Debug, Copy, Default, PartialEq, Eq, PartialOrd, Ord)] #[repr(transparent)] -pub struct AutoSpaceViews(pub crate::datatypes::Bool); +pub struct AutoViews(pub crate::datatypes::Bool); -impl ::re_types_core::Component for AutoSpaceViews { +impl ::re_types_core::Component for AutoViews { #[inline] fn descriptor() -> ComponentDescriptor { - ComponentDescriptor::new("rerun.blueprint.components.AutoSpaceViews") + ComponentDescriptor::new("rerun.blueprint.components.AutoViews") } } -::re_types_core::macros::impl_into_cow!(AutoSpaceViews); +::re_types_core::macros::impl_into_cow!(AutoViews); -impl ::re_types_core::Loggable for AutoSpaceViews { +impl ::re_types_core::Loggable for AutoViews { #[inline] fn arrow_datatype() -> arrow::datatypes::DataType { crate::datatypes::Bool::arrow_datatype() @@ -63,20 +63,20 @@ impl ::re_types_core::Loggable for AutoSpaceViews { } } -impl> From for AutoSpaceViews { +impl> From for AutoViews { fn from(v: T) -> Self { Self(v.into()) } } -impl std::borrow::Borrow for AutoSpaceViews { +impl std::borrow::Borrow for AutoViews { #[inline] fn borrow(&self) -> &crate::datatypes::Bool { &self.0 } } -impl std::ops::Deref for AutoSpaceViews { +impl std::ops::Deref for AutoViews { type Target = crate::datatypes::Bool; #[inline] @@ -85,14 +85,14 @@ impl std::ops::Deref for AutoSpaceViews { } } -impl std::ops::DerefMut for AutoSpaceViews { +impl std::ops::DerefMut for AutoViews { #[inline] fn deref_mut(&mut self) -> &mut crate::datatypes::Bool { &mut self.0 } } -impl ::re_types_core::SizeBytes for AutoSpaceViews { +impl ::re_types_core::SizeBytes for AutoViews { #[inline] fn heap_size_bytes(&self) -> u64 { self.0.heap_size_bytes() diff --git a/crates/store/re_types_blueprint/src/blueprint/components/mod.rs b/crates/store/re_types_blueprint/src/blueprint/components/mod.rs index c3cd0cfcc6bf..dfb9de45eef6 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/mod.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/mod.rs @@ -2,17 +2,17 @@ mod auto_layout; mod auto_layout_ext; -mod auto_space_views; +mod auto_views; mod container_kind; mod grid_columns; mod root_container; -mod space_view_maximized; +mod view_maximized; mod visualizer_overrides; pub use self::auto_layout::AutoLayout; -pub use self::auto_space_views::AutoSpaceViews; +pub use self::auto_views::AutoViews; pub use self::container_kind::ContainerKind; pub use self::grid_columns::GridColumns; pub use self::root_container::RootContainer; -pub use self::space_view_maximized::SpaceViewMaximized; +pub use self::view_maximized::ViewMaximized; pub use self::visualizer_overrides::VisualizerOverrides; diff --git a/crates/store/re_types_blueprint/src/blueprint/components/space_view_maximized.rs b/crates/store/re_types_blueprint/src/blueprint/components/view_maximized.rs similarity index 79% rename from crates/store/re_types_blueprint/src/blueprint/components/space_view_maximized.rs rename to crates/store/re_types_blueprint/src/blueprint/components/view_maximized.rs index fe57894abe93..27214db2194d 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/space_view_maximized.rs +++ b/crates/store/re_types_blueprint/src/blueprint/components/view_maximized.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/view_maximized.fbs". #![allow(unused_imports)] #![allow(unused_parens)] @@ -18,21 +18,21 @@ use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; use ::re_types_core::{ComponentDescriptor, ComponentName}; use ::re_types_core::{DeserializationError, DeserializationResult}; -/// **Component**: Whether a space view is maximized. +/// **Component**: Whether a view is maximized. #[derive(Clone, Debug, Default)] #[repr(transparent)] -pub struct SpaceViewMaximized(pub crate::datatypes::Uuid); +pub struct ViewMaximized(pub crate::datatypes::Uuid); -impl ::re_types_core::Component for SpaceViewMaximized { +impl ::re_types_core::Component for ViewMaximized { #[inline] fn descriptor() -> ComponentDescriptor { - ComponentDescriptor::new("rerun.blueprint.components.SpaceViewMaximized") + ComponentDescriptor::new("rerun.blueprint.components.ViewMaximized") } } -::re_types_core::macros::impl_into_cow!(SpaceViewMaximized); +::re_types_core::macros::impl_into_cow!(ViewMaximized); -impl ::re_types_core::Loggable for SpaceViewMaximized { +impl ::re_types_core::Loggable for ViewMaximized { #[inline] fn arrow_datatype() -> arrow::datatypes::DataType { crate::datatypes::Uuid::arrow_datatype() @@ -71,20 +71,20 @@ impl ::re_types_core::Loggable for SpaceViewMaximized { } } -impl> From for SpaceViewMaximized { +impl> From for ViewMaximized { fn from(v: T) -> Self { Self(v.into()) } } -impl std::borrow::Borrow for SpaceViewMaximized { +impl std::borrow::Borrow for ViewMaximized { #[inline] fn borrow(&self) -> &crate::datatypes::Uuid { &self.0 } } -impl std::ops::Deref for SpaceViewMaximized { +impl std::ops::Deref for ViewMaximized { type Target = crate::datatypes::Uuid; #[inline] @@ -93,14 +93,14 @@ impl std::ops::Deref for SpaceViewMaximized { } } -impl std::ops::DerefMut for SpaceViewMaximized { +impl std::ops::DerefMut for ViewMaximized { #[inline] fn deref_mut(&mut self) -> &mut crate::datatypes::Uuid { &mut self.0 } } -impl ::re_types_core::SizeBytes for SpaceViewMaximized { +impl ::re_types_core::SizeBytes for ViewMaximized { #[inline] fn heap_size_bytes(&self) -> u64 { self.0.heap_size_bytes() diff --git a/crates/store/re_types_core/src/lib.rs b/crates/store/re_types_core/src/lib.rs index f6deee691390..27a13bc63224 100644 --- a/crates/store/re_types_core/src/lib.rs +++ b/crates/store/re_types_core/src/lib.rs @@ -162,7 +162,7 @@ pub use self::{ SerializationResult, _Backtrace, }, size_bytes::SizeBytes, - view::{SpaceViewClassIdentifier, View}, + view::{View, ViewClassIdentifier}, }; /// Fundamental [`Archetype`]s that are implemented in `re_types_core` directly for convenience and diff --git a/crates/store/re_types_core/src/view.rs b/crates/store/re_types_core/src/view.rs index 11613fe150d5..eea465d27249 100644 --- a/crates/store/re_types_core/src/view.rs +++ b/crates/store/re_types_core/src/view.rs @@ -1,10 +1,10 @@ // --- re_string_interner::declare_new_type!( - /// The unique name of a space view type. - pub struct SpaceViewClassIdentifier; + /// The unique name of a view + pub struct ViewClassIdentifier; ); -impl SpaceViewClassIdentifier { +impl ViewClassIdentifier { pub fn invalid() -> Self { Self::from("invalid") } @@ -13,9 +13,9 @@ impl SpaceViewClassIdentifier { /// Views are the panels shown in the viewer's viewport and the primary means of /// inspecting & visualizing previously logged data. /// -/// In addition to the data that it contains via `SpaceViewContents`, each view +/// In addition to the data that it contains via `ViewContents`, each view /// has several view properties that configure how it behaves. Each view property /// is a [`crate::Archetype`] that is stored in the viewer's blueprint database. pub trait View { - fn identifier() -> SpaceViewClassIdentifier; + fn identifier() -> ViewClassIdentifier; } diff --git a/crates/top/re_sdk/src/log_sink.rs b/crates/top/re_sdk/src/log_sink.rs index e89732dcbf2b..98599642aaad 100644 --- a/crates/top/re_sdk/src/log_sink.rs +++ b/crates/top/re_sdk/src/log_sink.rs @@ -56,7 +56,7 @@ pub trait LogSink: Send + Sync + 'static { // Let the viewer know that the blueprint has been fully received, // and that it can now be activated. // We don't want to activate half-loaded blueprints, because that can be confusing, - // and can also lead to problems with space-view heuristics. + // and can also lead to problems with view heuristics. self.send(activation_cmd.into()); } else { re_log::warn!( diff --git a/crates/top/re_sdk/src/recording_stream.rs b/crates/top/re_sdk/src/recording_stream.rs index c582d24fdd9f..68203be223a5 100644 --- a/crates/top/re_sdk/src/recording_stream.rs +++ b/crates/top/re_sdk/src/recording_stream.rs @@ -1956,7 +1956,7 @@ impl RecordingStream { // Let the viewer know that the blueprint has been fully received, // and that it can now be activated. // We don't want to activate half-loaded blueprints, because that can be confusing, - // and can also lead to problems with space-view heuristics. + // and can also lead to problems with view heuristics. self.record_msg(activation_cmd.into()); } else { re_log::warn!( diff --git a/crates/viewer/re_blueprint_tree/src/blueprint_tree.rs b/crates/viewer/re_blueprint_tree/src/blueprint_tree.rs index b6ea2ae356d4..434ab4795640 100644 --- a/crates/viewer/re_blueprint_tree/src/blueprint_tree.rs +++ b/crates/viewer/re_blueprint_tree/src/blueprint_tree.rs @@ -13,10 +13,10 @@ use re_viewer_context::{ SystemCommandSender, }; use re_viewer_context::{ - ContainerId, DataQueryResult, DataResultNode, HoverHighlight, Item, SpaceViewId, ViewerContext, + ContainerId, DataQueryResult, DataResultNode, HoverHighlight, Item, ViewId, ViewerContext, }; -use re_viewport_blueprint::ui::show_add_space_view_or_container_modal; -use re_viewport_blueprint::{SpaceViewBlueprint, ViewportBlueprint}; +use re_viewport_blueprint::ui::show_add_view_or_container_modal; +use re_viewport_blueprint::{ViewBlueprint, ViewportBlueprint}; /// Holds the state of the blueprint tree UI. #[derive(Default)] @@ -53,7 +53,7 @@ impl BlueprintTree { "Blueprint", Some("The blueprint is where you can configure the Rerun Viewer"), |ui| { - self.add_new_spaceview_button_ui(ctx, viewport, ui); + self.add_new_view_button_ui(ctx, viewport, ui); reset_blueprint_button_ui(ctx, ui); }, ); @@ -121,7 +121,7 @@ impl BlueprintTree { } } - /// If a group or spaceview has a total of this number of elements, show its subtree by default? + /// If a group or view has a total of this number of elements, show its subtree by default? fn default_open_for_data_result(group: &DataResultNode) -> bool { let num_children = group.children.len(); 2 <= num_children && num_children <= 3 @@ -139,8 +139,8 @@ impl BlueprintTree { Contents::Container(container_id) => { self.container_tree_ui(ctx, viewport, ui, container_id, parent_visible); } - Contents::SpaceView(space_view_id) => { - self.space_view_entry_ui(ctx, viewport, ui, space_view_id, parent_visible); + Contents::View(view_id) => { + self.view_entry_ui(ctx, viewport, ui, view_id, parent_visible); } }; } @@ -284,49 +284,49 @@ impl BlueprintTree { ); } - fn space_view_entry_ui( + fn view_entry_ui( &mut self, ctx: &ViewerContext<'_>, viewport: &ViewportBlueprint, ui: &mut egui::Ui, - space_view_id: &SpaceViewId, + view_id: &ViewId, container_visible: bool, ) { - let Some(space_view) = viewport.view(space_view_id) else { - re_log::warn_once!("Bug: asked to show a UI for a space view that doesn't exist"); + let Some(view) = viewport.view(view_id) else { + re_log::warn_once!("Bug: asked to show a UI for a view that doesn't exist"); return; }; - debug_assert_eq!(space_view.id, *space_view_id); + debug_assert_eq!(view.id, *view_id); - let query_result = ctx.lookup_query_result(space_view.id); + let query_result = ctx.lookup_query_result(view.id); let result_tree = &query_result.tree; - let mut visible = space_view.visible; - let space_view_visible = visible && container_visible; - let item = Item::SpaceView(space_view.id); + let mut visible = view.visible; + let view_visible = visible && container_visible; + let item = Item::View(view.id); let root_node = result_tree.root_node(); - // empty space views should display as open by default to highlight the fact that they are empty + // empty views should display as open by default to highlight the fact that they are empty let default_open = root_node.map_or(true, Self::default_open_for_data_result); let is_item_hovered = ctx.selection_state().highlight_for_ui_element(&item) == HoverHighlight::Hovered; - let class = &space_view.class(ctx.space_view_class_registry); - let space_view_name = space_view.display_name_or_default(); + let class = &view.class(ctx.view_class_registry); + let view_name = view.display_name_or_default(); - let item_content = list_item::LabelContent::new(space_view_name.as_ref()) - .label_style(contents_name_style(&space_view_name)) + let item_content = list_item::LabelContent::new(view_name.as_ref()) + .label_style(contents_name_style(&view_name)) .with_icon(class.icon()) - .subdued(!space_view_visible) + .subdued(!view_visible) .with_buttons(|ui| { let vis_response = visibility_button_ui(ui, container_visible, &mut visible); - let response = remove_button_ui(ui, "Remove space view from the viewport"); + let response = remove_button_ui(ui, "Remove view from the viewport"); if response.clicked() { viewport.mark_user_interaction(ctx); - viewport.remove_contents(Contents::SpaceView(*space_view_id)); + viewport.remove_contents(Contents::View(*view_id)); } response | vis_response @@ -334,7 +334,7 @@ impl BlueprintTree { // Globally unique id - should only be one of these in view at one time. // We do this so that we can support "collapse/expand all" command. - let id = egui::Id::new(CollapseScope::BlueprintTree.space_view(*space_view_id)); + let id = egui::Id::new(CollapseScope::BlueprintTree.view(*view_id)); let list_item::ShowCollapsingResponse { item_response: response, @@ -347,14 +347,14 @@ impl BlueprintTree { .force_hovered(is_item_hovered) .show_hierarchical_with_children(ui, id, default_open, item_content, |ui| { // Always show the origin hierarchy first. - self.space_view_entity_hierarchy_ui( + self.view_entity_hierarchy_ui( ctx, viewport, ui, query_result, - &DataResultNodeOrPath::from_path_lookup(result_tree, &space_view.space_origin), - space_view, - space_view_visible, + &DataResultNodeOrPath::from_path_lookup(result_tree, &view.space_origin), + view, + view_visible, false, ); @@ -362,11 +362,7 @@ impl BlueprintTree { // The latter is important since `+ image/camera/**` necessarily has `image` and `image/camera` in the data result tree. let mut projections = Vec::new(); result_tree.visit(&mut |node| { - if node - .data_result - .entity_path - .starts_with(&space_view.space_origin) - { + if node.data_result.entity_path.starts_with(&view.space_origin) { false // If it's under the origin, we're not interested, stop recursing. } else if node.data_result.tree_prefix_only { true // Keep recursing until we find a projection. @@ -382,14 +378,14 @@ impl BlueprintTree { ); for projection in projections { - self.space_view_entity_hierarchy_ui( + self.view_entity_hierarchy_ui( ctx, viewport, ui, query_result, &DataResultNodeOrPath::DataResultNode(projection), - space_view, - space_view_visible, + view, + view_visible, true, ); } @@ -399,7 +395,7 @@ impl BlueprintTree { let response = response.on_hover_text(format!("{} view", class.display_name())); if response.clicked() { - viewport.focus_tab(space_view.id); + viewport.focus_tab(view.id); } context_menu_ui_for_item( @@ -412,7 +408,7 @@ impl BlueprintTree { self.scroll_to_me_if_needed(ui, &item, &response); ctx.select_hovered_on_click(&response, item); - let content = Contents::SpaceView(*space_view_id); + let content = Contents::View(*view_id); viewport.set_content_visibility(ctx, &content, visible); self.handle_drag_and_drop_interaction( @@ -426,20 +422,20 @@ impl BlueprintTree { } #[allow(clippy::too_many_arguments)] - fn space_view_entity_hierarchy_ui( + fn view_entity_hierarchy_ui( &self, ctx: &ViewerContext<'_>, viewport: &ViewportBlueprint, ui: &mut egui::Ui, query_result: &DataQueryResult, node_or_path: &DataResultNodeOrPath<'_>, - space_view: &SpaceViewBlueprint, - space_view_visible: bool, + view: &ViewBlueprint, + view_visible: bool, projection_mode: bool, ) { let entity_path = node_or_path.path(); - if projection_mode && entity_path == &space_view.space_origin { + if projection_mode && entity_path == &view.space_origin { if ui .list_item() .show_hierarchical( @@ -450,13 +446,13 @@ impl BlueprintTree { .with_icon(&re_ui::icons::INTERNAL_LINK), ) .on_hover_text( - "This subtree corresponds to the Space View's origin, and is displayed above \ + "This subtree corresponds to the View's origin, and is displayed above \ the 'Projections' section. Click to select it.", ) .clicked() { ctx.selection_state().set_selection(Item::DataResult( - space_view.id, + view.id, InstancePath::entity_all(entity_path.clone()), )); } @@ -465,13 +461,13 @@ impl BlueprintTree { let data_result_node = node_or_path.data_result_node(); - let item = Item::DataResult(space_view.id, entity_path.clone().into()); + let item = Item::DataResult(view.id, entity_path.clone().into()); let is_selected = ctx.selection().contains_item(&item); let is_item_hovered = ctx.selection_state().highlight_for_ui_element(&item) == HoverHighlight::Hovered; let visible = data_result_node.map_or(false, |n| n.data_result.is_visible(ctx)); - let empty_origin = entity_path == &space_view.space_origin && data_result_node.is_none(); + let empty_origin = entity_path == &view.space_origin && data_result_node.is_none(); let item_label = if entity_path.is_root() { "/ (root)".to_owned() @@ -487,7 +483,7 @@ impl BlueprintTree { ui.ctx().warning_text(item_label) }; - let subdued = !space_view_visible || !visible; + let subdued = !view_visible || !visible; let mut item_content = list_item::LabelContent::new(item_label) .with_icon(guess_instance_path_icon( @@ -506,7 +502,7 @@ impl BlueprintTree { if !empty_origin { item_content = item_content.with_buttons(|ui: &mut egui::Ui| { let mut visible_after = visible; - let vis_response = visibility_button_ui(ui, space_view_visible, &mut visible_after); + let vis_response = visibility_button_ui(ui, view_visible, &mut visible_after); if visible_after != visible { if let Some(data_result_node) = data_result_node { data_result_node @@ -519,13 +515,10 @@ impl BlueprintTree { } } - let response = remove_button_ui( - ui, - "Remove this entity and all its children from the space view", - ); + let response = + remove_button_ui(ui, "Remove this entity and all its children from the view"); if response.clicked() { - space_view - .contents + view.contents .remove_subtree_and_matching_rules(ctx, entity_path.clone()); } @@ -537,13 +530,13 @@ impl BlueprintTree { let has_children = data_result_node.map_or(false, |n| !n.children.is_empty()); let response = if let (true, Some(node)) = (has_children, data_result_node) { // Don't default open projections. - let default_open = entity_path.starts_with(&space_view.space_origin) + let default_open = entity_path.starts_with(&view.space_origin) && Self::default_open_for_data_result(node); // Globally unique id - should only be one of these in view at one time. // We do this so that we can support "collapse/expand all" command. let id = egui::Id::new( - CollapseScope::BlueprintTree.data_result(space_view.id, entity_path.clone()), + CollapseScope::BlueprintTree.data_result(view.id, entity_path.clone()), ); list_item @@ -552,21 +545,21 @@ impl BlueprintTree { query_result .tree .lookup_result(**c) - .map_or(&space_view.space_origin, |c| &c.entity_path) + .map_or(&view.space_origin, |c| &c.entity_path) }) { let Some(child_node) = query_result.tree.lookup_node(*child) else { debug_assert!(false, "DataResultNode {node:?} has an invalid child"); continue; }; - self.space_view_entity_hierarchy_ui( + self.view_entity_hierarchy_ui( ctx, viewport, ui, query_result, &DataResultNodeOrPath::DataResultNode(child_node), - space_view, - space_view_visible, + view, + view_visible, projection_mode, ); } @@ -590,7 +583,7 @@ impl BlueprintTree { if empty_origin { ui.label(ui.ctx().warning_text( - "This space view's query did not match any data under the space origin", + "This view's query did not match any data under the space origin", )); } }); @@ -606,9 +599,9 @@ impl BlueprintTree { ctx.select_hovered_on_click(&response, item); } - /// Add a button to trigger the addition of a new space view or container. + /// Add a button to trigger the addition of a new view or container. #[allow(clippy::unused_self)] - fn add_new_spaceview_button_ui( + fn add_new_view_button_ui( &self, ctx: &ViewerContext<'_>, viewport: &ViewportBlueprint, @@ -616,7 +609,7 @@ impl BlueprintTree { ) { if ui .small_icon_button(&re_ui::icons::ADD) - .on_hover_text("Add a new space view or container") + .on_hover_text("Add a new view or container") .clicked() { // If a single container is selected, we use it as target. Otherwise, we target the @@ -628,7 +621,7 @@ impl BlueprintTree { viewport.root_container }; - show_add_space_view_or_container_modal(target_container_id); + show_add_view_or_container_modal(target_container_id); } } @@ -742,7 +735,7 @@ impl BlueprintTree { parent_id: Contents::Container(parent_container_id), position_index_in_parent, }, - Contents::SpaceView(_) => re_ui::drag_and_drop::ItemKind::Leaf { + Contents::View(_) => re_ui::drag_and_drop::ItemKind::Leaf { parent_id: Contents::Container(parent_container_id), position_index_in_parent, }, @@ -880,7 +873,7 @@ fn reset_blueprint_button_ui(ctx: &ViewerContext<'_>, ui: &mut egui::Ui) { let hover_text = if default_blueprint_id.is_some() { "Reset to the default blueprint for this app" } else { - "Re-populate viewport with automatically chosen space views" + "Re-populate viewport with automatically chosen views" }; response.on_hover_text(hover_text) }; @@ -905,33 +898,27 @@ fn handle_focused_item( expand_all_contents_until(viewport, ui.ctx(), &Contents::Container(*container_id)); Some(focused_item.clone()) } - Item::SpaceView(space_view_id) => { - expand_all_contents_until(viewport, ui.ctx(), &Contents::SpaceView(*space_view_id)); + Item::View(view_id) => { + expand_all_contents_until(viewport, ui.ctx(), &Contents::View(*view_id)); ctx.focused_item.clone() } - Item::DataResult(space_view_id, instance_path) => { - expand_all_contents_until(viewport, ui.ctx(), &Contents::SpaceView(*space_view_id)); - expand_all_data_results_until(ctx, ui.ctx(), space_view_id, &instance_path.entity_path); + Item::DataResult(view_id, instance_path) => { + expand_all_contents_until(viewport, ui.ctx(), &Contents::View(*view_id)); + expand_all_data_results_until(ctx, ui.ctx(), view_id, &instance_path.entity_path); ctx.focused_item.clone() } Item::InstancePath(instance_path) => { - let space_view_ids = - list_space_views_with_entity(ctx, viewport, &instance_path.entity_path); + let view_ids = list_views_with_entity(ctx, viewport, &instance_path.entity_path); // focus on the first matching data result - let res = space_view_ids + let res = view_ids .first() .map(|id| Item::DataResult(*id, instance_path.clone())); - for space_view_id in space_view_ids { - expand_all_contents_until(viewport, ui.ctx(), &Contents::SpaceView(space_view_id)); - expand_all_data_results_until( - ctx, - ui.ctx(), - &space_view_id, - &instance_path.entity_path, - ); + for view_id in view_ids { + expand_all_contents_until(viewport, ui.ctx(), &Contents::View(view_id)); + expand_all_data_results_until(ctx, ui.ctx(), &view_id, &instance_path.entity_path); } res @@ -956,8 +943,8 @@ fn expand_all_contents_until( Contents::Container(container_id) => CollapseScope::BlueprintTree .container(*container_id) .set_open(egui_ctx, true), - Contents::SpaceView(space_view_id) => CollapseScope::BlueprintTree - .space_view(*space_view_id) + Contents::View(view_id) => CollapseScope::BlueprintTree + .view(*view_id) .set_open(egui_ctx, true), }; @@ -971,40 +958,40 @@ fn expand_all_contents_until( }); } -/// List all space views that have the provided entity as data result. +/// List all views that have the provided entity as data result. #[inline] -fn list_space_views_with_entity( +fn list_views_with_entity( ctx: &ViewerContext<'_>, viewport: &ViewportBlueprint, entity_path: &EntityPath, -) -> SmallVec<[SpaceViewId; 4]> { - let mut space_view_ids = SmallVec::new(); +) -> SmallVec<[ViewId; 4]> { + let mut view_ids = SmallVec::new(); viewport.visit_contents(&mut |contents, _| { - if let Contents::SpaceView(space_view_id) = contents { - let result_tree = &ctx.lookup_query_result(*space_view_id).tree; + if let Contents::View(view_id) = contents { + let result_tree = &ctx.lookup_query_result(*view_id).tree; if result_tree.lookup_node_by_path(entity_path).is_some() { - space_view_ids.push(*space_view_id); + view_ids.push(*view_id); } } }); - space_view_ids + view_ids } -/// Expand data results of the provided space view all the way to the provided entity. +/// Expand data results of the provided view all the way to the provided entity. fn expand_all_data_results_until( ctx: &ViewerContext<'_>, egui_ctx: &egui::Context, - space_view_id: &SpaceViewId, + view_id: &ViewId, entity_path: &EntityPath, ) { - let result_tree = &ctx.lookup_query_result(*space_view_id).tree; + let result_tree = &ctx.lookup_query_result(*view_id).tree; if result_tree.lookup_node_by_path(entity_path).is_some() { if let Some(root_node) = result_tree.root_node() { EntityPath::incremental_walk(Some(&root_node.data_result.entity_path), entity_path) .chain(std::iter::once(root_node.data_result.entity_path.clone())) .for_each(|entity_path| { CollapseScope::BlueprintTree - .data_result(*space_view_id, entity_path) + .data_result(*view_id, entity_path) .set_open(egui_ctx, true); }); } diff --git a/crates/viewer/re_component_ui/src/datatype_uis/view_id.rs b/crates/viewer/re_component_ui/src/datatype_uis/view_id.rs index 9248f2bd5731..a82a3f4be50c 100644 --- a/crates/viewer/re_component_ui/src/datatype_uis/view_id.rs +++ b/crates/viewer/re_component_ui/src/datatype_uis/view_id.rs @@ -1,6 +1,6 @@ use re_data_ui::item_ui; use re_types::datatypes::Uuid; -use re_viewer_context::{MaybeMutRef, SpaceViewId}; +use re_viewer_context::{MaybeMutRef, ViewId}; pub fn view_view_id( ctx: &re_viewer_context::ViewerContext<'_>, @@ -16,6 +16,6 @@ fn view_view_id_impl( ui: &mut egui::Ui, value: &Uuid, ) -> egui::Response { - let view = SpaceViewId::from(*value); + let view = ViewId::from(*value); item_ui::blueprint_entity_path_button_to(ctx, ui, &view.as_entity_path(), view.to_string()) } diff --git a/crates/viewer/re_component_ui/src/entity_path.rs b/crates/viewer/re_component_ui/src/entity_path.rs index 4fbd9ec57647..f9f7599fc55b 100644 --- a/crates/viewer/re_component_ui/src/entity_path.rs +++ b/crates/viewer/re_component_ui/src/entity_path.rs @@ -7,7 +7,7 @@ pub(crate) fn edit_or_view_entity_path( path: &mut MaybeMutRef<'_, EntityPath>, ) -> egui::Response { if let Some(path) = path.as_mut() { - // A suggestion mechanism similar to the one in `space_view_space_origin_widget_ui` would be nice. + // A suggestion mechanism similar to the one in `view_space_origin_widget_ui` would be nice. let mut string = path.to_string(); let response = ui.text_edit_singleline(&mut string); *path = string.into(); diff --git a/crates/viewer/re_component_ui/src/lib.rs b/crates/viewer/re_component_ui/src/lib.rs index 3877b6648cff..5150d8ee061d 100644 --- a/crates/viewer/re_component_ui/src/lib.rs +++ b/crates/viewer/re_component_ui/src/lib.rs @@ -47,7 +47,7 @@ use re_types::{ }, Component as _, }; -use re_types_blueprint::blueprint::components::{RootContainer, SpaceViewMaximized}; +use re_types_blueprint::blueprint::components::{RootContainer, ViewMaximized}; use re_viewer_context::gpu_bridge::colormap_edit_or_view_ui; /// Default number of ui points to show a number. @@ -132,7 +132,7 @@ pub fn create_component_ui_registry() -> re_viewer_context::ComponentUiRegistry registry.add_singleline_edit_or_view::(edit_or_view_vec3d); // Components that refer to views: - registry.add_singleline_edit_or_view::(view_view_id); + registry.add_singleline_edit_or_view::(view_view_id); registry.add_singleline_edit_or_view::(view_uuid); diff --git a/crates/viewer/re_component_ui/src/zoom_level.rs b/crates/viewer/re_component_ui/src/zoom_level.rs index 0b086d46dd99..f7ef2cc3450d 100644 --- a/crates/viewer/re_component_ui/src/zoom_level.rs +++ b/crates/viewer/re_component_ui/src/zoom_level.rs @@ -1,7 +1,7 @@ use re_types::blueprint::components::ZoomLevel; use re_viewer_context::MaybeMutRef; -// TODO(#7876): move this to `re_space_view_map` when the crate is no longer behind a Cargo feature. +// TODO(#7876): move this to `re_view_map` when the crate is no longer behind a Cargo feature. // TODO(ab): currently set at 19 because that's what walkers has as hard-coded limit. In the future, // walkers will need to be more flexible (e.g. depend on the actually max zoom level for the map // provider). At that point, we will have to set some kind of "max ever" value here. diff --git a/crates/viewer/re_context_menu/src/actions/add_entities_to_new_space_view.rs b/crates/viewer/re_context_menu/src/actions/add_entities_to_new_view.rs similarity index 58% rename from crates/viewer/re_context_menu/src/actions/add_entities_to_new_space_view.rs rename to crates/viewer/re_context_menu/src/actions/add_entities_to_new_view.rs index baf0faa4c24b..37ffe62d9403 100644 --- a/crates/viewer/re_context_menu/src/actions/add_entities_to_new_space_view.rs +++ b/crates/viewer/re_context_menu/src/actions/add_entities_to_new_view.rs @@ -3,18 +3,18 @@ use itertools::Itertools; use nohash_hasher::IntSet; use re_log_types::{EntityPath, EntityPathFilter, EntityPathRule, RuleEffect}; -use re_types::SpaceViewClassIdentifier; -use re_viewer_context::{Item, RecommendedSpaceView, SpaceViewClassExt as _}; -use re_viewport_blueprint::SpaceViewBlueprint; +use re_types::ViewClassIdentifier; +use re_viewer_context::{Item, RecommendedView, ViewClassExt as _}; +use re_viewport_blueprint::ViewBlueprint; use crate::{ContextMenuAction, ContextMenuContext}; -/// Create a new space view containing the selected entities. +/// Create a new view containing the selected entities. /// -/// The space view is created next to the clicked item's parent view (if a data result was clicked). -pub(crate) struct AddEntitiesToNewSpaceViewAction; +/// The view is created next to the clicked item's parent view (if a data result was clicked). +pub(crate) struct AddEntitiesToNewViewAction; -impl ContextMenuAction for AddEntitiesToNewSpaceViewAction { +impl ContextMenuAction for AddEntitiesToNewViewAction { fn supports_multi_selection(&self, _ctx: &ContextMenuContext<'_>) -> bool { true } @@ -24,58 +24,56 @@ impl ContextMenuAction for AddEntitiesToNewSpaceViewAction { } fn ui(&self, ctx: &ContextMenuContext<'_>, ui: &mut Ui) -> Response { - let space_view_class_registry = ctx.viewer_context.space_view_class_registry; + let view_class_registry = ctx.viewer_context.view_class_registry; - let recommended_space_view_classes = recommended_space_views_for_selection(ctx); - let other_space_view_classes: IntSet<_> = space_view_class_registry + let recommended_view_classes = recommended_views_for_selection(ctx); + let other_view_classes: IntSet<_> = view_class_registry .iter_registry() .map(|entry| entry.identifier) - .collect::>() - .difference(&recommended_space_view_classes) + .collect::>() + .difference(&recommended_view_classes) .copied() .collect(); - ui.menu_button("Add to new space view", |ui| { - let buttons_for_space_view_classes = - |ui: &mut egui::Ui, space_view_classes: &IntSet| { - for (identifier, class) in space_view_classes + ui.menu_button("Add to new view", |ui| { + let buttons_for_view_classes = + |ui: &mut egui::Ui, view_classes: &IntSet| { + for (identifier, class) in view_classes .iter() .map(|identifier| { ( identifier, - space_view_class_registry.get_class_or_log_error(*identifier), + view_class_registry.get_class_or_log_error(*identifier), ) }) .sorted_by_key(|(_, class)| class.display_name().to_owned()) { let btn = egui::Button::image_and_text(class.icon(), class.display_name()); if ui.add(btn).clicked() { - create_space_view_for_selected_entities(ctx, *identifier); + create_view_for_selected_entities(ctx, *identifier); ui.close_menu(); } } }; ui.label(egui::WidgetText::from("Recommended:").italics()); - if recommended_space_view_classes.is_empty() { + if recommended_view_classes.is_empty() { ui.label("None"); } else { - buttons_for_space_view_classes(ui, &recommended_space_view_classes); + buttons_for_view_classes(ui, &recommended_view_classes); } - if !other_space_view_classes.is_empty() { + if !other_view_classes.is_empty() { ui.label(egui::WidgetText::from("Others:").italics()); - buttons_for_space_view_classes(ui, &other_space_view_classes); + buttons_for_view_classes(ui, &other_view_classes); } }) .response } } -/// Builds a list of compatible space views for the provided selection. -fn recommended_space_views_for_selection( - ctx: &ContextMenuContext<'_>, -) -> IntSet { +/// Builds a list of compatible views for the provided selection. +fn recommended_views_for_selection(ctx: &ContextMenuContext<'_>) -> IntSet { re_tracing::profile_function!(); let entities_of_interest = ctx @@ -84,14 +82,14 @@ fn recommended_space_views_for_selection( .filter_map(|(item, _)| item.entity_path().cloned()) .collect::>(); - let mut output: IntSet = IntSet::default(); + let mut output: IntSet = IntSet::default(); - let space_view_class_registry = ctx.viewer_context.space_view_class_registry; + let view_class_registry = ctx.viewer_context.view_class_registry; let recording = ctx.viewer_context.recording(); let applicable_entities_per_visualizer = - space_view_class_registry.applicable_entities_for_visualizer_systems(&recording.store_id()); + view_class_registry.applicable_entities_for_visualizer_systems(&recording.store_id()); - for entry in space_view_class_registry.iter_registry() { + for entry in view_class_registry.iter_registry() { let Some(suggested_root) = entry .class .recommended_root_for_entities(&entities_of_interest, recording) @@ -102,11 +100,11 @@ fn recommended_space_views_for_selection( let visualizable_entities = entry.class.determine_visualizable_entities( &applicable_entities_per_visualizer, recording, - &space_view_class_registry.new_visualizer_collection(entry.identifier), + &view_class_registry.new_visualizer_collection(entry.identifier), &suggested_root, ); - // We consider a space view class to be recommended if all selected entities are + // We consider a view class to be recommended if all selected entities are // "visualizable" with it. By "visualizable" we mean that either the entity itself, or any // of its sub-entities, are visualizable. @@ -127,11 +125,11 @@ fn recommended_space_views_for_selection( output } -/// Creates a space view of the given class, with root set as origin, and a filter set to include all -/// selected entities. Then, the selection is set to the new space view. -fn create_space_view_for_selected_entities( +/// Creates a view of the given class, with root set as origin, and a filter set to include all +/// selected entities. Then, the selection is set to the new view. +fn create_view_for_selected_entities( ctx: &ContextMenuContext<'_>, - identifier: SpaceViewClassIdentifier, + identifier: ViewClassIdentifier, ) { let entities_of_interest = ctx .selection @@ -141,7 +139,7 @@ fn create_space_view_for_selected_entities( let origin = ctx .viewer_context - .space_view_class_registry + .view_class_registry .get_class_or_log_error(identifier) .recommended_root_for_entities(&entities_of_interest, ctx.viewer_context.recording()) .unwrap_or_else(EntityPath::root); @@ -158,18 +156,18 @@ fn create_space_view_for_selected_entities( for path in entities_of_interest { filter.add_rule(RuleEffect::Include, EntityPathRule::including_subtree(path)); } - let recommended = RecommendedSpaceView { + let recommended = RecommendedView { origin, query_filter: filter, }; - let space_view = SpaceViewBlueprint::new(identifier, recommended); - let space_view_id = space_view.id; + let view = ViewBlueprint::new(identifier, recommended); + let view_id = view.id; ctx.viewport_blueprint - .add_space_views(std::iter::once(space_view), target_container_id, None); + .add_views(std::iter::once(view), target_container_id, None); ctx.viewer_context .selection_state() - .set_selection(Item::SpaceView(space_view_id)); + .set_selection(Item::View(view_id)); ctx.viewport_blueprint .mark_user_interaction(ctx.viewer_context); } diff --git a/crates/viewer/re_context_menu/src/actions/add_space_view.rs b/crates/viewer/re_context_menu/src/actions/add_view.rs similarity index 53% rename from crates/viewer/re_context_menu/src/actions/add_space_view.rs rename to crates/viewer/re_context_menu/src/actions/add_view.rs index fa786525436a..6e3b73e94a78 100644 --- a/crates/viewer/re_context_menu/src/actions/add_space_view.rs +++ b/crates/viewer/re_context_menu/src/actions/add_view.rs @@ -1,17 +1,17 @@ -use re_types::SpaceViewClassIdentifier; +use re_types::ViewClassIdentifier; use re_ui::Icon; -use re_viewer_context::{ContainerId, Item, RecommendedSpaceView}; -use re_viewport_blueprint::SpaceViewBlueprint; +use re_viewer_context::{ContainerId, Item, RecommendedView}; +use re_viewport_blueprint::ViewBlueprint; use crate::{ContextMenuAction, ContextMenuContext}; -/// Add a space view of the specific class -pub(crate) struct AddSpaceViewAction { +/// Add a view of the specific class +pub(crate) struct AddViewAction { pub icon: &'static Icon, - pub id: SpaceViewClassIdentifier, + pub id: ViewClassIdentifier, } -impl ContextMenuAction for AddSpaceViewAction { +impl ContextMenuAction for AddViewAction { fn supports_item(&self, _ctx: &ContextMenuContext<'_>, item: &Item) -> bool { matches!(item, Item::Container(_)) } @@ -22,20 +22,17 @@ impl ContextMenuAction for AddSpaceViewAction { fn label(&self, ctx: &ContextMenuContext<'_>) -> String { ctx.viewer_context - .space_view_class_registry + .view_class_registry .get_class_or_log_error(self.id) .display_name() .to_owned() } fn process_container(&self, ctx: &ContextMenuContext<'_>, container_id: &ContainerId) { - let space_view = SpaceViewBlueprint::new(self.id, RecommendedSpaceView::root()); + let view = ViewBlueprint::new(self.id, RecommendedView::root()); - ctx.viewport_blueprint.add_space_views( - std::iter::once(space_view), - Some(*container_id), - None, - ); + ctx.viewport_blueprint + .add_views(std::iter::once(view), Some(*container_id), None); ctx.viewport_blueprint .mark_user_interaction(ctx.viewer_context); } diff --git a/crates/viewer/re_context_menu/src/actions/clone_space_view.rs b/crates/viewer/re_context_menu/src/actions/clone_space_view.rs deleted file mode 100644 index fe7aaf6efea5..000000000000 --- a/crates/viewer/re_context_menu/src/actions/clone_space_view.rs +++ /dev/null @@ -1,29 +0,0 @@ -use re_viewer_context::{Item, SpaceViewId}; - -use crate::{ContextMenuAction, ContextMenuContext}; - -/// Clone a single space view -pub(crate) struct CloneSpaceViewAction; - -impl ContextMenuAction for CloneSpaceViewAction { - fn supports_item(&self, _ctx: &ContextMenuContext<'_>, item: &Item) -> bool { - matches!(item, Item::SpaceView(_)) - } - - fn label(&self, _ctx: &ContextMenuContext<'_>) -> String { - "Clone".to_owned() - } - - fn process_space_view(&self, ctx: &ContextMenuContext<'_>, space_view_id: &SpaceViewId) { - if let Some(new_space_view_id) = ctx - .viewport_blueprint - .duplicate_space_view(space_view_id, ctx.viewer_context) - { - ctx.viewer_context - .selection_state() - .set_selection(Item::SpaceView(new_space_view_id)); - ctx.viewport_blueprint - .mark_user_interaction(ctx.viewer_context); - } - } -} diff --git a/crates/viewer/re_context_menu/src/actions/clone_view.rs b/crates/viewer/re_context_menu/src/actions/clone_view.rs new file mode 100644 index 000000000000..c629e7ea6634 --- /dev/null +++ b/crates/viewer/re_context_menu/src/actions/clone_view.rs @@ -0,0 +1,29 @@ +use re_viewer_context::{Item, ViewId}; + +use crate::{ContextMenuAction, ContextMenuContext}; + +/// Clone a single view +pub(crate) struct CloneViewAction; + +impl ContextMenuAction for CloneViewAction { + fn supports_item(&self, _ctx: &ContextMenuContext<'_>, item: &Item) -> bool { + matches!(item, Item::View(_)) + } + + fn label(&self, _ctx: &ContextMenuContext<'_>) -> String { + "Clone".to_owned() + } + + fn process_view(&self, ctx: &ContextMenuContext<'_>, view_id: &ViewId) { + if let Some(new_view_id) = ctx + .viewport_blueprint + .duplicate_view(view_id, ctx.viewer_context) + { + ctx.viewer_context + .selection_state() + .set_selection(Item::View(new_view_id)); + ctx.viewport_blueprint + .mark_user_interaction(ctx.viewer_context); + } + } +} diff --git a/crates/viewer/re_context_menu/src/actions/collapse_expand_all.rs b/crates/viewer/re_context_menu/src/actions/collapse_expand_all.rs index f65215413fff..6d1c583bdf27 100644 --- a/crates/viewer/re_context_menu/src/actions/collapse_expand_all.rs +++ b/crates/viewer/re_context_menu/src/actions/collapse_expand_all.rs @@ -1,5 +1,5 @@ use re_entity_db::InstancePath; -use re_viewer_context::{CollapseScope, ContainerId, Contents, Item, SpaceViewId}; +use re_viewer_context::{CollapseScope, ContainerId, Contents, Item, ViewId}; use crate::{ContextMenuAction, ContextMenuContext}; @@ -29,7 +29,7 @@ impl ContextMenuAction for CollapseExpandAllAction { false } - Item::SpaceView(_) | Item::Container(_) | Item::InstancePath(_) => true, + Item::View(_) | Item::Container(_) | Item::InstancePath(_) => true, //TODO(ab): for DataResult, walk the data result tree instead! Item::DataResult(_, instance_path) => ctx @@ -54,21 +54,21 @@ impl ContextMenuAction for CollapseExpandAllAction { Contents::Container(container_id) => CollapseScope::BlueprintTree .container(*container_id) .set_open(&ctx.egui_context, self.open()), - Contents::SpaceView(space_view_id) => self.process_space_view(ctx, space_view_id), + Contents::View(view_id) => self.process_view(ctx, view_id), }); } - fn process_space_view(&self, ctx: &ContextMenuContext<'_>, space_view_id: &SpaceViewId) { + fn process_view(&self, ctx: &ContextMenuContext<'_>, view_id: &ViewId) { CollapseScope::BlueprintTree - .space_view(*space_view_id) + .view(*view_id) .set_open(&ctx.egui_context, self.open()); - let query_result = ctx.viewer_context.lookup_query_result(*space_view_id); + let query_result = ctx.viewer_context.lookup_query_result(*view_id); let result_tree = &query_result.tree; if let Some(root_node) = result_tree.root_node() { self.process_data_result( ctx, - space_view_id, + view_id, &InstancePath::entity_all(root_node.data_result.entity_path.clone()), ); } @@ -77,7 +77,7 @@ impl ContextMenuAction for CollapseExpandAllAction { fn process_data_result( &self, ctx: &ContextMenuContext<'_>, - space_view_id: &SpaceViewId, + view_id: &ViewId, instance_path: &InstancePath, ) { //TODO(ab): here we should in principle walk the DataResult tree instead of the entity tree @@ -93,7 +93,7 @@ impl ContextMenuAction for CollapseExpandAllAction { subtree.visit_children_recursively(|entity_path| { CollapseScope::BlueprintTree - .data_result(*space_view_id, entity_path.clone()) + .data_result(*view_id, entity_path.clone()) .set_open(&ctx.egui_context, self.open()); }); } diff --git a/crates/viewer/re_context_menu/src/actions/mod.rs b/crates/viewer/re_context_menu/src/actions/mod.rs index 8601da12fdd5..9be8934da738 100644 --- a/crates/viewer/re_context_menu/src/actions/mod.rs +++ b/crates/viewer/re_context_menu/src/actions/mod.rs @@ -1,7 +1,7 @@ pub(super) mod add_container; -pub(super) mod add_entities_to_new_space_view; -pub(super) mod add_space_view; -pub(super) mod clone_space_view; +pub(super) mod add_entities_to_new_view; +pub(super) mod add_view; +pub(super) mod clone_view; pub(super) mod collapse_expand_all; pub(super) mod move_contents_to_new_container; pub(super) mod remove; diff --git a/crates/viewer/re_context_menu/src/actions/move_contents_to_new_container.rs b/crates/viewer/re_context_menu/src/actions/move_contents_to_new_container.rs index f7104b0a54cf..60121aa6324c 100644 --- a/crates/viewer/re_context_menu/src/actions/move_contents_to_new_container.rs +++ b/crates/viewer/re_context_menu/src/actions/move_contents_to_new_container.rs @@ -21,7 +21,7 @@ impl ContextMenuAction for MoveContentsToNewContainerAction { } ctx.selection.iter().all(|(item, _)| match item { - Item::SpaceView(_) => true, + Item::View(_) => true, Item::Container(container_id) => ctx.viewport_blueprint.root_container != *container_id, _ => false, }) @@ -33,7 +33,7 @@ impl ContextMenuAction for MoveContentsToNewContainerAction { fn supports_item(&self, ctx: &ContextMenuContext<'_>, item: &Item) -> bool { match item { - Item::SpaceView(_) => true, + Item::View(_) => true, Item::Container(container_id) => ctx.viewport_blueprint.root_container != *container_id, _ => false, } diff --git a/crates/viewer/re_context_menu/src/actions/remove.rs b/crates/viewer/re_context_menu/src/actions/remove.rs index a7390d0118b2..fb86b1d4c099 100644 --- a/crates/viewer/re_context_menu/src/actions/remove.rs +++ b/crates/viewer/re_context_menu/src/actions/remove.rs @@ -1,9 +1,9 @@ use re_entity_db::InstancePath; -use re_viewer_context::{ContainerId, Contents, Item, SpaceViewId}; +use re_viewer_context::{ContainerId, Contents, Item, ViewId}; use crate::{ContextMenuAction, ContextMenuContext}; -/// Remove a container, space view, or data result. +/// Remove a container, view, or data result. pub(crate) struct RemoveAction; impl ContextMenuAction for RemoveAction { @@ -13,7 +13,7 @@ impl ContextMenuAction for RemoveAction { fn supports_item(&self, ctx: &ContextMenuContext<'_>, item: &Item) -> bool { match item { - Item::SpaceView(_) => true, + Item::View(_) => true, Item::Container(container_id) => ctx.viewport_blueprint.root_container != *container_id, Item::DataResult(_, instance_path) => instance_path.is_all(), _ => false, @@ -31,21 +31,21 @@ impl ContextMenuAction for RemoveAction { .remove_contents(Contents::Container(*container_id)); } - fn process_space_view(&self, ctx: &ContextMenuContext<'_>, space_view_id: &SpaceViewId) { + fn process_view(&self, ctx: &ContextMenuContext<'_>, view_id: &ViewId) { ctx.viewport_blueprint .mark_user_interaction(ctx.viewer_context); ctx.viewport_blueprint - .remove_contents(Contents::SpaceView(*space_view_id)); + .remove_contents(Contents::View(*view_id)); } fn process_data_result( &self, ctx: &ContextMenuContext<'_>, - space_view_id: &SpaceViewId, + view_id: &ViewId, instance_path: &InstancePath, ) { - if let Some(space_view) = ctx.viewport_blueprint.view(space_view_id) { - space_view.contents.remove_subtree_and_matching_rules( + if let Some(view) = ctx.viewport_blueprint.view(view_id) { + view.contents.remove_subtree_and_matching_rules( ctx.viewer_context, instance_path.entity_path.clone(), ); diff --git a/crates/viewer/re_context_menu/src/actions/screenshot_action.rs b/crates/viewer/re_context_menu/src/actions/screenshot_action.rs index 6c53168d31ff..7cd6720459b6 100644 --- a/crates/viewer/re_context_menu/src/actions/screenshot_action.rs +++ b/crates/viewer/re_context_menu/src/actions/screenshot_action.rs @@ -1,23 +1,21 @@ -use re_viewer_context::{ - Item, PublishedSpaceViewInfo, ScreenshotTarget, SpaceViewId, SpaceViewRectPublisher, -}; +use re_viewer_context::{Item, PublishedViewInfo, ScreenshotTarget, ViewId, ViewRectPublisher}; use crate::{ContextMenuAction, ContextMenuContext}; -/// Space view screenshot action. +/// View screenshot action. #[cfg(not(target_arch = "wasm32"))] pub enum ScreenshotAction { - /// Screenshot the space view, and copy the results to clipboard. + /// Screenshot the view, and copy the results to clipboard. CopyScreenshot, - /// Screenshot the space view, and save the results to disk. + /// Screenshot the view, and save the results to disk. SaveScreenshot, } impl ContextMenuAction for ScreenshotAction { /// Do we have a context menu for this selection? fn supports_selection(&self, ctx: &ContextMenuContext<'_>) -> bool { - // Allow if there is a single space view selected. + // Allow if there is a single view selected. ctx.selection.len() == 1 && ctx .selection @@ -27,14 +25,14 @@ impl ContextMenuAction for ScreenshotAction { /// Do we have a context menu for this item? fn supports_item(&self, ctx: &ContextMenuContext<'_>, item: &Item) -> bool { - let Item::SpaceView(space_view_id) = item else { + let Item::View(view_id) = item else { return false; }; ctx.egui_context.memory_mut(|mem| { mem.caches - .cache::() - .get(space_view_id) + .cache::() + .get(view_id) .is_some() }) } @@ -46,19 +44,19 @@ impl ContextMenuAction for ScreenshotAction { } } - fn process_space_view(&self, ctx: &ContextMenuContext<'_>, space_view_id: &SpaceViewId) { - let Some(space_view_info) = ctx.egui_context.memory_mut(|mem| { + fn process_view(&self, ctx: &ContextMenuContext<'_>, view_id: &ViewId) { + let Some(view_info) = ctx.egui_context.memory_mut(|mem| { mem.caches - .cache::() - .get(space_view_id) + .cache::() + .get(view_id) .cloned() }) else { return; }; - let PublishedSpaceViewInfo { name, rect } = space_view_info; + let PublishedViewInfo { name, rect } = view_info; - let rect = rect.shrink(1.75); // Hacky: Shrink so we don't accidentally include the border of the space-view. + let rect = rect.shrink(1.75); // Hacky: Shrink so we don't accidentally include the border of the view. let target = match self { Self::CopyScreenshot => ScreenshotTarget::CopyToClipboard, diff --git a/crates/viewer/re_context_menu/src/actions/show_hide.rs b/crates/viewer/re_context_menu/src/actions/show_hide.rs index 7c447e2d495d..b952b62889a0 100644 --- a/crates/viewer/re_context_menu/src/actions/show_hide.rs +++ b/crates/viewer/re_context_menu/src/actions/show_hide.rs @@ -1,5 +1,5 @@ use re_entity_db::InstancePath; -use re_viewer_context::{ContainerId, Contents, Item, SpaceViewId}; +use re_viewer_context::{ContainerId, Contents, Item, ViewId}; use crate::{ContextMenuAction, ContextMenuContext}; @@ -9,16 +9,16 @@ pub(crate) struct ShowAction; impl ContextMenuAction for ShowAction { fn supports_selection(&self, ctx: &ContextMenuContext<'_>) -> bool { ctx.selection.iter().any(|(item, _)| match item { - Item::SpaceView(space_view_id) => !ctx + Item::View(view_id) => !ctx .viewport_blueprint - .is_contents_visible(&Contents::SpaceView(*space_view_id)), + .is_contents_visible(&Contents::View(*view_id)), Item::Container(container_id) => { !ctx.viewport_blueprint .is_contents_visible(&Contents::Container(*container_id)) && ctx.viewport_blueprint.root_container != *container_id } - Item::DataResult(space_view_id, instance_path) => { - data_result_visible(ctx, space_view_id, instance_path).is_some_and(|vis| !vis) + Item::DataResult(view_id, instance_path) => { + data_result_visible(ctx, view_id, instance_path).is_some_and(|vis| !vis) } _ => false, }) @@ -40,10 +40,10 @@ impl ContextMenuAction for ShowAction { ); } - fn process_space_view(&self, ctx: &ContextMenuContext<'_>, space_view_id: &SpaceViewId) { + fn process_view(&self, ctx: &ContextMenuContext<'_>, view_id: &ViewId) { ctx.viewport_blueprint.set_content_visibility( ctx.viewer_context, - &Contents::SpaceView(*space_view_id), + &Contents::View(*view_id), true, ); } @@ -51,10 +51,10 @@ impl ContextMenuAction for ShowAction { fn process_data_result( &self, ctx: &ContextMenuContext<'_>, - space_view_id: &SpaceViewId, + view_id: &ViewId, instance_path: &InstancePath, ) { - set_data_result_visible(ctx, space_view_id, instance_path, true); + set_data_result_visible(ctx, view_id, instance_path, true); } } @@ -63,16 +63,16 @@ pub(crate) struct HideAction; impl ContextMenuAction for HideAction { fn supports_selection(&self, ctx: &ContextMenuContext<'_>) -> bool { ctx.selection.iter().any(|(item, _)| match item { - Item::SpaceView(space_view_id) => ctx + Item::View(view_id) => ctx .viewport_blueprint - .is_contents_visible(&Contents::SpaceView(*space_view_id)), + .is_contents_visible(&Contents::View(*view_id)), Item::Container(container_id) => { ctx.viewport_blueprint .is_contents_visible(&Contents::Container(*container_id)) && ctx.viewport_blueprint.root_container != *container_id } - Item::DataResult(space_view_id, instance_path) => { - data_result_visible(ctx, space_view_id, instance_path).unwrap_or(false) + Item::DataResult(view_id, instance_path) => { + data_result_visible(ctx, view_id, instance_path).unwrap_or(false) } _ => false, }) @@ -94,10 +94,10 @@ impl ContextMenuAction for HideAction { ); } - fn process_space_view(&self, ctx: &ContextMenuContext<'_>, space_view_id: &SpaceViewId) { + fn process_view(&self, ctx: &ContextMenuContext<'_>, view_id: &ViewId) { ctx.viewport_blueprint.set_content_visibility( ctx.viewer_context, - &Contents::SpaceView(*space_view_id), + &Contents::View(*view_id), false, ); } @@ -105,22 +105,22 @@ impl ContextMenuAction for HideAction { fn process_data_result( &self, ctx: &ContextMenuContext<'_>, - space_view_id: &SpaceViewId, + view_id: &ViewId, instance_path: &InstancePath, ) { - set_data_result_visible(ctx, space_view_id, instance_path, false); + set_data_result_visible(ctx, view_id, instance_path, false); } } fn data_result_visible( ctx: &ContextMenuContext<'_>, - space_view_id: &SpaceViewId, + view_id: &ViewId, instance_path: &InstancePath, ) -> Option { instance_path .is_all() .then(|| { - let query_result = ctx.viewer_context.lookup_query_result(*space_view_id); + let query_result = ctx.viewer_context.lookup_query_result(*view_id); query_result .tree .lookup_result_by_path(&instance_path.entity_path) @@ -131,11 +131,11 @@ fn data_result_visible( fn set_data_result_visible( ctx: &ContextMenuContext<'_>, - space_view_id: &SpaceViewId, + view_id: &ViewId, instance_path: &InstancePath, visible: bool, ) { - if let Some(query_result) = ctx.viewer_context.query_results.get(space_view_id) { + if let Some(query_result) = ctx.viewer_context.query_results.get(view_id) { if let Some(data_result) = query_result .tree .lookup_result_by_path(&instance_path.entity_path) @@ -147,6 +147,6 @@ fn set_data_result_visible( ); } } else { - re_log::error!("No query available for space view {:?}", space_view_id); + re_log::error!("No query available for view {:?}", view_id); } } diff --git a/crates/viewer/re_context_menu/src/lib.rs b/crates/viewer/re_context_menu/src/lib.rs index c9314c31de64..c24a070ff846 100644 --- a/crates/viewer/re_context_menu/src/lib.rs +++ b/crates/viewer/re_context_menu/src/lib.rs @@ -3,7 +3,7 @@ use once_cell::sync::OnceCell; use re_entity_db::InstancePath; -use re_viewer_context::{ContainerId, Contents, Item, ItemCollection, SpaceViewId, ViewerContext}; +use re_viewer_context::{ContainerId, Contents, Item, ItemCollection, ViewId, ViewerContext}; use re_viewport_blueprint::{ContainerBlueprint, ViewportBlueprint}; mod actions; @@ -11,9 +11,9 @@ mod sub_menu; use actions::{ add_container::AddContainerAction, - add_entities_to_new_space_view::AddEntitiesToNewSpaceViewAction, - add_space_view::AddSpaceViewAction, - clone_space_view::CloneSpaceViewAction, + add_entities_to_new_view::AddEntitiesToNewViewAction, + add_view::AddViewAction, + clone_view::CloneViewAction, collapse_expand_all::CollapseExpandAllAction, move_contents_to_new_container::MoveContentsToNewContainerAction, remove::RemoveAction, @@ -122,7 +122,7 @@ fn action_list( Box::new(CollapseExpandAllAction::ExpandAll), Box::new(CollapseExpandAllAction::CollapseAll), ], - vec![Box::new(CloneSpaceViewAction)], + vec![Box::new(CloneViewAction)], vec![ Box::new(SubMenu { label: "Add container".to_owned(), @@ -134,12 +134,12 @@ fn action_list( ], }), Box::new(SubMenu { - label: "Add space view".to_owned(), + label: "Add view".to_owned(), actions: ctx - .space_view_class_registry + .view_class_registry .iter_registry() .map(|entry| { - Box::new(AddSpaceViewAction { + Box::new(AddViewAction { icon: entry.class.icon(), id: entry.identifier, }) @@ -157,7 +157,7 @@ fn action_list( Box::new(MoveContentsToNewContainerAction(ContainerKind::Grid)), ], })], - vec![Box::new(AddEntitiesToNewSpaceViewAction)], + vec![Box::new(AddEntitiesToNewViewAction)], ] }) } @@ -210,13 +210,11 @@ struct ContextMenuContext<'a> { impl<'a> ContextMenuContext<'a> { /// Return the clicked item's parent container id and position within it. /// - /// Valid only for space views, containers, and data results. For data results, the parent and - /// position of the enclosing space view is considered. + /// Valid only for views, containers, and data results. For data results, the parent and + /// position of the enclosing view is considered. pub fn clicked_item_enclosing_container_id_and_position(&self) -> Option<(ContainerId, usize)> { match self.clicked_item { - Item::SpaceView(space_view_id) | Item::DataResult(space_view_id, _) => { - Some(Contents::SpaceView(*space_view_id)) - } + Item::View(view_id) | Item::DataResult(view_id, _) => Some(Contents::View(*view_id)), Item::Container(container_id) => Some(Contents::Container(*container_id)), _ => None, } @@ -225,8 +223,8 @@ impl<'a> ContextMenuContext<'a> { /// Return the clicked item's parent container and position within it. /// - /// Valid only for space views, containers, and data results. For data results, the parent and - /// position of the enclosing space view is considered. + /// Valid only for views, containers, and data results. For data results, the parent and + /// position of the enclosing view is considered. pub fn clicked_item_enclosing_container_and_position( &self, ) -> Option<(&'a ContainerBlueprint, usize)> { @@ -321,10 +319,10 @@ trait ContextMenuAction { Item::ComponentPath(component_path) => { self.process_component_path(ctx, component_path); } - Item::SpaceView(space_view_id) => self.process_space_view(ctx, space_view_id), + Item::View(view_id) => self.process_view(ctx, view_id), Item::InstancePath(instance_path) => self.process_instance_path(ctx, instance_path), - Item::DataResult(space_view_id, instance_path) => { - self.process_data_result(ctx, space_view_id, instance_path); + Item::DataResult(view_id, instance_path) => { + self.process_data_result(ctx, view_id, instance_path); } Item::Container(container_id) => self.process_container(ctx, container_id), } @@ -347,14 +345,14 @@ trait ContextMenuAction { /// Process a single container. fn process_container(&self, _ctx: &ContextMenuContext<'_>, _container_id: &ContainerId) {} - /// Process a single space view. - fn process_space_view(&self, _ctx: &ContextMenuContext<'_>, _space_view_id: &SpaceViewId) {} + /// Process a single view. + fn process_view(&self, _ctx: &ContextMenuContext<'_>, _view_id: &ViewId) {} /// Process a single data result. fn process_data_result( &self, _ctx: &ContextMenuContext<'_>, - _space_view_id: &SpaceViewId, + _view_id: &ViewId, _instance_path: &InstancePath, ) { } diff --git a/crates/viewer/re_data_ui/src/item_ui.rs b/crates/viewer/re_data_ui/src/item_ui.rs index 0bafd68873a2..ca1ead6183e7 100644 --- a/crates/viewer/re_data_ui/src/item_ui.rs +++ b/crates/viewer/re_data_ui/src/item_ui.rs @@ -6,11 +6,11 @@ use re_entity_db::{EntityTree, InstancePath}; use re_format::format_uint; use re_log_types::{ApplicationId, ComponentPath, EntityPath, TimeInt, Timeline}; use re_ui::{icons, list_item, SyntaxHighlighting, UiExt as _}; -use re_viewer_context::{HoverHighlight, Item, SpaceViewId, UiLayout, ViewerContext}; +use re_viewer_context::{HoverHighlight, Item, UiLayout, ViewId, ViewerContext}; use super::DataUi; -// TODO(andreas): This is where we want to go, but we need to figure out how get the [`re_viewer_context::SpaceViewClass`] from the `SpaceViewId`. +// TODO(andreas): This is where we want to go, but we need to figure out how get the [`re_viewer_context::ViewClass`] from the `ViewId`. // Simply pass in optional icons? // // Show a button to an [`Item`] with a given text. @@ -24,11 +24,11 @@ use super::DataUi; // Item::ComponentPath(component_path) => { // component_path_button_to(ctx, ui, text, component_path) // } -// Item::SpaceView(space_view_id) => { -// space_view_button_to(ctx, ui, text, *space_view_id, space_view_category) +// Item::View(view_id) => { +// view_button_to(ctx, ui, text, *view_id, view_category) // } -// Item::InstancePath(space_view_id, instance_path) => { -// instance_path_button_to(ctx, ui, *space_view_id, instance_path, text) +// Item::InstancePath(view_id, instance_path) => { +// instance_path_button_to(ctx, ui, *view_id, instance_path, text) // } // } // } @@ -39,7 +39,7 @@ pub fn entity_path_button( query: &re_chunk_store::LatestAtQuery, db: &re_entity_db::EntityDb, ui: &mut egui::Ui, - space_view_id: Option, + view_id: Option, entity_path: &EntityPath, ) -> egui::Response { instance_path_button_to( @@ -47,7 +47,7 @@ pub fn entity_path_button( query, db, ui, - space_view_id, + view_id, &InstancePath::entity_all(entity_path.clone()), entity_path.syntax_highlighted(ui.style()), ) @@ -59,7 +59,7 @@ pub fn entity_path_parts_buttons( query: &re_chunk_store::LatestAtQuery, db: &re_entity_db::EntityDb, ui: &mut egui::Ui, - space_view_id: Option, + view_id: Option, entity_path: &EntityPath, ) -> egui::Response { let with_individual_icons = false; // too much noise with icons in a path @@ -93,7 +93,7 @@ pub fn entity_path_parts_buttons( query, db, ui, - space_view_id, + view_id, &InstancePath::entity_all(accumulated.clone().into()), part.syntax_highlighted(ui.style()), with_individual_icons, @@ -114,17 +114,17 @@ pub fn blueprint_entity_path_button_to( text: impl Into, ) -> egui::Response { // If we're targeting an entity in the blueprint store, - // it doesn't make much sense to specify the space view id since space view ids are + // it doesn't make much sense to specify the view id since view ids are // embedded in entity paths of the blueprint store. // I.e. if there is a view relationship that we would care about, we would know that from the path! - let space_view_id = None; + let view_id = None; entity_path_button_to( ctx, ctx.blueprint_query, ctx.blueprint_db(), ui, - space_view_id, + view_id, entity_path, text, ) @@ -136,7 +136,7 @@ pub fn entity_path_button_to( query: &re_chunk_store::LatestAtQuery, db: &re_entity_db::EntityDb, ui: &mut egui::Ui, - space_view_id: Option, + view_id: Option, entity_path: &EntityPath, text: impl Into, ) -> egui::Response { @@ -145,7 +145,7 @@ pub fn entity_path_button_to( query, db, ui, - space_view_id, + view_id, &InstancePath::entity_all(entity_path.clone()), text, ) @@ -157,7 +157,7 @@ pub fn instance_path_button( query: &re_chunk_store::LatestAtQuery, db: &re_entity_db::EntityDb, ui: &mut egui::Ui, - space_view_id: Option, + view_id: Option, instance_path: &InstancePath, ) -> egui::Response { instance_path_button_to( @@ -165,7 +165,7 @@ pub fn instance_path_button( query, db, ui, - space_view_id, + view_id, instance_path, instance_path.syntax_highlighted(ui.style()), ) @@ -237,11 +237,11 @@ pub fn instance_path_button_to( query: &re_chunk_store::LatestAtQuery, db: &re_entity_db::EntityDb, ui: &mut egui::Ui, - space_view_id: Option, + view_id: Option, instance_path: &InstancePath, text: impl Into, ) -> egui::Response { - instance_path_button_to_ex(ctx, query, db, ui, space_view_id, instance_path, text, true) + instance_path_button_to_ex(ctx, query, db, ui, view_id, instance_path, text, true) } /// Show an instance id and make it selectable. @@ -251,13 +251,13 @@ fn instance_path_button_to_ex( query: &re_chunk_store::LatestAtQuery, db: &re_entity_db::EntityDb, ui: &mut egui::Ui, - space_view_id: Option, + view_id: Option, instance_path: &InstancePath, text: impl Into, with_icon: bool, ) -> egui::Response { - let item = if let Some(space_view_id) = space_view_id { - Item::DataResult(space_view_id, instance_path.clone()) + let item = if let Some(view_id) = view_id { + Item::DataResult(view_id, instance_path.clone()) } else { Item::InstancePath(instance_path.clone()) }; @@ -287,7 +287,7 @@ pub fn instance_path_parts_buttons( query: &re_chunk_store::LatestAtQuery, db: &re_entity_db::EntityDb, ui: &mut egui::Ui, - space_view_id: Option, + view_id: Option, instance_path: &InstancePath, ) -> egui::Response { let with_icon = false; // too much noise with icons in a path @@ -308,7 +308,7 @@ pub fn instance_path_parts_buttons( query, db, ui, - space_view_id, + view_id, &InstancePath::entity_all(accumulated.clone().into()), part.syntax_highlighted(ui.style()), with_icon, @@ -322,7 +322,7 @@ pub fn instance_path_parts_buttons( query, db, ui, - space_view_id, + view_id, instance_path, instance_path.instance.syntax_highlighted(ui.style()), with_icon, @@ -521,10 +521,10 @@ pub fn data_blueprint_button_to( db: &re_entity_db::EntityDb, ui: &mut egui::Ui, text: impl Into, - space_view_id: SpaceViewId, + view_id: ViewId, entity_path: &EntityPath, ) -> egui::Response { - let item = Item::DataResult(space_view_id, InstancePath::entity_all(entity_path.clone())); + let item = Item::DataResult(view_id, InstancePath::entity_all(entity_path.clone())); let response = ui .selectable_label(ctx.selection().contains_item(&item), text) .on_hover_ui(|ui| { diff --git a/crates/viewer/re_renderer/src/error_handling/error_tracker.rs b/crates/viewer/re_renderer/src/error_handling/error_tracker.rs index 95b2e50ced7b..eb2620f00ed1 100644 --- a/crates/viewer/re_renderer/src/error_handling/error_tracker.rs +++ b/crates/viewer/re_renderer/src/error_handling/error_tracker.rs @@ -17,7 +17,7 @@ pub struct ErrorEntry { last_occurred_frame_index: u64, /// Description of the error. - // TODO(#4507): Expecting to need this once we use this in space views. Also very useful for debugging. + // TODO(#4507): Expecting to need this once we use this in views. Also very useful for debugging. #[allow(dead_code)] description: String, } diff --git a/crates/viewer/re_selection_panel/Cargo.toml b/crates/viewer/re_selection_panel/Cargo.toml index 689fecfa9308..be4440087b19 100644 --- a/crates/viewer/re_selection_panel/Cargo.toml +++ b/crates/viewer/re_selection_panel/Cargo.toml @@ -27,7 +27,7 @@ re_entity_db.workspace = true re_format.workspace = true re_log_types.workspace = true re_log.workspace = true -re_space_view.workspace = true +re_view.workspace = true re_tracing.workspace = true re_types_blueprint.workspace = true # TODO(jleibs): Remove this once VisualizerOverrides is gone re_types_core.workspace = true diff --git a/crates/viewer/re_selection_panel/src/defaults_ui.rs b/crates/viewer/re_selection_panel/src/defaults_ui.rs index ff8daf3d2ba5..1800b68ca702 100644 --- a/crates/viewer/re_selection_panel/src/defaults_ui.rs +++ b/crates/viewer/re_selection_panel/src/defaults_ui.rs @@ -12,12 +12,12 @@ use re_viewer_context::{ blueprint_timeline, ComponentUiTypes, QueryContext, SystemCommand, SystemCommandSender as _, UiLayout, ViewContext, ViewSystemIdentifier, }; -use re_viewport_blueprint::SpaceViewBlueprint; +use re_viewport_blueprint::ViewBlueprint; pub fn view_components_defaults_section_ui( ctx: &ViewContext<'_>, ui: &mut egui::Ui, - view: &SpaceViewBlueprint, + view: &ViewBlueprint, ) { let db = ctx.viewer_ctx.blueprint_db(); let query = ctx.viewer_ctx.blueprint_query; @@ -81,7 +81,7 @@ fn active_default_ui( ui: &mut egui::Ui, active_defaults: &ComponentNameSet, component_to_vis: &BTreeMap, - view: &SpaceViewBlueprint, + view: &ViewBlueprint, query: &LatestAtQuery, db: &re_entity_db::EntityDb, ) { @@ -185,7 +185,7 @@ fn component_to_vis(ctx: &ViewContext<'_>) -> BTreeMap, - view: &SpaceViewBlueprint, + view: &ViewBlueprint, db: &re_entity_db::EntityDb, query: &LatestAtQuery, ) -> ComponentNameSet { diff --git a/crates/viewer/re_selection_panel/src/item_heading_no_breadcrumbs.rs b/crates/viewer/re_selection_panel/src/item_heading_no_breadcrumbs.rs index 02110af1224e..c78d2176e8d4 100644 --- a/crates/viewer/re_selection_panel/src/item_heading_no_breadcrumbs.rs +++ b/crates/viewer/re_selection_panel/src/item_heading_no_breadcrumbs.rs @@ -52,7 +52,7 @@ fn item_heading_no_breadcrumbs( | Item::DataSource(_) | Item::StoreId(_) | Item::Container(_) - | Item::SpaceView(_) => { + | Item::View(_) => { let ItemTitle { icon, label, @@ -95,7 +95,7 @@ fn item_heading_no_breadcrumbs( } Item::DataResult(view_id, instance_path) => { // Break up into view and instance path: - item_heading_no_breadcrumbs(ctx, viewport, ui, &Item::SpaceView(*view_id)); + item_heading_no_breadcrumbs(ctx, viewport, ui, &Item::View(*view_id)); separator_icon_ui(ui); item_heading_no_breadcrumbs( ctx, diff --git a/crates/viewer/re_selection_panel/src/item_heading_with_breadcrumbs.rs b/crates/viewer/re_selection_panel/src/item_heading_with_breadcrumbs.rs index f8a83bd07e4e..a006a2eac302 100644 --- a/crates/viewer/re_selection_panel/src/item_heading_with_breadcrumbs.rs +++ b/crates/viewer/re_selection_panel/src/item_heading_with_breadcrumbs.rs @@ -17,7 +17,7 @@ use re_data_ui::item_ui::{cursor_interact_with_selectable, guess_instance_path_i use re_entity_db::InstancePath; use re_log_types::EntityPathPart; use re_ui::{icons, list_item, DesignTokens, SyntaxHighlighting, UiExt as _}; -use re_viewer_context::{Contents, Item, SpaceViewId, ViewerContext}; +use re_viewer_context::{Contents, Item, ViewId, ViewerContext}; use re_viewport_blueprint::ViewportBlueprint; use crate::item_title::ItemTitle; @@ -124,13 +124,13 @@ fn item_bread_crumbs_ui( viewport_breadcrumbs(ctx, viewport, ui, Contents::Container(parent)); } } - Item::SpaceView(view_id) => { - if let Some(parent) = viewport.parent(&Contents::SpaceView(*view_id)) { + Item::View(view_id) => { + if let Some(parent) = viewport.parent(&Contents::View(*view_id)) { viewport_breadcrumbs(ctx, viewport, ui, Contents::Container(parent)); } } Item::DataResult(view_id, instance_path) => { - viewport_breadcrumbs(ctx, viewport, ui, Contents::SpaceView(*view_id)); + viewport_breadcrumbs(ctx, viewport, ui, Contents::View(*view_id)); let InstancePath { entity_path, @@ -198,7 +198,7 @@ fn last_part_of_item_heading( Item::AppId { .. } | Item::DataSource { .. } | Item::Container { .. } - | Item::SpaceView { .. } + | Item::View { .. } | Item::StoreId { .. } => true, Item::InstancePath { .. } | Item::DataResult { .. } | Item::ComponentPath { .. } => false, @@ -261,7 +261,7 @@ fn entity_path_breadcrumbs( ctx: &ViewerContext<'_>, ui: &mut egui::Ui, // If we are in a view - view_id: Option, + view_id: Option, // Everything is relative to this origin: &EntityPath, // Show crumbs for all of these @@ -284,7 +284,7 @@ fn entity_path_breadcrumbs( } else { // Root let icon = if view_id.is_some() { - // Inside a space view, we show the root with an icon + // Inside a view, we show the root with an icon // that matches the one in the blueprint tree panel. guess_instance_path_icon(ctx, &InstancePath::from(full_entity_path.clone())) } else { diff --git a/crates/viewer/re_selection_panel/src/item_title.rs b/crates/viewer/re_selection_panel/src/item_title.rs index 338e9c277b55..84526a6acae4 100644 --- a/crates/viewer/re_selection_panel/src/item_title.rs +++ b/crates/viewer/re_selection_panel/src/item_title.rs @@ -9,9 +9,7 @@ use re_ui::{ syntax_highlighting::{InstanceInBrackets as InstanceWithBrackets, SyntaxHighlightedBuilder}, SyntaxHighlighting as _, }; -use re_viewer_context::{ - contents_name_style, ContainerId, Contents, Item, SpaceViewId, ViewerContext, -}; +use re_viewer_context::{contents_name_style, ContainerId, Contents, Item, ViewId, ViewerContext}; use re_viewport_blueprint::ViewportBlueprint; pub fn is_component_static(ctx: &ViewerContext<'_>, component_path: &ComponentPath) -> bool { @@ -57,7 +55,7 @@ impl ItemTitle { Item::Container(container_id) => Self::from_container_id(viewport, container_id), - Item::SpaceView(view_id) => Self::from_view_id(ctx, viewport, view_id), + Item::View(view_id) => Self::from_view_id(ctx, viewport, view_id), Item::DataResult(view_id, instance_path) => { let item_title = Self::from_instance_path(ctx, style, instance_path); @@ -157,7 +155,7 @@ impl ItemTitle { ) -> Self { match contents { Contents::Container(container_id) => Self::from_container_id(viewport, container_id), - Contents::SpaceView(view_id) => Self::from_view_id(ctx, viewport, view_id), + Contents::View(view_id) => Self::from_view_id(ctx, viewport, view_id), } } @@ -182,7 +180,7 @@ impl ItemTitle { } else { Self::new( format!("Unknown container {container_id}"), - &icons::SPACE_VIEW_UNKNOWN, + &icons::VIEW_UNKNOWN, ) .with_tooltip("Failed to find container in blueprint") } @@ -191,10 +189,10 @@ impl ItemTitle { fn from_view_id( ctx: &ViewerContext<'_>, viewport: &ViewportBlueprint, - view_id: &SpaceViewId, + view_id: &ViewId, ) -> Self { if let Some(view) = viewport.view(view_id) { - let view_class = view.class(ctx.space_view_class_registry); + let view_class = view.class(ctx.view_class_registry); let hover_text = if let Some(display_name) = view.display_name.as_ref() { format!("{} view {display_name:?}", view_class.display_name(),) @@ -206,16 +204,13 @@ impl ItemTitle { Self::new( view_name.as_ref(), - view.class(ctx.space_view_class_registry).icon(), + view.class(ctx.view_class_registry).icon(), ) .with_label_style(contents_name_style(&view_name)) .with_tooltip(hover_text) } else { - Self::new( - format!("Unknown view {view_id}"), - &icons::SPACE_VIEW_UNKNOWN, - ) - .with_tooltip("Failed to find view in blueprint") + Self::new(format!("Unknown view {view_id}"), &icons::VIEW_UNKNOWN) + .with_tooltip("Failed to find view in blueprint") } } diff --git a/crates/viewer/re_selection_panel/src/lib.rs b/crates/viewer/re_selection_panel/src/lib.rs index 4a939185ab13..6226176f1d13 100644 --- a/crates/viewer/re_selection_panel/src/lib.rs +++ b/crates/viewer/re_selection_panel/src/lib.rs @@ -5,8 +5,8 @@ mod item_heading_no_breadcrumbs; mod item_heading_with_breadcrumbs; mod item_title; mod selection_panel; -mod space_view_entity_picker; -mod space_view_space_origin_ui; +mod view_entity_picker; +mod view_space_origin_ui; mod visible_time_range_ui; mod visualizer_ui; @@ -16,7 +16,7 @@ pub use selection_panel::SelectionPanel; mod test { use super::*; use re_chunk_store::LatestAtQuery; - use re_viewer_context::{blueprint_timeline, Item, SpaceViewId}; + use re_viewer_context::{blueprint_timeline, Item, ViewId}; use re_viewport_blueprint::ViewportBlueprint; /// This test mainly serve to demonstrate that non-trivial UI code can be executed with a "fake" @@ -28,7 +28,7 @@ mod test { let mut test_ctx = re_viewer_context::test_context::TestContext::default(); test_ctx.edit_selection(|selection_state| { - selection_state.set_selection(Item::SpaceView(SpaceViewId::random())); + selection_state.set_selection(Item::View(ViewId::random())); }); test_ctx.run_in_egui_central_panel(|ctx, ui| { diff --git a/crates/viewer/re_selection_panel/src/selection_panel.rs b/crates/viewer/re_selection_panel/src/selection_panel.rs index 61bbccace2ac..79f5d17b2e19 100644 --- a/crates/viewer/re_selection_panel/src/selection_panel.rs +++ b/crates/viewer/re_selection_panel/src/selection_panel.rs @@ -16,16 +16,15 @@ use re_ui::{ }; use re_viewer_context::{ contents_name_style, icon_for_container_kind, ContainerId, Contents, DataQueryResult, - DataResult, HoverHighlight, Item, SpaceViewId, UiLayout, ViewContext, ViewStates, - ViewerContext, + DataResult, HoverHighlight, Item, UiLayout, ViewContext, ViewId, ViewStates, ViewerContext, }; -use re_viewport_blueprint::{ui::show_add_space_view_or_container_modal, ViewportBlueprint}; +use re_viewport_blueprint::{ui::show_add_view_or_container_modal, ViewportBlueprint}; use crate::{ defaults_ui::view_components_defaults_section_ui, item_heading_no_breadcrumbs::item_title_list_item, item_heading_with_breadcrumbs::item_heading_with_breadcrumbs, - space_view_entity_picker::SpaceViewEntityPicker, + view_entity_picker::ViewEntityPicker, visible_time_range_ui::{ visible_time_range_ui_for_data_result, visible_time_range_ui_for_view, }, @@ -43,7 +42,7 @@ fn default_selection_panel_width(screen_width: f32) -> f32 { pub struct SelectionPanel { #[serde(skip)] /// State for the "Add entity" modal. - space_view_entity_modal: SpaceViewEntityPicker, + view_entity_modal: ViewEntityPicker, } impl SelectionPanel { @@ -92,7 +91,7 @@ impl SelectionPanel { }); // run modals (these are noop if the modals are not active) - self.space_view_entity_modal.ui(ui.ctx(), ctx, viewport); + self.view_entity_modal.ui(ui.ctx(), ctx, viewport); } #[allow(clippy::unused_self)] @@ -223,7 +222,7 @@ impl SelectionPanel { container_children(ctx, viewport, ui, container_id); } - Item::SpaceView(view_id) => { + Item::View(view_id) => { if let Some(view) = viewport.view(view_id) { view_top_level_properties(ctx, ui, view); } @@ -298,7 +297,7 @@ impl SelectionPanel { } match item { - Item::SpaceView(view_id) => { + Item::View(view_id) => { self.view_selection_ui(ctx, ui, viewport, view_id, view_states); } @@ -325,7 +324,7 @@ impl SelectionPanel { ctx: &ViewerContext<'_>, ui: &mut egui::Ui, viewport: &ViewportBlueprint, - view_id: &SpaceViewId, + view_id: &ViewId, view_states: &mut ViewStates, ) { let markdown = r#" @@ -365,13 +364,13 @@ The last rule matching `/world/house` is `+ /world/**`, so it is included. "# .trim(); - clone_space_view_button_ui(ctx, ui, viewport, *view_id); + clone_view_button_ui(ctx, ui, viewport, *view_id); if let Some(view) = viewport.view(view_id) { ui.section_collapsing_header("Entity path filter") .button( list_item::ItemActionButton::new(&re_ui::icons::EDIT, || { - self.space_view_entity_modal.open(*view_id); + self.view_entity_modal.open(*view_id); }) .hover_text("Modify the entity query using the editor"), ) @@ -399,7 +398,7 @@ The last rule matching `/world/house` is `+ /world/**`, so it is included. } if let Some(view) = viewport.view(view_id) { - let view_class = view.class(ctx.space_view_class_registry); + let view_class = view.class(ctx.view_class_registry); let view_state = view_states.get_mut_or_create(view.id, view_class); ui.section_collapsing_header("View properties") @@ -437,7 +436,7 @@ fn entity_selection_ui( ui: &mut egui::Ui, entity_path: &EntityPath, viewport: &ViewportBlueprint, - view_id: &SpaceViewId, + view_id: &ViewId, view_states: &mut ViewStates, ) { let query_result = ctx.lookup_query_result(*view_id); @@ -456,18 +455,17 @@ fn entity_selection_ui( } } -fn clone_space_view_button_ui( +fn clone_view_button_ui( ctx: &ViewerContext<'_>, ui: &mut egui::Ui, viewport: &ViewportBlueprint, - view_id: SpaceViewId, + view_id: ViewId, ) { ui.list_item_flat_noninteractive( list_item::ButtonContent::new("Clone this view") .on_click(|| { - if let Some(new_space_view_id) = viewport.duplicate_space_view(&view_id, ctx) { - ctx.selection_state() - .set_selection(Item::SpaceView(new_space_view_id)); + if let Some(new_view_id) = viewport.duplicate_view(&view_id, ctx) { + ctx.selection_state().set_selection(Item::View(new_view_id)); viewport.mark_user_interaction(ctx); } }) @@ -479,7 +477,7 @@ fn clone_space_view_button_ui( fn entity_path_filter_ui( ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - view_id: SpaceViewId, + view_id: ViewId, filter: &EntityPathFilter, origin: &EntityPath, ) -> Option { @@ -597,9 +595,9 @@ fn container_children( ui.section_collapsing_header("Contents") .button( list_item::ItemActionButton::new(&re_ui::icons::ADD, || { - show_add_space_view_or_container_modal(*container_id); + show_add_view_or_container_modal(*container_id); }) - .hover_text("Add a new space view or container to this container"), + .hover_text("Add a new view or container to this container"), ) .show(ui, show_content); } @@ -614,19 +612,19 @@ fn data_section_ui(item: &Item) -> Option> { Some(Box::new(instance_path.clone())) } // Skip data ui since we don't know yet what to show for these. - Item::SpaceView(_) | Item::Container(_) => None, + Item::View(_) | Item::Container(_) => None, } } -fn space_view_button( +fn view_button( ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - view: &re_viewport_blueprint::SpaceViewBlueprint, + view: &re_viewport_blueprint::ViewBlueprint, ) -> egui::Response { - let item = Item::SpaceView(view.id); + let item = Item::View(view.id); let is_selected = ctx.selection().contains_item(&item); let view_name = view.display_name_or_default(); - let class = view.class(ctx.space_view_class_registry); + let class = view.class(ctx.view_class_registry); let response = ui .selectable_label_with_icon( @@ -646,20 +644,19 @@ fn list_existing_data_blueprints( ui: &mut egui::Ui, instance_path: &InstancePath, ) { - let space_views_with_path = - viewport.space_views_containing_entity_path(ctx, &instance_path.entity_path); + let views_with_path = viewport.views_containing_entity_path(ctx, &instance_path.entity_path); let (query, db) = guess_query_and_db_for_selected_entity(ctx, &instance_path.entity_path); - if space_views_with_path.is_empty() { + if views_with_path.is_empty() { ui.weak("(Not shown in any view)"); } else { - for &view_id in &space_views_with_path { + for &view_id in &views_with_path { if let Some(view) = viewport.view(&view_id) { let response = ui.list_item().show_flat( ui, PropertyContent::new("Shown in").value_fn(|ui, _| { - space_view_button(ctx, ui, view); + view_button(ctx, ui, view); }), ); @@ -692,7 +689,7 @@ fn list_existing_data_blueprints( fn view_top_level_properties( ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - view: &re_viewport_blueprint::SpaceViewBlueprint, + view: &re_viewport_blueprint::ViewBlueprint, ) { ui.list_item_flat_noninteractive(PropertyContent::new("Name").value_fn(|ui, _| { ui.spacing_mut().text_edit_width = ui @@ -711,7 +708,7 @@ fn view_top_level_properties( .text_edit_width .at_least(ui.available_width()); - super::space_view_space_origin_ui::space_view_space_origin_widget_ui(ui, ctx, view); + super::view_space_origin_ui::view_space_origin_widget_ui(ui, ctx, view); })) .on_hover_text( "The origin entity for this view. For spatial views, the space \ @@ -721,7 +718,7 @@ fn view_top_level_properties( ui.list_item_flat_noninteractive( PropertyContent::new("View type") - .value_text(view.class(ctx.space_view_class_registry).display_name()), + .value_text(view.class(ctx.view_class_registry).display_name()), ) .on_hover_text("The type of this view"); } @@ -861,7 +858,7 @@ fn show_list_item_for_container_child( ) -> bool { let mut remove_contents = false; let (item, list_item_content) = match child_contents { - Contents::SpaceView(view_id) => { + Contents::View(view_id) => { let Some(view) = viewport.view(view_id) else { re_log::warn_once!("Could not find view with ID {view_id:?}",); return false; @@ -869,10 +866,10 @@ fn show_list_item_for_container_child( let view_name = view.display_name_or_default(); ( - Item::SpaceView(*view_id), + Item::View(*view_id), list_item::LabelContent::new(view_name.as_ref()) .label_style(contents_name_style(&view_name)) - .with_icon(view.class(ctx.space_view_class_registry).icon()) + .with_icon(view.class(ctx.view_class_registry).icon()) .with_buttons(|ui| { let response = ui .small_icon_button(&icons::REMOVE) diff --git a/crates/viewer/re_selection_panel/src/space_view_entity_picker.rs b/crates/viewer/re_selection_panel/src/view_entity_picker.rs similarity index 75% rename from crates/viewer/re_selection_panel/src/space_view_entity_picker.rs rename to crates/viewer/re_selection_panel/src/view_entity_picker.rs index fd20cd50424d..ba1f814076de 100644 --- a/crates/viewer/re_selection_panel/src/space_view_entity_picker.rs +++ b/crates/viewer/re_selection_panel/src/view_entity_picker.rs @@ -5,21 +5,21 @@ use re_data_ui::item_ui; use re_entity_db::{EntityPath, EntityTree, InstancePath}; use re_log_types::{EntityPathFilter, EntityPathRule}; use re_ui::UiExt as _; -use re_viewer_context::{DataQueryResult, SpaceViewClassExt as _, SpaceViewId, ViewerContext}; -use re_viewport_blueprint::{SpaceViewBlueprint, ViewportBlueprint}; +use re_viewer_context::{DataQueryResult, ViewClassExt as _, ViewId, ViewerContext}; +use re_viewport_blueprint::{ViewBlueprint, ViewportBlueprint}; -/// Window for adding/removing entities from a space view. +/// Window for adding/removing entities from a view. /// /// Delegates to [`re_ui::modal::ModalHandler`] #[derive(Default)] -pub(crate) struct SpaceViewEntityPicker { - space_view_id: Option, +pub(crate) struct ViewEntityPicker { + view_id: Option, modal_handler: re_ui::modal::ModalHandler, } -impl SpaceViewEntityPicker { - pub fn open(&mut self, space_view_id: SpaceViewId) { - self.space_view_id = Some(space_view_id); +impl ViewEntityPicker { + pub fn open(&mut self, view_id: ViewId) { + self.view_id = Some(view_id); self.modal_handler.open(); } @@ -34,39 +34,39 @@ impl SpaceViewEntityPicker { egui_ctx, || re_ui::modal::ModalWrapper::new("Add/remove Entities").default_height(640.0), |ui, open| { - let Some(space_view_id) = &self.space_view_id else { + let Some(view_id) = &self.view_id else { *open = false; return; }; - let Some(space_view) = viewport_blueprint.view(space_view_id) else { + let Some(view) = viewport_blueprint.view(view_id) else { *open = false; return; }; egui::ScrollArea::vertical().show(ui, |ui| { - add_entities_ui(ctx, ui, space_view); + add_entities_ui(ctx, ui, view); }); }, ); } } -fn add_entities_ui(ctx: &ViewerContext<'_>, ui: &mut egui::Ui, space_view: &SpaceViewBlueprint) { +fn add_entities_ui(ctx: &ViewerContext<'_>, ui: &mut egui::Ui, view: &ViewBlueprint) { re_tracing::profile_function!(); let tree = &ctx.recording().tree(); // TODO(jleibs): Avoid clone - let query_result = ctx.lookup_query_result(space_view.id).clone(); - let entity_path_filter = &space_view.contents.entity_path_filter; - let entities_add_info = create_entity_add_info(ctx, tree, space_view, &query_result); + let query_result = ctx.lookup_query_result(view.id).clone(); + let entity_path_filter = &view.contents.entity_path_filter; + let entities_add_info = create_entity_add_info(ctx, tree, view, &query_result); add_entities_tree_ui( ctx, ui, &tree.path.to_string(), tree, - space_view, + view, &query_result, entity_path_filter, &entities_add_info, @@ -79,7 +79,7 @@ fn add_entities_tree_ui( ui: &mut egui::Ui, name: &str, tree: &EntityTree, - space_view: &SpaceViewBlueprint, + view: &ViewBlueprint, query_result: &DataQueryResult, entity_path_filter: &EntityPathFilter, entities_add_info: &IntMap, @@ -90,16 +90,15 @@ fn add_entities_tree_ui( ui, name, tree, - space_view, + view, query_result, entity_path_filter, entities_add_info, ); } else { let level = tree.path.len(); - let default_open = space_view.space_origin.is_descendant_of(&tree.path) - || tree.children.len() <= 3 - || level < 2; + let default_open = + view.space_origin.is_descendant_of(&tree.path) || tree.children.len() <= 3 || level < 2; egui::collapsing_header::CollapsingState::load_with_default_open( ui.ctx(), ui.id().with(name), @@ -111,7 +110,7 @@ fn add_entities_tree_ui( ui, name, tree, - space_view, + view, query_result, entity_path_filter, entities_add_info, @@ -120,7 +119,7 @@ fn add_entities_tree_ui( .body(|ui| { for (path_comp, child_tree) in tree.children.iter().sorted_by_key(|(_, child_tree)| { // Put descendants of the space path always first - let put_first = child_tree.path.starts_with(&space_view.space_origin); + let put_first = child_tree.path.starts_with(&view.space_origin); !put_first }) { add_entities_tree_ui( @@ -128,7 +127,7 @@ fn add_entities_tree_ui( ui, &path_comp.ui_string(), child_tree, - space_view, + view, query_result, entity_path_filter, entities_add_info, @@ -144,7 +143,7 @@ fn add_entities_line_ui( ui: &mut egui::Ui, name: &str, entity_tree: &EntityTree, - space_view: &SpaceViewBlueprint, + view: &ViewBlueprint, query_result: &DataQueryResult, entity_path_filter: &EntityPathFilter, entities_add_info: &IntMap, @@ -167,7 +166,7 @@ fn add_entities_line_ui( let widget_text = if is_explicitly_excluded { // TODO(jleibs): Better design-language for excluded. egui::RichText::new(name).italics() - } else if entity_path == &space_view.space_origin { + } else if entity_path == &view.space_origin { egui::RichText::new(name).strong() } else { egui::RichText::new(name) @@ -177,7 +176,7 @@ fn add_entities_line_ui( &query, ctx.recording(), ui, - Some(space_view.id), + Some(view.id), &InstancePath::entity_all(entity_path.clone()), widget_text, ); @@ -193,9 +192,7 @@ fn add_entities_line_ui( let response = ui.small_icon_button(&re_ui::icons::RESET); if response.clicked() { - space_view - .contents - .remove_filter_rule_for(ctx, &entity_tree.path); + view.contents.remove_filter_rule_for(ctx, &entity_tree.path); } if is_explicitly_excluded { @@ -209,15 +206,13 @@ fn add_entities_line_ui( let response = ui.small_icon_button(&re_ui::icons::REMOVE); if response.clicked() { - space_view.contents.raw_add_entity_exclusion( + view.contents.raw_add_entity_exclusion( ctx, EntityPathRule::including_subtree(entity_tree.path.clone()), ); } - response.on_hover_text( - "Exclude this entity and all its descendants from the space view", - ); + response.on_hover_text("Exclude this entity and all its descendants from the view"); } else { // Add-button: // Shows when an entity is not included @@ -228,7 +223,7 @@ fn add_entities_line_ui( let response = ui.small_icon_button(&re_ui::icons::ADD); if response.clicked() { - space_view.contents.raw_add_entity_inclusion( + view.contents.raw_add_entity_inclusion( ctx, EntityPathRule::including_subtree(entity_tree.path.clone()), ); @@ -237,13 +232,12 @@ fn add_entities_line_ui( if enabled { if add_info.can_add.is_compatible_and_missing() { response.on_hover_text( - "Include this entity and all its descendants in the space view", + "Include this entity and all its descendants in the view", ); } else { - response - .on_hover_text("Add descendants of this entity to the space view"); + response.on_hover_text("Add descendants of this entity to the view"); } - } else if let CanAddToSpaceView::No { reason } = &add_info.can_add { + } else if let CanAddToView::No { reason } = &add_info.can_add { response.on_disabled_hover_text(reason); } }); @@ -252,14 +246,14 @@ fn add_entities_line_ui( }); } -/// Describes if an entity path can be added to a space view. +/// Describes if an entity path can be added to a view. #[derive(Clone, PartialEq, Eq)] -enum CanAddToSpaceView { +enum CanAddToView { Compatible { already_added: bool }, No { reason: String }, } -impl Default for CanAddToSpaceView { +impl Default for CanAddToView { fn default() -> Self { Self::Compatible { already_added: false, @@ -267,8 +261,8 @@ impl Default for CanAddToSpaceView { } } -impl CanAddToSpaceView { - /// Can be generally added but space view might already have this element. +impl CanAddToView { + /// Can be generally added but view might already have this element. pub fn is_compatible(&self) -> bool { match self { Self::Compatible { .. } => true, @@ -276,7 +270,7 @@ impl CanAddToSpaceView { } } - /// Can be added and spaceview doesn't have it already. + /// Can be added and view doesn't have it already. pub fn is_compatible_and_missing(&self) -> bool { self == &Self::Compatible { already_added: false, @@ -304,40 +298,40 @@ impl CanAddToSpaceView { #[derive(Default)] #[allow(dead_code)] struct EntityAddInfo { - can_add: CanAddToSpaceView, - can_add_self_or_descendant: CanAddToSpaceView, + can_add: CanAddToView, + can_add_self_or_descendant: CanAddToView, } fn create_entity_add_info( ctx: &ViewerContext<'_>, tree: &EntityTree, - space_view: &SpaceViewBlueprint, + view: &ViewBlueprint, query_result: &DataQueryResult, ) -> IntMap { let mut meta_data: IntMap = IntMap::default(); - // TODO(andreas): This should be state that is already available because it's part of the space view's state. - let class = space_view.class(ctx.space_view_class_registry); + // TODO(andreas): This should be state that is already available because it's part of the view's state. + let class = view.class(ctx.view_class_registry); let visualizable_entities = class.determine_visualizable_entities( ctx.applicable_entities_per_visualizer, ctx.recording(), - &ctx.space_view_class_registry - .new_visualizer_collection(space_view.class_identifier()), - &space_view.space_origin, + &ctx.view_class_registry + .new_visualizer_collection(view.class_identifier()), + &view.space_origin, ); tree.visit_children_recursively(|entity_path| { - let can_add: CanAddToSpaceView = + let can_add: CanAddToView = if visualizable_entities.iter().any(|(_, entities)| entities.contains(entity_path)) { - CanAddToSpaceView::Compatible { + CanAddToView::Compatible { already_added: query_result.contains_entity(entity_path), } } else { // TODO(#6321): This shouldn't necessarily prevent us from adding it. - CanAddToSpaceView::No { + CanAddToView::No { reason: format!( - "Entity can't be displayed by any of the available visualizers in this class of space view ({}).", - space_view.class_identifier() + "Entity can't be displayed by any of the available visualizers in this class of view ({}).", + view.class_identifier() ), } }; diff --git a/crates/viewer/re_selection_panel/src/space_view_space_origin_ui.rs b/crates/viewer/re_selection_panel/src/view_space_origin_ui.rs similarity index 75% rename from crates/viewer/re_selection_panel/src/space_view_space_origin_ui.rs rename to crates/viewer/re_selection_panel/src/view_space_origin_ui.rs index fc1ed68d27a8..660d4556c736 100644 --- a/crates/viewer/re_selection_panel/src/space_view_space_origin_ui.rs +++ b/crates/viewer/re_selection_panel/src/view_space_origin_ui.rs @@ -5,7 +5,7 @@ use egui::{Key, NumExt as _, Ui}; use re_log_types::EntityPath; use re_ui::{list_item, SyntaxHighlighting, UiExt as _}; use re_viewer_context::ViewerContext; -use re_viewport_blueprint::{default_created_space_views, SpaceViewBlueprint}; +use re_viewport_blueprint::{default_created_views, ViewBlueprint}; /// State of the space origin widget. #[derive(Default, Clone)] @@ -28,19 +28,19 @@ struct EditState { selected_suggestion: Option, } -/// Display the space origin of a space view. -pub(crate) fn space_view_space_origin_widget_ui( +/// Display the space origin of a view. +pub(crate) fn view_space_origin_widget_ui( ui: &mut Ui, ctx: &ViewerContext<'_>, - space_view: &SpaceViewBlueprint, + view: &ViewBlueprint, ) { - let is_editing_id = ui.make_persistent_id(space_view.id.hash()); + let is_editing_id = ui.make_persistent_id(view.id.hash()); let mut state: SpaceOriginEditState = ui.memory_mut(|mem| mem.data.get_temp(is_editing_id).unwrap_or_default()); match &mut state { SpaceOriginEditState::NotEditing => { - let mut space_origin_string = space_view.space_origin.to_string(); + let mut space_origin_string = view.space_origin.to_string(); let output = egui::TextEdit::singleline(&mut space_origin_string).show(ui); if output.response.gained_focus() { @@ -52,12 +52,11 @@ pub(crate) fn space_view_space_origin_widget_ui( } } SpaceOriginEditState::Editing(edit_state) => { - let control_flow = - space_view_space_origin_widget_editing_ui(ui, ctx, space_view, edit_state); + let control_flow = view_space_origin_widget_editing_ui(ui, ctx, view, edit_state); match control_flow { ControlFlow::Break(Some(new_space_origin)) => { - space_view.set_origin(ctx, &new_space_origin); + view.set_origin(ctx, &new_space_origin); state = SpaceOriginEditState::NotEditing; } ControlFlow::Break(None) => { @@ -74,11 +73,11 @@ pub(crate) fn space_view_space_origin_widget_ui( ui.memory_mut(|mem| mem.data.insert_temp(is_editing_id, state)); } -/// Display the space origin of a space view with it is in edit mode. -fn space_view_space_origin_widget_editing_ui( +/// Display the space origin of a view with it is in edit mode. +fn view_space_origin_widget_editing_ui( ui: &mut Ui, ctx: &ViewerContext<'_>, - space_view: &SpaceViewBlueprint, + view: &ViewBlueprint, state: &mut EditState, ) -> ControlFlow, ()> { let mut control_flow = ControlFlow::Continue(()); @@ -89,20 +88,18 @@ fn space_view_space_origin_widget_editing_ui( // Build and filter the suggestion lists // - // All suggestions for this class of space views. + // All suggestions for this class of views. // TODO(#4895): we should have/use a much simpler heuristic API to get a list of compatible entity sub-tree - let space_view_suggestions = default_created_space_views(ctx) + let view_suggestions = default_created_views(ctx) .into_iter() - .filter(|this_space_view| { - this_space_view.class_identifier() == space_view.class_identifier() - }) + .filter(|this_view| this_view.class_identifier() == view.class_identifier()) .collect::>(); // Filtered suggestions based on the current text edit content. - let filtered_space_view_suggestions = space_view_suggestions + let filtered_view_suggestions = view_suggestions .iter() - .filter(|suggested_space_view| { - suggested_space_view + .filter(|suggested_view| { + suggested_view .space_origin .to_string() .contains(&state.origin_string) @@ -127,9 +124,8 @@ fn space_view_space_origin_widget_editing_ui( selected_suggestion = selected_suggestion .saturating_add(arrow_down) .saturating_sub(arrow_up); - if !space_view_suggestions.is_empty() && !filtered_space_view_suggestions.is_empty() { - selected_suggestion = - selected_suggestion.at_most(filtered_space_view_suggestions.len() - 1); + if !view_suggestions.is_empty() && !filtered_view_suggestions.is_empty() { + selected_suggestion = selected_suggestion.at_most(filtered_view_suggestions.len() - 1); } selected_suggestion }); @@ -142,7 +138,7 @@ fn space_view_space_origin_widget_editing_ui( if let Some(selected_suggestion) = state.selected_suggestion { if enter_key_hit { - if let Some(suggestion) = filtered_space_view_suggestions.get(selected_suggestion) { + if let Some(suggestion) = filtered_view_suggestions.get(selected_suggestion) { let origin = &suggestion.space_origin; state.origin_string = origin.to_string(); control_flow = ControlFlow::Break(Some(origin.clone())); @@ -166,7 +162,7 @@ fn space_view_space_origin_widget_editing_ui( } if output.response.changed() { - space_view.set_origin(ctx, &state.origin_string.clone().into()); + view.set_origin(ctx, &state.origin_string.clone().into()); } if output.response.lost_focus() && enter_key_hit && control_flow.is_continue() { @@ -182,16 +178,14 @@ fn space_view_space_origin_widget_editing_ui( } let suggestions_ui = |ui: &mut egui::Ui| { - for (idx, suggested_space_view) in filtered_space_view_suggestions.iter().enumerate() { + for (idx, suggested_view) in filtered_view_suggestions.iter().enumerate() { let response = ui .list_item() .force_hovered(state.selected_suggestion == Some(idx)) .show_flat( ui, list_item::LabelContent::new( - suggested_space_view - .space_origin - .syntax_highlighted(ui.style()), + suggested_view.space_origin.syntax_highlighted(ui.style()), ), ); @@ -200,11 +194,11 @@ fn space_view_space_origin_widget_editing_ui( } if response.clicked() { - control_flow = ControlFlow::Break(Some(suggested_space_view.space_origin.clone())); + control_flow = ControlFlow::Break(Some(suggested_view.space_origin.clone())); } } - let excluded_count = space_view_suggestions.len() - filtered_space_view_suggestions.len(); + let excluded_count = view_suggestions.len() - filtered_view_suggestions.len(); if excluded_count > 0 { ui.list_item_flat_noninteractive( list_item::LabelContent::new(format!("{excluded_count} hidden suggestions")) diff --git a/crates/viewer/re_selection_panel/src/visible_time_range_ui.rs b/crates/viewer/re_selection_panel/src/visible_time_range_ui.rs index 08ef584dd098..fa57fac24651 100644 --- a/crates/viewer/re_selection_panel/src/visible_time_range_ui.rs +++ b/crates/viewer/re_selection_panel/src/visible_time_range_ui.rs @@ -7,15 +7,15 @@ use re_types::{ Archetype, }; use re_ui::UiExt as _; -use re_viewer_context::{QueryRange, SpaceViewClass, SpaceViewState, TimeDragValue, ViewerContext}; -use re_viewport_blueprint::{entity_path_for_view_property, SpaceViewBlueprint}; +use re_viewer_context::{QueryRange, TimeDragValue, ViewClass, ViewState, ViewerContext}; +use re_viewport_blueprint::{entity_path_for_view_property, ViewBlueprint}; pub fn visible_time_range_ui_for_view( ctx: &ViewerContext<'_>, ui: &mut Ui, - view: &SpaceViewBlueprint, - view_class: &dyn SpaceViewClass, - view_state: &dyn SpaceViewState, + view: &ViewBlueprint, + view_class: &dyn ViewClass, + view_state: &dyn ViewState, ) { if !view_class.supports_visible_time_range() { return; @@ -31,12 +31,12 @@ pub fn visible_time_range_ui_for_view( ctx.store_context.blueprint, ctx.blueprint_query, ctx.rec_cfg.time_ctrl.read().timeline(), - ctx.space_view_class_registry, + ctx.view_class_registry, view_state, ); - let is_space_view = true; - visible_time_range_ui(ctx, ui, query_range, &property_path, is_space_view); + let is_view = true; + visible_time_range_ui(ctx, ui, query_range, &property_path, is_view); } pub fn visible_time_range_ui_for_data_result( @@ -47,8 +47,8 @@ pub fn visible_time_range_ui_for_data_result( let override_path = data_result.recursive_override_path(); let query_range = data_result.property_overrides.query_range.clone(); - let is_space_view = false; - visible_time_range_ui(ctx, ui, query_range, override_path, is_space_view); + let is_view = false; + visible_time_range_ui(ctx, ui, query_range, override_path, is_view); } /// Draws ui for a visible time range from a given override path and a resulting query range. @@ -57,7 +57,7 @@ fn visible_time_range_ui( ui: &mut Ui, mut resolved_query_range: QueryRange, time_range_override_path: &EntityPath, - is_space_view: bool, + is_view: bool, ) { use re_types::Component as _; @@ -88,7 +88,7 @@ fn visible_time_range_ui( ui, &mut resolved_query_range, &mut has_individual_range, - is_space_view, + is_view, ); }); @@ -139,17 +139,17 @@ fn query_range_ui( ui: &mut Ui, query_range: &mut QueryRange, has_individual_time_range: &mut bool, - is_space_view: bool, + is_view: bool, ) { let time_ctrl = ctx.rec_cfg.time_ctrl.read().clone(); let time_type = time_ctrl.timeline().typ(); let mut interacting_with_controls = false; let markdown = "# Visible time range\n -This feature controls the time range used to display data in the space view. +This feature controls the time range used to display data in the view. Notes: -- The settings are inherited from the parent entity or enclosing space view if not overridden. +- The settings are inherited from the parent entity or enclosing view if not overridden. - Visible time range properties are stored on a per-timeline basis. - The data current as of the time range starting time is included."; @@ -160,15 +160,15 @@ Notes: .show(ui, |ui| { ui.horizontal(|ui| { ui.re_radio_value(has_individual_time_range, false, "Default") - .on_hover_text(if is_space_view { - "Default query range settings for this kind of space view" + .on_hover_text(if is_view { + "Default query range settings for this kind of view" } else { "Query range settings inherited from parent entity or enclosing \ - space view" + view" }); ui.re_radio_value(has_individual_time_range, true, "Override") - .on_hover_text(if is_space_view { - "Set query range settings for the contents of this space view" + .on_hover_text(if is_view { + "Set query range settings for the contents of this view" } else { "Set query range settings for this entity" }); diff --git a/crates/viewer/re_selection_panel/src/visualizer_ui.rs b/crates/viewer/re_selection_panel/src/visualizer_ui.rs index c6e4711f8927..e6554a0cbc9d 100644 --- a/crates/viewer/re_selection_panel/src/visualizer_ui.rs +++ b/crates/viewer/re_selection_panel/src/visualizer_ui.rs @@ -4,23 +4,23 @@ use re_chunk::{ComponentName, RowId, UnitChunkShared}; use re_data_ui::{sorted_component_list_for_ui, DataUi}; use re_entity_db::EntityDb; use re_log_types::{ComponentPath, EntityPath}; -use re_space_view::latest_at_with_blueprint_resolved_data; use re_types::external::arrow2; use re_types_blueprint::blueprint::components::VisualizerOverrides; use re_ui::{list_item, UiExt as _}; +use re_view::latest_at_with_blueprint_resolved_data; use re_viewer_context::{ - DataResult, QueryContext, SpaceViewClassExt as _, UiLayout, ViewContext, ViewSystemIdentifier, + DataResult, QueryContext, UiLayout, ViewClassExt as _, ViewContext, ViewSystemIdentifier, VisualizerSystem, }; -use re_viewport_blueprint::SpaceViewBlueprint; +use re_viewport_blueprint::ViewBlueprint; pub fn visualizer_ui( ctx: &ViewContext<'_>, - space_view: &SpaceViewBlueprint, + view: &ViewBlueprint, entity_path: &EntityPath, ui: &mut egui::Ui, ) { - let query_result = ctx.lookup_query_result(space_view.id); + let query_result = ctx.lookup_query_result(view.id); let Some(data_result) = query_result .tree .lookup_result_by_path(entity_path) @@ -33,7 +33,7 @@ pub fn visualizer_ui( let available_inactive_visualizers = available_inactive_visualizers( ctx, ctx.recording(), - space_view, + view, &data_result, &active_visualizers, ); @@ -545,24 +545,24 @@ fn menu_add_new_visualizer( fn available_inactive_visualizers( ctx: &ViewContext<'_>, entity_db: &EntityDb, - space_view: &SpaceViewBlueprint, + view: &ViewBlueprint, data_result: &DataResult, active_visualizers: &[ViewSystemIdentifier], ) -> Vec { - // TODO(jleibs): This has already been computed for the SpaceView this frame. Maybe We - // should do this earlier and store it with the SpaceView? + // TODO(jleibs): This has already been computed for the View this frame. Maybe We + // should do this earlier and store it with the View? let applicable_entities_per_visualizer = ctx .viewer_ctx - .space_view_class_registry + .view_class_registry .applicable_entities_for_visualizer_systems(&entity_db.store_id()); - let visualizable_entities = space_view - .class(ctx.viewer_ctx.space_view_class_registry) + let visualizable_entities = view + .class(ctx.viewer_ctx.view_class_registry) .determine_visualizable_entities( &applicable_entities_per_visualizer, entity_db, &ctx.visualizer_collection, - &space_view.space_origin, + &view.space_origin, ); visualizable_entities diff --git a/crates/viewer/re_space_view/README.md b/crates/viewer/re_space_view/README.md deleted file mode 100644 index 6d7d97551845..000000000000 --- a/crates/viewer/re_space_view/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# re_space_view - -Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. - -[![Latest version](https://img.shields.io/crates/v/re_space_view.svg)](https://crates.io/crates/re_space_view) -[![Documentation](https://docs.rs/re_space_view/badge.svg)](https://docs.rs/re_space_view) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -Types & utilities for defining Space View classes and communicating with the Viewport. diff --git a/crates/viewer/re_space_view_bar_chart/README.md b/crates/viewer/re_space_view_bar_chart/README.md deleted file mode 100644 index c5a3b816c308..000000000000 --- a/crates/viewer/re_space_view_bar_chart/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# re_space_view_bar_chart - -Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. - -[![Latest version](https://img.shields.io/crates/v/re_space_view_bar_chart.svg)](https://crates.io/crates/re_space_view_bar_chart) -[![Documentation](https://docs.rs/re_space_view_bar_chart/badge.svg)](https://docs.rs/re_space_view_bar_chart) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -A Space View that shows a single bar chart. - diff --git a/crates/viewer/re_space_view_bar_chart/src/lib.rs b/crates/viewer/re_space_view_bar_chart/src/lib.rs deleted file mode 100644 index 0f7fa555edc9..000000000000 --- a/crates/viewer/re_space_view_bar_chart/src/lib.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! Rerun bar chart Space View. -//! -//! A Space View that shows a single bar chart. - -mod space_view_class; -mod visualizer_system; - -pub use space_view_class::BarChartSpaceView; diff --git a/crates/viewer/re_space_view_dataframe/README.md b/crates/viewer/re_space_view_dataframe/README.md deleted file mode 100644 index d819c16dbd74..000000000000 --- a/crates/viewer/re_space_view_dataframe/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# re_space_view_dataframe - -Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. - -[![Latest version](https://img.shields.io/crates/v/re_space_view_dataframe.svg)](https://crates.io/crates/re_space_view_dataframe) -[![Documentation](https://docs.rs/re_space_view_dataframe/badge.svg)](https://docs.rs/re_space_view_dataframe) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -A Space View that shows the data contained in entities in a table. diff --git a/crates/viewer/re_space_view_dataframe/src/lib.rs b/crates/viewer/re_space_view_dataframe/src/lib.rs deleted file mode 100644 index d3728e6defea..000000000000 --- a/crates/viewer/re_space_view_dataframe/src/lib.rs +++ /dev/null @@ -1,12 +0,0 @@ -//! Rerun `Data` Space View -//! -//! A Space View that shows the data contained in entities in a table. - -mod dataframe_ui; -mod display_record_batch; -mod expanded_rows; -mod space_view_class; -mod view_query; -mod visualizer_system; - -pub use space_view_class::DataframeSpaceView; diff --git a/crates/viewer/re_space_view_graph/README.md b/crates/viewer/re_space_view_graph/README.md deleted file mode 100644 index 258ce182e6d4..000000000000 --- a/crates/viewer/re_space_view_graph/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# re_space_view_graph - -Part of the [`rerun`](https://github.com/rerun-io/rerun?speculative-link) family of crates. - -[![Latest version](https://img.shields.io/crates/v/re_space_view_graph.svg)](https://crates.io/crates/re_space_view_graph?speculative-link) -[![Documentation](https://docs.rs/re_space_view_graph/badge.svg)](https://docs.rs/re_space_view_graph?speculative-link) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -A Space View that shows graphs (node-link diagrams). - diff --git a/crates/viewer/re_space_view_graph/src/lib.rs b/crates/viewer/re_space_view_graph/src/lib.rs deleted file mode 100644 index 17634033ab30..000000000000 --- a/crates/viewer/re_space_view_graph/src/lib.rs +++ /dev/null @@ -1,12 +0,0 @@ -//! Rerun Graph Space View. -//! -//! A Space View that shows a graph (node-link diagram). - -mod graph; -mod layout; -mod properties; -mod ui; -mod view; -mod visualizers; - -pub use view::GraphSpaceView; diff --git a/crates/viewer/re_space_view_map/README.md b/crates/viewer/re_space_view_map/README.md deleted file mode 100644 index 8a47a1f3f044..000000000000 --- a/crates/viewer/re_space_view_map/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# re_space_view_map - -Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. - -[![Latest version](https://img.shields.io/crates/v/re_space_view_map.svg)](https://crates.io/crates/re_space_view_spatial) -[![Documentation](https://docs.rs/re_space_view_map/badge.svg)](https://docs.rs/re_space_view_spatial) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -Space View that show GPS Coordinates on a map. diff --git a/crates/viewer/re_space_view_map/src/lib.rs b/crates/viewer/re_space_view_map/src/lib.rs deleted file mode 100644 index d46ba0f20d4b..000000000000 --- a/crates/viewer/re_space_view_map/src/lib.rs +++ /dev/null @@ -1,9 +0,0 @@ -//! Rerun map visualization Space View. -//! -//! A Space View that shows geographic objects on a map. - -mod map_overlays; -mod map_space_view; -mod visualizers; - -pub use map_space_view::MapSpaceView; diff --git a/crates/viewer/re_space_view_spatial/README.md b/crates/viewer/re_space_view_spatial/README.md deleted file mode 100644 index 365869b9bd61..000000000000 --- a/crates/viewer/re_space_view_spatial/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# re_space_view_spatial - -Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. - -[![Latest version](https://img.shields.io/crates/v/re_space_view_spatial.svg)](https://crates.io/crates/re_space_view_spatial) -[![Documentation](https://docs.rs/re_space_view_spatial/badge.svg)](https://docs.rs/re_space_view_spatial) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -Space Views that show entities in a 2D or 3D spatial relationship. diff --git a/crates/viewer/re_space_view_tensor/README.md b/crates/viewer/re_space_view_tensor/README.md deleted file mode 100644 index d65c29512558..000000000000 --- a/crates/viewer/re_space_view_tensor/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# re_space_view_tensor - -Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. - -[![Latest version](https://img.shields.io/crates/v/re_space_view_tensor.svg)](https://crates.io/crates/re_space_view_tensor) -[![Documentation](https://docs.rs/re_space_view_tensor/badge.svg)](https://docs.rs/re_space_view_tensor) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -A Space View dedicated to visualizing tensors with arbitrary dimensionality. - diff --git a/crates/viewer/re_space_view_tensor/src/lib.rs b/crates/viewer/re_space_view_tensor/src/lib.rs deleted file mode 100644 index 281d4c171eaa..000000000000 --- a/crates/viewer/re_space_view_tensor/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -//! Rerun tensor Space View. -//! -//! A Space View dedicated to visualizing tensors with arbitrary dimensionality. - -// TODO(#6330): remove unwrap() -#![allow(clippy::unwrap_used)] - -mod dimension_mapping; -mod space_view_class; -mod tensor_dimension_mapper; -mod tensor_slice_to_gpu; -mod visualizer_system; - -pub use space_view_class::TensorSpaceView; diff --git a/crates/viewer/re_space_view_text_document/README.md b/crates/viewer/re_space_view_text_document/README.md deleted file mode 100644 index b360d14bb3b7..000000000000 --- a/crates/viewer/re_space_view_text_document/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# re_space_view_text_document - -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_document.svg)](https://crates.io/crates/re_space_view_text_document) -[![Documentation](https://docs.rs/re_space_view_text_document/badge.svg)](https://docs.rs/re_space_view_text_document) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -A simple Space View that shows a single text box. diff --git a/crates/viewer/re_space_view_text_document/src/lib.rs b/crates/viewer/re_space_view_text_document/src/lib.rs deleted file mode 100644 index d0cbdc0e50bc..000000000000 --- a/crates/viewer/re_space_view_text_document/src/lib.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! Rerun Text Document Space View -//! -//! A simple Space View that shows a single text document. - -mod space_view_class; -mod visualizer_system; - -pub use space_view_class::TextDocumentSpaceView; diff --git a/crates/viewer/re_space_view_text_log/README.md b/crates/viewer/re_space_view_text_log/README.md deleted file mode 100644 index b6bfc6624a69..000000000000 --- a/crates/viewer/re_space_view_text_log/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# re_space_view_text_log - -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_log.svg)](https://crates.io/crates/re_space_view_text_log) -[![Documentation](https://docs.rs/re_space_view_text_log/badge.svg)](https://docs.rs/re_space_view_text_log) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -A Space View that shows text entries in a table and scrolls with the active time. - diff --git a/crates/viewer/re_space_view_text_log/src/lib.rs b/crates/viewer/re_space_view_text_log/src/lib.rs deleted file mode 100644 index 6066c0f6bd04..000000000000 --- a/crates/viewer/re_space_view_text_log/src/lib.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! Rerun `TextLog` Space View -//! -//! A Space View that shows `TextLog` entries in a table and scrolls with the active time. - -mod space_view_class; -mod visualizer_system; - -pub use space_view_class::TextSpaceView; diff --git a/crates/viewer/re_space_view_time_series/README.md b/crates/viewer/re_space_view_time_series/README.md deleted file mode 100644 index 140f554d0a2f..000000000000 --- a/crates/viewer/re_space_view_time_series/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# re_space_view_bar_chart - -Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. - -[![Latest version](https://img.shields.io/crates/v/re_space_view_bar_chart.svg)](https://crates.io/crates/re_space_view_bar_chart) -[![Documentation](https://docs.rs/re_space_view_bar_chart/badge.svg)](https://docs.rs/re_space_view_bar_chart) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -A Space View that shows plots over Rerun timelines. - diff --git a/crates/viewer/re_time_panel/src/lib.rs b/crates/viewer/re_time_panel/src/lib.rs index 8cb1807522a6..9393b2b01db2 100644 --- a/crates/viewer/re_time_panel/src/lib.rs +++ b/crates/viewer/re_time_panel/src/lib.rs @@ -1125,7 +1125,7 @@ fn paint_range_highlight( } fn help_button(ui: &mut egui::Ui) { - // TODO(andreas): Nicer help text like on space views. + // TODO(andreas): Nicer help text like on views. ui.help_hover_button().on_hover_text( "\ In the top row you can drag to move the time, or shift-drag to select a loop region.\n\ diff --git a/crates/viewer/re_ui/data/icons/spaceview_2d.png b/crates/viewer/re_ui/data/icons/view_2d.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_2d.png rename to crates/viewer/re_ui/data/icons/view_2d.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_3d.png b/crates/viewer/re_ui/data/icons/view_3d.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_3d.png rename to crates/viewer/re_ui/data/icons/view_3d.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_dataframe.png b/crates/viewer/re_ui/data/icons/view_dataframe.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_dataframe.png rename to crates/viewer/re_ui/data/icons/view_dataframe.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_generic.png b/crates/viewer/re_ui/data/icons/view_generic.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_generic.png rename to crates/viewer/re_ui/data/icons/view_generic.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_graph.png b/crates/viewer/re_ui/data/icons/view_graph.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_graph.png rename to crates/viewer/re_ui/data/icons/view_graph.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_histogram.png b/crates/viewer/re_ui/data/icons/view_histogram.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_histogram.png rename to crates/viewer/re_ui/data/icons/view_histogram.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_log.png b/crates/viewer/re_ui/data/icons/view_log.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_log.png rename to crates/viewer/re_ui/data/icons/view_log.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_map.png b/crates/viewer/re_ui/data/icons/view_map.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_map.png rename to crates/viewer/re_ui/data/icons/view_map.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_tensor.png b/crates/viewer/re_ui/data/icons/view_tensor.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_tensor.png rename to crates/viewer/re_ui/data/icons/view_tensor.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_text.png b/crates/viewer/re_ui/data/icons/view_text.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_text.png rename to crates/viewer/re_ui/data/icons/view_text.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_timeseries.png b/crates/viewer/re_ui/data/icons/view_timeseries.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_timeseries.png rename to crates/viewer/re_ui/data/icons/view_timeseries.png diff --git a/crates/viewer/re_ui/data/icons/spaceview_unknown.png b/crates/viewer/re_ui/data/icons/view_unknown.png similarity index 100% rename from crates/viewer/re_ui/data/icons/spaceview_unknown.png rename to crates/viewer/re_ui/data/icons/view_unknown.png diff --git a/crates/viewer/re_ui/examples/re_ui_example/right_panel.rs b/crates/viewer/re_ui/examples/re_ui_example/right_panel.rs index ddbf299a2e9d..680015615141 100644 --- a/crates/viewer/re_ui/examples/re_ui_example/right_panel.rs +++ b/crates/viewer/re_ui/examples/re_ui_example/right_panel.rs @@ -137,7 +137,7 @@ impl RightPanel { ui.list_item().show_hierarchical( ui, list_item::LabelContent::new("LabelContent with icon") - .with_icon(&re_ui::icons::SPACE_VIEW_TEXT), + .with_icon(&re_ui::icons::VIEW_TEXT), ); ui.list_item().show_hierarchical( @@ -179,7 +179,7 @@ impl RightPanel { list_item::LabelContent::new("LabelContent with custom styling") .subdued(true) .italics(true) - .with_icon(&re_ui::icons::SPACE_VIEW_2D), + .with_icon(&re_ui::icons::VIEW_2D), ) .on_hover_text("The styling applies to the icon."); @@ -188,7 +188,7 @@ impl RightPanel { ui, list_item::LabelContent::new("LabelContent with LabelStyle") .label_style(re_ui::LabelStyle::Unnamed) - .with_icon(&re_ui::icons::SPACE_VIEW_2D), + .with_icon(&re_ui::icons::VIEW_2D), ) .on_hover_text("The LabelStyle doesn't apply to the icon."); @@ -247,7 +247,7 @@ impl RightPanel { ui.list_item().show_hierarchical( ui, list_item::PropertyContent::new("Color") - .with_icon(&re_ui::icons::SPACE_VIEW_TEXT) + .with_icon(&re_ui::icons::VIEW_TEXT) .action_button(&re_ui::icons::ADD, || { re_log::warn!("Add button clicked"); }) @@ -257,7 +257,7 @@ impl RightPanel { ui.list_item().show_hierarchical( ui, list_item::PropertyContent::new("Color (editable)") - .with_icon(&re_ui::icons::SPACE_VIEW_TEXT) + .with_icon(&re_ui::icons::VIEW_TEXT) .action_button(&re_ui::icons::ADD, || { re_log::warn!("Add button clicked"); }) diff --git a/crates/viewer/re_ui/src/icons.rs b/crates/viewer/re_ui/src/icons.rs index 369385307abb..f63c83ba7108 100644 --- a/crates/viewer/re_ui/src/icons.rs +++ b/crates/viewer/re_ui/src/icons.rs @@ -96,18 +96,18 @@ pub const CONTAINER_GRID: Icon = icon_from_path!("../data/icons/container_grid.p pub const CONTAINER_TABS: Icon = icon_from_path!("../data/icons/container_tabs.png"); pub const CONTAINER_VERTICAL: Icon = icon_from_path!("../data/icons/container_vertical.png"); -pub const SPACE_VIEW_2D: Icon = icon_from_path!("../data/icons/spaceview_2d.png"); -pub const SPACE_VIEW_3D: Icon = icon_from_path!("../data/icons/spaceview_3d.png"); -pub const SPACE_VIEW_DATAFRAME: Icon = icon_from_path!("../data/icons/spaceview_dataframe.png"); -pub const SPACE_VIEW_GRAPH: Icon = icon_from_path!("../data/icons/spaceview_graph.png"); -pub const SPACE_VIEW_GENERIC: Icon = icon_from_path!("../data/icons/spaceview_generic.png"); -pub const SPACE_VIEW_HISTOGRAM: Icon = icon_from_path!("../data/icons/spaceview_histogram.png"); -pub const SPACE_VIEW_LOG: Icon = icon_from_path!("../data/icons/spaceview_log.png"); -pub const SPACE_VIEW_MAP: Icon = icon_from_path!("../data/icons/spaceview_map.png"); -pub const SPACE_VIEW_TENSOR: Icon = icon_from_path!("../data/icons/spaceview_tensor.png"); -pub const SPACE_VIEW_TEXT: Icon = icon_from_path!("../data/icons/spaceview_text.png"); -pub const SPACE_VIEW_TIMESERIES: Icon = icon_from_path!("../data/icons/spaceview_timeseries.png"); -pub const SPACE_VIEW_UNKNOWN: Icon = icon_from_path!("../data/icons/spaceview_unknown.png"); +pub const VIEW_2D: Icon = icon_from_path!("../data/icons/view_2d.png"); +pub const VIEW_3D: Icon = icon_from_path!("../data/icons/view_3d.png"); +pub const VIEW_DATAFRAME: Icon = icon_from_path!("../data/icons/view_dataframe.png"); +pub const VIEW_GRAPH: Icon = icon_from_path!("../data/icons/view_graph.png"); +pub const VIEW_GENERIC: Icon = icon_from_path!("../data/icons/view_generic.png"); +pub const VIEW_HISTOGRAM: Icon = icon_from_path!("../data/icons/view_histogram.png"); +pub const VIEW_LOG: Icon = icon_from_path!("../data/icons/view_log.png"); +pub const VIEW_MAP: Icon = icon_from_path!("../data/icons/view_map.png"); +pub const VIEW_TENSOR: Icon = icon_from_path!("../data/icons/view_tensor.png"); +pub const VIEW_TEXT: Icon = icon_from_path!("../data/icons/view_text.png"); +pub const VIEW_TIMESERIES: Icon = icon_from_path!("../data/icons/view_timeseries.png"); +pub const VIEW_UNKNOWN: Icon = icon_from_path!("../data/icons/view_unknown.png"); pub const GROUP: Icon = icon_from_path!("../data/icons/group.png"); pub const ENTITY: Icon = icon_from_path!("../data/icons/entity.png"); diff --git a/crates/viewer/re_ui/src/lib.rs b/crates/viewer/re_ui/src/lib.rs index 91266b9dd620..3bbc851676fb 100644 --- a/crates/viewer/re_ui/src/lib.rs +++ b/crates/viewer/re_ui/src/lib.rs @@ -66,7 +66,7 @@ pub enum LabelStyle { #[default] Normal, - /// Label displaying the placeholder text for a yet unnamed item (e.g. an unnamed space view). + /// Label displaying the placeholder text for a yet unnamed item (e.g. an unnamed view). Unnamed, } diff --git a/crates/viewer/re_ui/src/list_item/label_content.rs b/crates/viewer/re_ui/src/list_item/label_content.rs index 0e4418e0b85b..086d1f315397 100644 --- a/crates/viewer/re_ui/src/list_item/label_content.rs +++ b/crates/viewer/re_ui/src/list_item/label_content.rs @@ -45,7 +45,7 @@ impl<'a> LabelContent<'a> { /// /// Note: takes precedence over [`Self::weak`] if set. // TODO(ab): this is a hack to implement the behavior of the blueprint tree UI, where active - // widget are displayed in a subdued state (container, hidden space views/entities). One + // widget are displayed in a subdued state (container, hidden views/entities). One // slightly more correct way would be to override the color using a (color, index) pair // related to the design system table. #[inline] diff --git a/crates/viewer/re_ui/tests/list_item_tests.rs b/crates/viewer/re_ui/tests/list_item_tests.rs index 64dea7a910fa..424875ebe8e9 100644 --- a/crates/viewer/re_ui/tests/list_item_tests.rs +++ b/crates/viewer/re_ui/tests/list_item_tests.rs @@ -32,7 +32,7 @@ pub fn test_list_items_should_match_snapshot() { ui.list_item().show_hierarchical( ui, list_item::LabelContent::new("LabelContent with icon") - .with_icon(&re_ui::icons::SPACE_VIEW_TEXT), + .with_icon(&re_ui::icons::VIEW_TEXT), ); ui.list_item().show_hierarchical( @@ -74,7 +74,7 @@ pub fn test_list_items_should_match_snapshot() { list_item::LabelContent::new("LabelContent with custom styling") .subdued(true) .italics(true) - .with_icon(&re_ui::icons::SPACE_VIEW_2D), + .with_icon(&re_ui::icons::VIEW_2D), ) .on_hover_text("The styling applies to the icon."); @@ -83,7 +83,7 @@ pub fn test_list_items_should_match_snapshot() { ui, list_item::LabelContent::new("LabelContent with LabelStyle") .label_style(re_ui::LabelStyle::Unnamed) - .with_icon(&re_ui::icons::SPACE_VIEW_2D), + .with_icon(&re_ui::icons::VIEW_2D), ) .on_hover_text("The LabelStyle doesn't apply to the icon."); @@ -142,7 +142,7 @@ pub fn test_list_items_should_match_snapshot() { ui.list_item().show_hierarchical( ui, list_item::PropertyContent::new("Color") - .with_icon(&re_ui::icons::SPACE_VIEW_TEXT) + .with_icon(&re_ui::icons::VIEW_TEXT) .action_button(&re_ui::icons::ADD, || { re_log::warn!("Add button clicked"); }) @@ -152,7 +152,7 @@ pub fn test_list_items_should_match_snapshot() { ui.list_item().show_hierarchical( ui, list_item::PropertyContent::new("Color (editable)") - .with_icon(&re_ui::icons::SPACE_VIEW_TEXT) + .with_icon(&re_ui::icons::VIEW_TEXT) .action_button(&re_ui::icons::ADD, || { re_log::warn!("Add button clicked"); }) diff --git a/crates/viewer/re_space_view/Cargo.toml b/crates/viewer/re_view/Cargo.toml similarity index 87% rename from crates/viewer/re_space_view/Cargo.toml rename to crates/viewer/re_view/Cargo.toml index 64993d91ecb7..6bfd5705e581 100644 --- a/crates/viewer/re_space_view/Cargo.toml +++ b/crates/viewer/re_view/Cargo.toml @@ -1,10 +1,10 @@ [package] authors.workspace = true -description = "Types & utilities for defining space view classes and communicating with the viewport." +description = "Types & utilities for defining view classes and communicating with the viewport." edition.workspace = true homepage.workspace = true license.workspace = true -name = "re_space_view" +name = "re_view" publish = true readme = "README.md" repository.workspace = true diff --git a/crates/viewer/re_view/README.md b/crates/viewer/re_view/README.md new file mode 100644 index 000000000000..54410b016536 --- /dev/null +++ b/crates/viewer/re_view/README.md @@ -0,0 +1,10 @@ +# re_view + +Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. + +[![Latest version](https://img.shields.io/crates/v/re_view.svg)](https://crates.io/crates/re_view) +[![Documentation](https://docs.rs/re_view/badge.svg?speculative-link)](https://docs.rs/re_view?speculative-link) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +Types & utilities for defining View classes and communicating with the Viewport. diff --git a/crates/viewer/re_space_view/src/annotation_context_utils.rs b/crates/viewer/re_view/src/annotation_context_utils.rs similarity index 100% rename from crates/viewer/re_space_view/src/annotation_context_utils.rs rename to crates/viewer/re_view/src/annotation_context_utils.rs diff --git a/crates/viewer/re_space_view/src/annotation_scene_context.rs b/crates/viewer/re_view/src/annotation_scene_context.rs similarity index 100% rename from crates/viewer/re_space_view/src/annotation_scene_context.rs rename to crates/viewer/re_view/src/annotation_scene_context.rs diff --git a/crates/viewer/re_space_view/src/controls.rs b/crates/viewer/re_view/src/controls.rs similarity index 100% rename from crates/viewer/re_space_view/src/controls.rs rename to crates/viewer/re_view/src/controls.rs diff --git a/crates/viewer/re_space_view/src/empty_space_view_state.rs b/crates/viewer/re_view/src/empty_view_state.rs similarity index 50% rename from crates/viewer/re_space_view/src/empty_space_view_state.rs rename to crates/viewer/re_view/src/empty_view_state.rs index fb5c2741457d..4f428f1cb165 100644 --- a/crates/viewer/re_space_view/src/empty_space_view_state.rs +++ b/crates/viewer/re_view/src/empty_view_state.rs @@ -1,10 +1,10 @@ -use re_viewer_context::SpaceViewState; +use re_viewer_context::ViewState; -/// Space View state without any contents. +/// View state without any contents. #[derive(Default)] -pub struct EmptySpaceViewState; +pub struct EmptyViewState; -impl SpaceViewState for EmptySpaceViewState { +impl ViewState for EmptyViewState { fn as_any(&self) -> &dyn std::any::Any { self } diff --git a/crates/viewer/re_space_view/src/heuristics.rs b/crates/viewer/re_view/src/heuristics.rs similarity index 53% rename from crates/viewer/re_space_view/src/heuristics.rs rename to crates/viewer/re_view/src/heuristics.rs index 6968c15cdaa8..72fbfed03d25 100644 --- a/crates/viewer/re_space_view/src/heuristics.rs +++ b/crates/viewer/re_view/src/heuristics.rs @@ -1,16 +1,16 @@ use re_viewer_context::{ - ApplicableEntities, IdentifiedViewSystem, RecommendedSpaceView, SpaceViewClass, - SpaceViewSpawnHeuristics, ViewerContext, VisualizerSystem, + ApplicableEntities, IdentifiedViewSystem, RecommendedView, ViewClass, ViewSpawnHeuristics, + ViewerContext, VisualizerSystem, }; -/// Spawns a space view for each single entity which is visualizable & indicator-matching for a given visualizer. +/// Spawns a view for each single entity which is visualizable & indicator-matching for a given visualizer. /// -/// This is used as utility by *some* space view types that want -/// to spawn a space view for every single entity that is visualizable with a given visualizer. -pub fn suggest_space_view_for_each_entity( +/// This is used as utility by *some* view types that want +/// to spawn a view for every single entity that is visualizable with a given visualizer. +pub fn suggest_view_for_each_entity( ctx: &ViewerContext<'_>, - space_view: &impl SpaceViewClass, -) -> SpaceViewSpawnHeuristics + view: &impl ViewClass, +) -> ViewSpawnHeuristics where TVisualizer: VisualizerSystem + IdentifiedViewSystem + Default, { @@ -30,10 +30,10 @@ where }; let visualizer = TVisualizer::default(); - let recommended_space_views = applicable_entities + let recommended_views = applicable_entities .intersection(indicator_matching_entities) .filter_map(|entity| { - let context = space_view.visualizable_filter_context(entity, ctx.recording()); + let context = view.visualizable_filter_context(entity, ctx.recording()); if visualizer .filter_visualizable_entities( ApplicableEntities(std::iter::once(entity.clone()).collect()), @@ -43,9 +43,9 @@ where { None } else { - Some(RecommendedSpaceView::new_single_entity(entity.clone())) + Some(RecommendedView::new_single_entity(entity.clone())) } }); - re_viewer_context::SpaceViewSpawnHeuristics::new(recommended_space_views) + re_viewer_context::ViewSpawnHeuristics::new(recommended_views) } diff --git a/crates/viewer/re_space_view/src/instance_hash_conversions.rs b/crates/viewer/re_view/src/instance_hash_conversions.rs similarity index 100% rename from crates/viewer/re_space_view/src/instance_hash_conversions.rs rename to crates/viewer/re_view/src/instance_hash_conversions.rs diff --git a/crates/viewer/re_space_view/src/lib.rs b/crates/viewer/re_view/src/lib.rs similarity index 92% rename from crates/viewer/re_space_view/src/lib.rs rename to crates/viewer/re_view/src/lib.rs index c5b00e0a94a7..a6507629f525 100644 --- a/crates/viewer/re_space_view/src/lib.rs +++ b/crates/viewer/re_view/src/lib.rs @@ -1,6 +1,6 @@ -//! Rerun Space View utilities +//! Rerun View utilities //! -//! Types & utilities for defining Space View classes and communicating with the Viewport. +//! Types & utilities for defining View classes and communicating with the Viewport. pub mod controls; @@ -17,7 +17,7 @@ pub use annotation_context_utils::{ process_annotation_and_keypoint_slices, process_annotation_slices, process_color_slice, }; pub use annotation_scene_context::AnnotationSceneContext; -pub use heuristics::suggest_space_view_for_each_entity; +pub use heuristics::suggest_view_for_each_entity; pub use instance_hash_conversions::{ instance_path_hash_from_picking_layer_id, picking_layer_id_from_instance_path_hash, }; diff --git a/crates/viewer/re_space_view/src/outlines.rs b/crates/viewer/re_view/src/outlines.rs similarity index 100% rename from crates/viewer/re_space_view/src/outlines.rs rename to crates/viewer/re_view/src/outlines.rs diff --git a/crates/viewer/re_space_view/src/query.rs b/crates/viewer/re_view/src/query.rs similarity index 100% rename from crates/viewer/re_space_view/src/query.rs rename to crates/viewer/re_view/src/query.rs diff --git a/crates/viewer/re_space_view/src/results_ext.rs b/crates/viewer/re_view/src/results_ext.rs similarity index 99% rename from crates/viewer/re_space_view/src/results_ext.rs rename to crates/viewer/re_view/src/results_ext.rs index 55e52be3e00a..71eca73654c3 100644 --- a/crates/viewer/re_space_view/src/results_ext.rs +++ b/crates/viewer/re_view/src/results_ext.rs @@ -220,7 +220,7 @@ impl From<(RangeQuery, HybridRangeResults)> for HybridResults<'_> { } } -/// Extension traits to abstract query result handling for all spatial space views. +/// Extension traits to abstract query result handling for all spatial views. /// /// Also turns all results into range results, so that views only have to worry about the ranged /// case. diff --git a/crates/viewer/re_space_view/src/view_property_ui.rs b/crates/viewer/re_view/src/view_property_ui.rs similarity index 97% rename from crates/viewer/re_space_view/src/view_property_ui.rs rename to crates/viewer/re_view/src/view_property_ui.rs index f9e174f7487d..995a3825803b 100644 --- a/crates/viewer/re_space_view/src/view_property_ui.rs +++ b/crates/viewer/re_view/src/view_property_ui.rs @@ -3,8 +3,7 @@ use re_types_core::{ }; use re_ui::{list_item, UiExt as _}; use re_viewer_context::{ - ComponentFallbackProvider, ComponentUiTypes, QueryContext, SpaceViewId, SpaceViewState, - ViewerContext, + ComponentFallbackProvider, ComponentUiTypes, QueryContext, ViewId, ViewState, ViewerContext, }; use re_viewport_blueprint::ViewProperty; @@ -14,9 +13,9 @@ use re_viewport_blueprint::ViewProperty; pub fn view_property_ui( ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - view_id: SpaceViewId, + view_id: ViewId, fallback_provider: &dyn ComponentFallbackProvider, - view_state: &dyn SpaceViewState, + view_state: &dyn ViewState, ) { let view_property = ViewProperty::from_archetype::(ctx.blueprint_db(), ctx.blueprint_query, view_id); @@ -28,7 +27,7 @@ fn view_property_ui_impl( ui: &mut egui::Ui, property: &ViewProperty, fallback_provider: &dyn ComponentFallbackProvider, - view_state: &dyn SpaceViewState, + view_state: &dyn ViewState, ) { let Some(reflection) = ctx.reflection.archetypes.get(&property.archetype_name) else { // The `ArchetypeReflectionMarker` bound should make this impossible. diff --git a/crates/viewer/re_space_view_bar_chart/Cargo.toml b/crates/viewer/re_view_bar_chart/Cargo.toml similarity index 84% rename from crates/viewer/re_space_view_bar_chart/Cargo.toml rename to crates/viewer/re_view_bar_chart/Cargo.toml index d73dd8d7f448..12b8c5f01476 100644 --- a/crates/viewer/re_space_view_bar_chart/Cargo.toml +++ b/crates/viewer/re_view_bar_chart/Cargo.toml @@ -1,10 +1,10 @@ [package] authors.workspace = true -description = "A space view that shows a single bar chart." +description = "A view that shows a single bar chart." edition.workspace = true homepage.workspace = true license.workspace = true -name = "re_space_view_bar_chart" +name = "re_view_bar_chart" publish = true readme = "README.md" repository.workspace = true @@ -23,7 +23,7 @@ re_chunk_store.workspace = true re_entity_db.workspace = true re_log_types.workspace = true re_renderer.workspace = true -re_space_view.workspace = true +re_view.workspace = true re_tracing.workspace = true re_types = { workspace = true, features = ["egui_plot"] } re_ui.workspace = true diff --git a/crates/viewer/re_view_bar_chart/README.md b/crates/viewer/re_view_bar_chart/README.md new file mode 100644 index 000000000000..524f0772e339 --- /dev/null +++ b/crates/viewer/re_view_bar_chart/README.md @@ -0,0 +1,11 @@ +# re_view_bar_chart + +Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. + +[![Latest version](https://img.shields.io/crates/v/re_view_bar_chart.svg)](https://crates.io/crates/re_view_bar_chart) +[![Documentation](https://docs.rs/re_view_bar_chart/badge.svg??speculative-link)](https://docs.rs/re_view_bar_chart?speculative-link) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +A View that shows a single bar chart. + diff --git a/crates/viewer/re_view_bar_chart/src/lib.rs b/crates/viewer/re_view_bar_chart/src/lib.rs new file mode 100644 index 000000000000..5b9d8118b6c0 --- /dev/null +++ b/crates/viewer/re_view_bar_chart/src/lib.rs @@ -0,0 +1,8 @@ +//! Rerun bar chart View. +//! +//! A View that shows a single bar chart. + +mod view_class; +mod visualizer_system; + +pub use view_class::BarChartView; diff --git a/crates/viewer/re_space_view_bar_chart/src/space_view_class.rs b/crates/viewer/re_view_bar_chart/src/view_class.rs similarity index 82% rename from crates/viewer/re_space_view_bar_chart/src/space_view_class.rs rename to crates/viewer/re_view_bar_chart/src/view_class.rs index bb55311d7e39..baa7b8eee48d 100644 --- a/crates/viewer/re_space_view_bar_chart/src/space_view_class.rs +++ b/crates/viewer/re_view_bar_chart/src/view_class.rs @@ -1,32 +1,31 @@ use egui::ahash::HashMap; use re_log_types::EntityPath; -use re_space_view::controls::{ - ASPECT_SCROLL_MODIFIER, HORIZONTAL_SCROLL_MODIFIER, SELECTION_RECT_ZOOM_BUTTON, - ZOOM_SCROLL_MODIFIER, -}; -use re_space_view::{controls, suggest_space_view_for_each_entity, view_property_ui}; use re_types::blueprint::archetypes::PlotLegend; use re_types::blueprint::components::{Corner2D, Visible}; use re_types::View; -use re_types::{datatypes::TensorBuffer, SpaceViewClassIdentifier}; +use re_types::{datatypes::TensorBuffer, ViewClassIdentifier}; use re_ui::{list_item, ModifiersMarkdown, MouseButtonMarkdown}; +use re_view::controls::{ + ASPECT_SCROLL_MODIFIER, HORIZONTAL_SCROLL_MODIFIER, SELECTION_RECT_ZOOM_BUTTON, + ZOOM_SCROLL_MODIFIER, +}; +use re_view::{controls, suggest_view_for_each_entity, view_property_ui}; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem as _, IndicatedEntities, PerVisualizer, - SpaceViewClass, SpaceViewClassRegistryError, SpaceViewId, SpaceViewState, SpaceViewStateExt, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewQuery, ViewerContext, - VisualizableEntities, + TypedComponentFallbackProvider, ViewClass, ViewClassRegistryError, ViewId, ViewQuery, + ViewState, ViewStateExt, ViewSystemExecutionError, ViewerContext, VisualizableEntities, }; use re_viewport_blueprint::ViewProperty; use super::visualizer_system::BarChartVisualizerSystem; #[derive(Default)] -pub struct BarChartSpaceView; +pub struct BarChartView; type ViewType = re_types::blueprint::views::BarChartView; -impl SpaceViewClass for BarChartSpaceView { - fn identifier() -> SpaceViewClassIdentifier { +impl ViewClass for BarChartView { + fn identifier() -> ViewClassIdentifier { ViewType::identifier() } @@ -35,10 +34,10 @@ impl SpaceViewClass for BarChartSpaceView { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_HISTOGRAM + &re_ui::icons::VIEW_HISTOGRAM } - fn new_state(&self) -> Box { + fn new_state(&self) -> Box { Box::<()>::default() } @@ -64,12 +63,12 @@ Display a 1D tensor as a bar chart. fn on_register( &self, - system_registry: &mut re_viewer_context::SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut re_viewer_context::ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { system_registry.register_visualizer::() } - fn preferred_tile_aspect_ratio(&self, _state: &dyn SpaceViewState) -> Option { + fn preferred_tile_aspect_ratio(&self, _state: &dyn ViewState) -> Option { None } @@ -95,28 +94,25 @@ Display a 1D tensor as a bar chart. } } - fn spawn_heuristics( - &self, - ctx: &ViewerContext<'_>, - ) -> re_viewer_context::SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> re_viewer_context::ViewSpawnHeuristics { re_tracing::profile_function!(); - suggest_space_view_for_each_entity::(ctx, self) + suggest_view_for_each_entity::(ctx, self) } - fn layout_priority(&self) -> re_viewer_context::SpaceViewClassLayoutPriority { - re_viewer_context::SpaceViewClassLayoutPriority::Low + fn layout_priority(&self) -> re_viewer_context::ViewClassLayoutPriority { + re_viewer_context::ViewClassLayoutPriority::Low } fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _space_origin: &EntityPath, - space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { + view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { list_item::list_item_scope(ui, "time_series_selection_ui", |ui| { - view_property_ui::(ctx, ui, space_view_id, self, state); + view_property_ui::(ctx, ui, view_id, self, state); }); Ok(()) @@ -126,17 +122,17 @@ Display a 1D tensor as a bar chart. &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, query: &ViewQuery<'_>, system_output: re_viewer_context::SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { use egui_plot::{Bar, BarChart, Legend, Plot}; let state = state.downcast_mut::<()>()?; let blueprint_db = ctx.blueprint_db(); - let view_id = query.space_view_id; + let view_id = query.view_id; let charts = &system_output .view_systems @@ -244,10 +240,7 @@ Display a 1D tensor as a bar chart. { ctx.select_hovered_on_click( &response, - re_viewer_context::Item::DataResult( - query.space_view_id, - entity_path.clone().into(), - ), + re_viewer_context::Item::DataResult(query.view_id, entity_path.clone().into()), ); } }); @@ -256,7 +249,7 @@ Display a 1D tensor as a bar chart. } } -impl TypedComponentFallbackProvider for BarChartSpaceView { +impl TypedComponentFallbackProvider for BarChartView { fn fallback_for(&self, _ctx: &re_viewer_context::QueryContext<'_>) -> Corner2D { // Explicitly pick RightCorner2D::RightTop, we don't want to make this dependent on the (arbitrary) // default of Corner2D @@ -264,4 +257,4 @@ impl TypedComponentFallbackProvider for BarChartSpaceView { } } -re_viewer_context::impl_component_fallback_provider!(BarChartSpaceView => [Corner2D]); +re_viewer_context::impl_component_fallback_provider!(BarChartView => [Corner2D]); diff --git a/crates/viewer/re_space_view_bar_chart/src/visualizer_system.rs b/crates/viewer/re_view_bar_chart/src/visualizer_system.rs similarity index 91% rename from crates/viewer/re_space_view_bar_chart/src/visualizer_system.rs rename to crates/viewer/re_view_bar_chart/src/visualizer_system.rs index dd21aeb16e0e..52055dd46323 100644 --- a/crates/viewer/re_space_view_bar_chart/src/visualizer_system.rs +++ b/crates/viewer/re_view_bar_chart/src/visualizer_system.rs @@ -3,15 +3,15 @@ use std::collections::BTreeMap; use re_chunk_store::ChunkStoreEvent; use re_chunk_store::LatestAtQuery; use re_entity_db::EntityPath; -use re_space_view::{diff_component_filter, DataResultQuery as _}; use re_types::{ archetypes::BarChart, components::{self}, datatypes, }; +use re_view::{diff_component_filter, DataResultQuery as _}; use re_viewer_context::{ - auto_color_for_entity_path, IdentifiedViewSystem, QueryContext, SpaceViewSystemExecutionError, - TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + auto_color_for_entity_path, IdentifiedViewSystem, QueryContext, TypedComponentFallbackProvider, + ViewContext, ViewContextCollection, ViewQuery, ViewSystemExecutionError, VisualizerAdditionalApplicabilityFilter, VisualizerQueryInfo, VisualizerSystem, }; @@ -52,7 +52,7 @@ impl VisualizerSystem for BarChartVisualizerSystem { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, _context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let timeline_query = LatestAtQuery::new(view_query.timeline, view_query.latest_at); for data_result in view_query.iter_visible_data_results(ctx, Self::identifier()) { diff --git a/crates/viewer/re_space_view_dataframe/Cargo.toml b/crates/viewer/re_view_dataframe/Cargo.toml similarity index 87% rename from crates/viewer/re_space_view_dataframe/Cargo.toml rename to crates/viewer/re_view_dataframe/Cargo.toml index 82fdcda19ae8..871c6cab85f9 100644 --- a/crates/viewer/re_space_view_dataframe/Cargo.toml +++ b/crates/viewer/re_view_dataframe/Cargo.toml @@ -1,10 +1,10 @@ [package] authors.workspace = true -description = "A space view that shows the data contained in entities in a table." +description = "A view that shows the data contained in entities in a table." edition.workspace = true homepage.workspace = true license.workspace = true -name = "re_space_view_dataframe" +name = "re_view_dataframe" publish = true readme = "README.md" repository.workspace = true diff --git a/crates/viewer/re_view_dataframe/README.md b/crates/viewer/re_view_dataframe/README.md new file mode 100644 index 000000000000..23fc1c7eee2f --- /dev/null +++ b/crates/viewer/re_view_dataframe/README.md @@ -0,0 +1,10 @@ +# re_view_dataframe + +Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. + +[![Latest version](https://img.shields.io/crates/v/re_view_dataframe.svg)](https://crates.io/crates/re_view_dataframe) +[![Documentation](https://docs.rs/re_view_dataframe/badge.svg?speculative-link)](https://docs.rs/re_view_dataframe?speculative-link) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +A View that shows the data contained in entities in a table. diff --git a/crates/viewer/re_space_view_dataframe/src/dataframe_ui.rs b/crates/viewer/re_view_dataframe/src/dataframe_ui.rs similarity index 99% rename from crates/viewer/re_space_view_dataframe/src/dataframe_ui.rs rename to crates/viewer/re_view_dataframe/src/dataframe_ui.rs index 45956a268792..3c01daa5ddd4 100644 --- a/crates/viewer/re_space_view_dataframe/src/dataframe_ui.rs +++ b/crates/viewer/re_view_dataframe/src/dataframe_ui.rs @@ -12,7 +12,7 @@ use re_dataframe::QueryHandle; use re_log_types::{EntityPath, TimeInt, Timeline, TimelineName}; use re_types_core::ComponentName; use re_ui::UiExt as _; -use re_viewer_context::{SpaceViewId, SystemCommandSender, ViewerContext}; +use re_viewer_context::{SystemCommandSender, ViewId, ViewerContext}; use crate::display_record_batch::{DisplayRecordBatch, DisplayRecordBatchError}; use crate::expanded_rows::{ExpandedRows, ExpandedRowsCache}; @@ -35,7 +35,7 @@ pub(crate) fn dataframe_ui( ui: &mut egui::Ui, query_handle: &re_dataframe::QueryHandle, expanded_rows_cache: &mut ExpandedRowsCache, - space_view_id: &SpaceViewId, + view_id: &ViewId, ) -> Vec { re_tracing::profile_function!(); @@ -48,13 +48,13 @@ pub(crate) fn dataframe_ui( // The table id mainly drives column widths, along with the id of each column. Empirically, the // user experience is better if we have stable column width even when the query changes (which // can, in turn, change the column's content). - let table_id_salt = egui::Id::new("__dataframe__").with(space_view_id); + let table_id_salt = egui::Id::new("__dataframe__").with(view_id); // For the row expansion cache, we invalidate more aggressively for now, because the expanded // state is stored against a row index (not unique id like columns). This means rows will more // often auto-collapse when the query is modified. let row_expansion_id_salt = egui::Id::new("__dataframe_row_exp__") - .with(space_view_id) + .with(view_id) .with(&selected_columns) .with(query_handle.query()); diff --git a/crates/viewer/re_space_view_dataframe/src/display_record_batch.rs b/crates/viewer/re_view_dataframe/src/display_record_batch.rs similarity index 100% rename from crates/viewer/re_space_view_dataframe/src/display_record_batch.rs rename to crates/viewer/re_view_dataframe/src/display_record_batch.rs diff --git a/crates/viewer/re_space_view_dataframe/src/expanded_rows.rs b/crates/viewer/re_view_dataframe/src/expanded_rows.rs similarity index 99% rename from crates/viewer/re_space_view_dataframe/src/expanded_rows.rs rename to crates/viewer/re_view_dataframe/src/expanded_rows.rs index 8e178ce5906e..2e256b40e32d 100644 --- a/crates/viewer/re_space_view_dataframe/src/expanded_rows.rs +++ b/crates/viewer/re_view_dataframe/src/expanded_rows.rs @@ -2,7 +2,7 @@ use std::collections::BTreeMap; /// Storage for [`ExpandedRows`], which should be persisted across frames. /// -/// Note: each view should store its own cache. Using a [`re_viewer_context::SpaceViewState`] is a +/// Note: each view should store its own cache. Using a [`re_viewer_context::ViewState`] is a /// good way to do this. #[derive(Debug, Clone)] pub(crate) struct ExpandedRowsCache { diff --git a/crates/viewer/re_view_dataframe/src/lib.rs b/crates/viewer/re_view_dataframe/src/lib.rs new file mode 100644 index 000000000000..b1ed2d345a1d --- /dev/null +++ b/crates/viewer/re_view_dataframe/src/lib.rs @@ -0,0 +1,12 @@ +//! Rerun `Data` View +//! +//! A View that shows the data contained in entities in a table. + +mod dataframe_ui; +mod display_record_batch; +mod expanded_rows; +mod view_class; +mod view_query; +mod visualizer_system; + +pub use view_class::DataframeView; diff --git a/crates/viewer/re_space_view_dataframe/src/space_view_class.rs b/crates/viewer/re_view_dataframe/src/view_class.rs similarity index 72% rename from crates/viewer/re_space_view_dataframe/src/space_view_class.rs rename to crates/viewer/re_view_dataframe/src/view_class.rs index 4c596f3af180..8e6d4d290d9f 100644 --- a/crates/viewer/re_space_view_dataframe/src/space_view_class.rs +++ b/crates/viewer/re_view_dataframe/src/view_class.rs @@ -7,14 +7,14 @@ use crate::{ use re_chunk_store::{ColumnDescriptor, SparseFillStrategy}; use re_dataframe::QueryEngine; use re_log_types::EntityPath; -use re_types_core::SpaceViewClassIdentifier; +use re_types_core::ViewClassIdentifier; use re_viewer_context::{ - SpaceViewClass, SpaceViewClassRegistryError, SpaceViewId, SpaceViewState, SpaceViewStateExt, - SpaceViewSystemExecutionError, SystemExecutionOutput, ViewQuery, ViewerContext, + SystemExecutionOutput, ViewClass, ViewClassRegistryError, ViewId, ViewQuery, ViewState, + ViewStateExt, ViewSystemExecutionError, ViewerContext, }; #[derive(Default)] -struct DataframeSpaceViewState { +struct DataframeViewState { /// Cache for the expanded rows. expended_rows_cache: ExpandedRowsCache, @@ -22,7 +22,7 @@ struct DataframeSpaceViewState { view_columns: Option>, } -impl SpaceViewState for DataframeSpaceViewState { +impl ViewState for DataframeViewState { fn as_any(&self) -> &dyn Any { self } @@ -33,10 +33,10 @@ impl SpaceViewState for DataframeSpaceViewState { } #[derive(Default)] -pub struct DataframeSpaceView; +pub struct DataframeView; -impl SpaceViewClass for DataframeSpaceView { - fn identifier() -> SpaceViewClassIdentifier { +impl ViewClass for DataframeView { + fn identifier() -> ViewClassIdentifier { "Dataframe".into() } @@ -45,7 +45,7 @@ impl SpaceViewClass for DataframeSpaceView { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_DATAFRAME + &re_ui::icons::VIEW_DATAFRAME } fn help_markdown(&self, _egui_ctx: &egui::Context) -> String { @@ -72,27 +72,24 @@ mode sets the default time range to _everything_. You can override this in the s fn on_register( &self, - system_registry: &mut re_viewer_context::SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut re_viewer_context::ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { system_registry.register_visualizer::() } - fn new_state(&self) -> Box { - Box::::default() + fn new_state(&self) -> Box { + Box::::default() } - fn preferred_tile_aspect_ratio(&self, _state: &dyn SpaceViewState) -> Option { + fn preferred_tile_aspect_ratio(&self, _state: &dyn ViewState) -> Option { None } - fn layout_priority(&self) -> re_viewer_context::SpaceViewClassLayoutPriority { - re_viewer_context::SpaceViewClassLayoutPriority::Low + fn layout_priority(&self) -> re_viewer_context::ViewClassLayoutPriority { + re_viewer_context::ViewClassLayoutPriority::Low } - fn spawn_heuristics( - &self, - _ctx: &ViewerContext<'_>, - ) -> re_viewer_context::SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, _ctx: &ViewerContext<'_>) -> re_viewer_context::ViewSpawnHeuristics { // Doesn't spawn anything by default. Default::default() } @@ -101,32 +98,32 @@ mode sets the default time range to _everything_. You can override this in the s &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _space_origin: &EntityPath, - space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { - let state = state.downcast_mut::()?; - let view_query = view_query::Query::from_blueprint(ctx, space_view_id); + view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { + let state = state.downcast_mut::()?; + let view_query = view_query::Query::from_blueprint(ctx, view_id); let Some(view_columns) = &state.view_columns else { // Shouldn't happen, except maybe on the first frame, which is too early // for the user to click the menu anyway. return Ok(()); }; - view_query.selection_panel_ui(ctx, ui, space_view_id, view_columns) + view_query.selection_panel_ui(ctx, ui, view_id, view_columns) } fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, query: &ViewQuery<'_>, _system_output: SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); - let state = state.downcast_mut::()?; - let view_query = view_query::Query::from_blueprint(ctx, query.space_view_id); + let state = state.downcast_mut::()?; + let view_query = view_query::Query::from_blueprint(ctx, query.view_id); let query_engine = QueryEngine { engine: ctx.recording().storage_engine_arc(), @@ -170,7 +167,7 @@ mode sets the default time range to _everything_. You can override this in the s ui, &query_handle, &mut state.expended_rows_cache, - &query.space_view_id, + &query.view_id, ); view_query.handle_hide_column_actions(ctx, &view_columns, hide_column_actions)?; @@ -180,4 +177,4 @@ mode sets the default time range to _everything_. You can override this in the s } } -re_viewer_context::impl_component_fallback_provider!(DataframeSpaceView => []); +re_viewer_context::impl_component_fallback_provider!(DataframeView => []); diff --git a/crates/viewer/re_space_view_dataframe/src/view_query/blueprint.rs b/crates/viewer/re_view_dataframe/src/view_query/blueprint.rs similarity index 93% rename from crates/viewer/re_space_view_dataframe/src/view_query/blueprint.rs rename to crates/viewer/re_view_dataframe/src/view_query/blueprint.rs index aaae97e5ff5d..18429831d8d5 100644 --- a/crates/viewer/re_space_view_dataframe/src/view_query/blueprint.rs +++ b/crates/viewer/re_view_dataframe/src/view_query/blueprint.rs @@ -5,7 +5,7 @@ use crate::view_query::Query; use re_chunk_store::{ColumnDescriptor, ColumnSelector, ComponentColumnSelector}; use re_log_types::{EntityPath, ResolvedTimeRange, TimelineName}; use re_types::blueprint::{components, datatypes}; -use re_viewer_context::{SpaceViewSystemExecutionError, ViewerContext}; +use re_viewer_context::{ViewSystemExecutionError, ViewerContext}; // Accessors wrapping reads/writes to the blueprint store. impl Query { @@ -16,7 +16,7 @@ impl Query { pub(crate) fn timeline( &self, ctx: &ViewerContext<'_>, - ) -> Result { + ) -> Result { // read the timeline and make sure it actually exists let timeline = self .query_property @@ -51,9 +51,7 @@ impl Query { .clear_blueprint_component::(ctx); } - pub(crate) fn filter_by_range( - &self, - ) -> Result { + pub(crate) fn filter_by_range(&self) -> Result { #[allow(clippy::map_unwrap_or)] Ok(self .query_property @@ -77,7 +75,7 @@ impl Query { /// Get the filter column for the filter-is-not-null feature, if active. pub(crate) fn filter_is_not_null( &self, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { Ok(self .filter_is_not_null_raw()? .filter(|filter_is_not_null| filter_is_not_null.active()) @@ -92,7 +90,7 @@ impl Query { /// Get the raw [`components::FilterIsNotNull`] struct (for ui purposes). pub(super) fn filter_is_not_null_raw( &self, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { Ok(self .query_property .component_or_empty::()?) @@ -107,7 +105,7 @@ impl Query { .save_blueprint_component(ctx, filter_is_not_null); } - pub(crate) fn latest_at_enabled(&self) -> Result { + pub(crate) fn latest_at_enabled(&self) -> Result { Ok(self .query_property .component_or_empty::()? @@ -171,7 +169,7 @@ impl Query { &self, ctx: &ViewerContext<'_>, view_columns: &[ColumnDescriptor], - ) -> Result>, SpaceViewSystemExecutionError> { + ) -> Result>, ViewSystemExecutionError> { let selected_columns = self .query_property .component_or_empty::()?; @@ -235,7 +233,7 @@ impl Query { ctx: &ViewerContext<'_>, view_columns: &[ColumnDescriptor], actions: Vec, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { if actions.is_empty() { return Ok(()); } @@ -279,14 +277,14 @@ impl Query { mod test { use super::Query; use re_viewer_context::test_context::TestContext; - use re_viewer_context::SpaceViewId; + use re_viewer_context::ViewId; /// Simple test to demo round-trip testing using [`TestContext::run_and_handle_system_commands`]. #[test] fn test_latest_at_enabled() { let mut test_context = TestContext::default(); - let view_id = SpaceViewId::random(); + let view_id = ViewId::random(); test_context.run_in_egui_central_panel(|ctx, _| { let query = Query::from_blueprint(ctx, view_id); diff --git a/crates/viewer/re_space_view_dataframe/src/view_query/mod.rs b/crates/viewer/re_view_dataframe/src/view_query/mod.rs similarity index 77% rename from crates/viewer/re_space_view_dataframe/src/view_query/mod.rs rename to crates/viewer/re_view_dataframe/src/view_query/mod.rs index 9316e825151f..2541d5add677 100644 --- a/crates/viewer/re_space_view_dataframe/src/view_query/mod.rs +++ b/crates/viewer/re_view_dataframe/src/view_query/mod.rs @@ -3,7 +3,7 @@ mod ui; use re_chunk_store::ColumnDescriptor; use re_types::blueprint::archetypes; -use re_viewer_context::{SpaceViewId, SpaceViewSystemExecutionError, ViewerContext}; +use re_viewer_context::{ViewId, ViewSystemExecutionError, ViewerContext}; use re_viewport_blueprint::ViewProperty; /// Wrapper over the `DataframeQuery` blueprint archetype that can also display some UI. @@ -15,12 +15,12 @@ impl Query { /// Create a query object from the blueprint store. /// /// See the `blueprint_io` module for more related accessors. - pub(crate) fn from_blueprint(ctx: &ViewerContext<'_>, space_view_id: SpaceViewId) -> Self { + pub(crate) fn from_blueprint(ctx: &ViewerContext<'_>, view_id: ViewId) -> Self { Self { query_property: ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, - space_view_id, + view_id, ), } } @@ -32,16 +32,16 @@ impl Query { &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - space_view_id: SpaceViewId, + view_id: ViewId, view_columns: &[ColumnDescriptor], - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { let timeline = self.timeline(ctx)?; self.timeline_ui(ctx, ui, &timeline)?; ui.separator(); self.filter_range_ui(ctx, ui, &timeline)?; ui.separator(); - self.filter_is_not_null_ui(ctx, ui, &timeline, space_view_id)?; + self.filter_is_not_null_ui(ctx, ui, &timeline, view_id)?; ui.separator(); self.column_visibility_ui(ctx, ui, &timeline, view_columns)?; ui.separator(); diff --git a/crates/viewer/re_space_view_dataframe/src/view_query/ui.rs b/crates/viewer/re_view_dataframe/src/view_query/ui.rs similarity index 93% rename from crates/viewer/re_space_view_dataframe/src/view_query/ui.rs rename to crates/viewer/re_view_dataframe/src/view_query/ui.rs index 080eaabcd189..795e8506067c 100644 --- a/crates/viewer/re_space_view_dataframe/src/view_query/ui.rs +++ b/crates/viewer/re_view_dataframe/src/view_query/ui.rs @@ -7,7 +7,7 @@ use re_log_types::{ use re_types::blueprint::components; use re_types_core::{ComponentName, ComponentNameSet}; use re_ui::{list_item, UiExt}; -use re_viewer_context::{SpaceViewId, SpaceViewSystemExecutionError, TimeDragValue, ViewerContext}; +use re_viewer_context::{TimeDragValue, ViewId, ViewSystemExecutionError, ViewerContext}; use crate::view_query::Query; @@ -18,12 +18,12 @@ impl Query { ctx: &ViewerContext<'_>, ui: &mut egui::Ui, timeline: &Timeline, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { let mut timeline_name = *timeline.name(); egui::Grid::new("dataframe_view_query_ui_timeline") .num_columns(2) .spacing(egui::vec2(8.0, 10.0)) - .show(ui, |ui| -> Result<_, SpaceViewSystemExecutionError> { + .show(ui, |ui| -> Result<_, ViewSystemExecutionError> { ui.grid_left_hand_label("Timeline"); if edit_timeline_name(ctx, ui, &mut timeline_name).changed() { @@ -40,7 +40,7 @@ impl Query { ctx: &ViewerContext<'_>, ui: &mut egui::Ui, timeline: &Timeline, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { let time_drag_value = if let Some(times) = ctx.recording().time_histogram(timeline) { TimeDragValue::from_time_histogram(times) } else { @@ -131,8 +131,8 @@ impl Query { ctx: &ViewerContext<'_>, ui: &mut egui::Ui, timeline: &Timeline, - space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { + view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { // // Read stuff // @@ -160,7 +160,7 @@ impl Query { // Filter entity // - let all_entities = all_pov_entities_for_space_view(ctx, space_view_id, timeline); + let all_entities = all_pov_entities_for_view(ctx, view_id, timeline); let mut filter_entity = filter_entity .and_then(|entity| all_entities.contains(&entity).then_some(entity)) @@ -260,7 +260,7 @@ impl Query { ui: &mut egui::Ui, timeline: &Timeline, view_columns: &[ColumnDescriptor], - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { // Gather our selected columns. let selected_columns: HashSet<_> = self .apply_column_visibility_to_view_columns(ctx, view_columns)? @@ -394,7 +394,7 @@ impl Query { &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { ui.label("Empty cells:"); let mut latest_at = self.latest_at_enabled()?; @@ -419,26 +419,24 @@ impl Query { /// Meaning: /// - the entity is part of this view /// - the entity has any component on the chosen timeline -fn all_pov_entities_for_space_view( +fn all_pov_entities_for_view( ctx: &ViewerContext<'_>, - space_view_id: SpaceViewId, + view_id: ViewId, timeline: &Timeline, ) -> BTreeSet { let mut all_entities = BTreeSet::new(); - ctx.lookup_query_result(space_view_id) - .tree - .visit(&mut |node| { - if !node.data_result.tree_prefix_only { - let comp_for_entity = ctx - .recording_engine() - .store() - .all_components_on_timeline(timeline, &node.data_result.entity_path); - if comp_for_entity.is_some_and(|components| !components.is_empty()) { - all_entities.insert(node.data_result.entity_path.clone()); - } + ctx.lookup_query_result(view_id).tree.visit(&mut |node| { + if !node.data_result.tree_prefix_only { + let comp_for_entity = ctx + .recording_engine() + .store() + .all_components_on_timeline(timeline, &node.data_result.entity_path); + if comp_for_entity.is_some_and(|components| !components.is_empty()) { + all_entities.insert(node.data_result.entity_path.clone()); } - true - }); + } + true + }); all_entities } diff --git a/crates/viewer/re_space_view_dataframe/src/visualizer_system.rs b/crates/viewer/re_view_dataframe/src/visualizer_system.rs similarity index 76% rename from crates/viewer/re_space_view_dataframe/src/visualizer_system.rs rename to crates/viewer/re_view_dataframe/src/visualizer_system.rs index 930deac19724..7b96fcf5d7c8 100644 --- a/crates/viewer/re_space_view_dataframe/src/visualizer_system.rs +++ b/crates/viewer/re_view_dataframe/src/visualizer_system.rs @@ -1,9 +1,9 @@ use re_viewer_context::{ - ComponentFallbackProvider, IdentifiedViewSystem, SpaceViewSystemExecutionError, ViewContext, - ViewContextCollection, ViewQuery, VisualizerQueryInfo, VisualizerSystem, + ComponentFallbackProvider, IdentifiedViewSystem, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizerQueryInfo, VisualizerSystem, }; -/// An empty system to accept all entities in the space view +/// An empty system to accept all entities in the view #[derive(Default)] pub struct EmptySystem {} @@ -23,7 +23,7 @@ impl VisualizerSystem for EmptySystem { _ctx: &ViewContext<'_>, _query: &ViewQuery<'_>, _context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { Ok(vec![]) } diff --git a/crates/viewer/re_space_view_graph/Cargo.toml b/crates/viewer/re_view_graph/Cargo.toml similarity index 87% rename from crates/viewer/re_space_view_graph/Cargo.toml rename to crates/viewer/re_view_graph/Cargo.toml index 6ba3f933edb0..87841bba1e15 100644 --- a/crates/viewer/re_space_view_graph/Cargo.toml +++ b/crates/viewer/re_view_graph/Cargo.toml @@ -1,10 +1,10 @@ [package] authors.workspace = true -description = "A space view that shows a graph (node-link diagram)." +description = "A view that shows a graph (node-link diagram)." edition.workspace = true homepage.workspace = true license.workspace = true -name = "re_space_view_graph" +name = "re_view_graph" publish = true readme = "README.md" repository.workspace = true @@ -27,7 +27,7 @@ re_log.workspace = true re_log_types.workspace = true re_query.workspace = true re_renderer.workspace = true -re_space_view.workspace = true +re_view.workspace = true re_tracing.workspace = true re_types.workspace = true re_ui.workspace = true diff --git a/crates/viewer/re_view_graph/README.md b/crates/viewer/re_view_graph/README.md new file mode 100644 index 000000000000..3a106e7ad8c3 --- /dev/null +++ b/crates/viewer/re_view_graph/README.md @@ -0,0 +1,11 @@ +# re_view_graph + +Part of the [`rerun`](https://github.com/rerun-io/rerun?speculative-link) family of crates. + +[![Latest version](https://img.shields.io/crates/v/re_view_graph.svg)](https://crates.io/crates/re_view_graph?speculative-link) +[![Documentation](https://docs.rs/re_view_graph/badge.svg)](https://docs.rs/re_view_graph?speculative-link) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +A View that shows graphs (node-link diagrams). + diff --git a/crates/viewer/re_space_view_graph/src/graph/hash.rs b/crates/viewer/re_view_graph/src/graph/hash.rs similarity index 100% rename from crates/viewer/re_space_view_graph/src/graph/hash.rs rename to crates/viewer/re_view_graph/src/graph/hash.rs diff --git a/crates/viewer/re_space_view_graph/src/graph/ids.rs b/crates/viewer/re_view_graph/src/graph/ids.rs similarity index 100% rename from crates/viewer/re_space_view_graph/src/graph/ids.rs rename to crates/viewer/re_view_graph/src/graph/ids.rs diff --git a/crates/viewer/re_space_view_graph/src/graph/mod.rs b/crates/viewer/re_view_graph/src/graph/mod.rs similarity index 100% rename from crates/viewer/re_space_view_graph/src/graph/mod.rs rename to crates/viewer/re_view_graph/src/graph/mod.rs diff --git a/crates/viewer/re_space_view_graph/src/layout/geometry.rs b/crates/viewer/re_view_graph/src/layout/geometry.rs similarity index 100% rename from crates/viewer/re_space_view_graph/src/layout/geometry.rs rename to crates/viewer/re_view_graph/src/layout/geometry.rs diff --git a/crates/viewer/re_space_view_graph/src/layout/mod.rs b/crates/viewer/re_view_graph/src/layout/mod.rs similarity index 100% rename from crates/viewer/re_space_view_graph/src/layout/mod.rs rename to crates/viewer/re_view_graph/src/layout/mod.rs diff --git a/crates/viewer/re_space_view_graph/src/layout/params.rs b/crates/viewer/re_view_graph/src/layout/params.rs similarity index 93% rename from crates/viewer/re_space_view_graph/src/layout/params.rs rename to crates/viewer/re_view_graph/src/layout/params.rs index 14192d905c26..8502f32e1785 100644 --- a/crates/viewer/re_space_view_graph/src/layout/params.rs +++ b/crates/viewer/re_view_graph/src/layout/params.rs @@ -6,7 +6,7 @@ use re_types::{ components::Position2D, Archetype, Component, }; -use re_viewer_context::{ComponentFallbackProvider, SpaceViewState, ViewQuery, ViewerContext}; +use re_viewer_context::{ComponentFallbackProvider, ViewQuery, ViewState, ViewerContext}; use re_viewport_blueprint::{ViewProperty, ViewPropertyQueryError}; #[derive(Debug, PartialEq)] @@ -35,7 +35,7 @@ pub struct ForceLayoutParams { struct QueryArchetype<'a, T> { ctx: &'a ViewerContext<'a>, provider: &'a dyn ComponentFallbackProvider, - view_state: &'a dyn SpaceViewState, + view_state: &'a dyn ViewState, property: ViewProperty, _marker: std::marker::PhantomData, } @@ -45,12 +45,12 @@ impl<'a, T: Archetype> QueryArchetype<'a, T> { ctx: &'a ViewerContext<'a>, query: &'a ViewQuery<'a>, provider: &'a dyn ComponentFallbackProvider, - view_state: &'a dyn SpaceViewState, + view_state: &'a dyn ViewState, ) -> Self { let property = ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, - query.space_view_id, + query.view_id, ); Self { ctx, @@ -75,7 +75,7 @@ impl ForceLayoutParams { ctx: &ViewerContext<'_>, query: &ViewQuery<'_>, provider: &dyn ComponentFallbackProvider, - view_state: &dyn SpaceViewState, + view_state: &dyn ViewState, ) -> Result { // Query the components for the archetype let force_link = QueryArchetype::::new(ctx, query, provider, view_state); diff --git a/crates/viewer/re_space_view_graph/src/layout/provider.rs b/crates/viewer/re_view_graph/src/layout/provider.rs similarity index 100% rename from crates/viewer/re_space_view_graph/src/layout/provider.rs rename to crates/viewer/re_view_graph/src/layout/provider.rs diff --git a/crates/viewer/re_space_view_graph/src/layout/request.rs b/crates/viewer/re_view_graph/src/layout/request.rs similarity index 100% rename from crates/viewer/re_space_view_graph/src/layout/request.rs rename to crates/viewer/re_view_graph/src/layout/request.rs diff --git a/crates/viewer/re_space_view_graph/src/layout/result.rs b/crates/viewer/re_view_graph/src/layout/result.rs similarity index 100% rename from crates/viewer/re_space_view_graph/src/layout/result.rs rename to crates/viewer/re_view_graph/src/layout/result.rs diff --git a/crates/viewer/re_space_view_graph/src/layout/slots.rs b/crates/viewer/re_view_graph/src/layout/slots.rs similarity index 100% rename from crates/viewer/re_space_view_graph/src/layout/slots.rs rename to crates/viewer/re_view_graph/src/layout/slots.rs diff --git a/crates/viewer/re_view_graph/src/lib.rs b/crates/viewer/re_view_graph/src/lib.rs new file mode 100644 index 000000000000..ce9a4b6f2667 --- /dev/null +++ b/crates/viewer/re_view_graph/src/lib.rs @@ -0,0 +1,12 @@ +//! Rerun Graph View. +//! +//! A View that shows a graph (node-link diagram). + +mod graph; +mod layout; +mod properties; +mod ui; +mod view; +mod visualizers; + +pub use view::GraphView; diff --git a/crates/viewer/re_space_view_graph/src/properties.rs b/crates/viewer/re_view_graph/src/properties.rs similarity index 71% rename from crates/viewer/re_space_view_graph/src/properties.rs rename to crates/viewer/re_view_graph/src/properties.rs index 402831a223a8..bbad71903532 100644 --- a/crates/viewer/re_space_view_graph/src/properties.rs +++ b/crates/viewer/re_view_graph/src/properties.rs @@ -6,17 +6,17 @@ use re_types::{ components::Position2D, Archetype as _, }; -use re_viewer_context::{SpaceViewStateExt as _, TypedComponentFallbackProvider}; +use re_viewer_context::{TypedComponentFallbackProvider, ViewStateExt as _}; -use crate::{ui::GraphSpaceViewState, GraphSpaceView}; +use crate::{ui::GraphViewState, GraphView}; fn valid_bound(rect: &egui::Rect) -> bool { rect.is_finite() && rect.is_positive() } -impl TypedComponentFallbackProvider for GraphSpaceView { +impl TypedComponentFallbackProvider for GraphView { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> VisualBounds2D { - let Ok(state) = ctx.view_state.downcast_ref::() else { + let Ok(state) = ctx.view_state.downcast_ref::() else { return VisualBounds2D::default(); }; @@ -27,7 +27,7 @@ impl TypedComponentFallbackProvider for GraphSpaceView { } } -impl TypedComponentFallbackProvider for GraphSpaceView { +impl TypedComponentFallbackProvider for GraphView { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> Enabled { match ctx.archetype_name { Some(name) if name == archetypes::ForceLink::name() => true.into(), @@ -38,13 +38,13 @@ impl TypedComponentFallbackProvider for GraphSpaceView { } } -impl TypedComponentFallbackProvider for GraphSpaceView { +impl TypedComponentFallbackProvider for GraphView { fn fallback_for(&self, _ctx: &re_viewer_context::QueryContext<'_>) -> ForceDistance { (60.).into() } } -impl TypedComponentFallbackProvider for GraphSpaceView { +impl TypedComponentFallbackProvider for GraphView { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> ForceStrength { match ctx.archetype_name { Some(name) if name == archetypes::ForceManyBody::name() => (-60.).into(), @@ -54,7 +54,7 @@ impl TypedComponentFallbackProvider for GraphSpaceView { } } -impl TypedComponentFallbackProvider for GraphSpaceView { +impl TypedComponentFallbackProvider for GraphView { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> ForceIterations { match ctx.archetype_name { Some(name) if name == archetypes::ForceLink::name() => 3.into(), @@ -64,10 +64,10 @@ impl TypedComponentFallbackProvider for GraphSpaceView { } } -impl TypedComponentFallbackProvider for GraphSpaceView { +impl TypedComponentFallbackProvider for GraphView { fn fallback_for(&self, _ctx: &re_viewer_context::QueryContext<'_>) -> Position2D { Default::default() } } -re_viewer_context::impl_component_fallback_provider!(GraphSpaceView => [VisualBounds2D, Enabled, ForceDistance, ForceStrength, ForceIterations, Position2D]); +re_viewer_context::impl_component_fallback_provider!(GraphView => [VisualBounds2D, Enabled, ForceDistance, ForceStrength, ForceIterations, Position2D]); diff --git a/crates/viewer/re_space_view_graph/src/ui/draw.rs b/crates/viewer/re_view_graph/src/ui/draw.rs similarity index 97% rename from crates/viewer/re_space_view_graph/src/ui/draw.rs rename to crates/viewer/re_view_graph/src/ui/draw.rs index 0379e9de5518..a9a6b68aedc4 100644 --- a/crates/viewer/re_space_view_graph/src/ui/draw.rs +++ b/crates/viewer/re_view_graph/src/ui/draw.rs @@ -10,7 +10,7 @@ use re_entity_db::InstancePath; use re_types::ArrowString; use re_ui::list_item; use re_viewer_context::{ - HoverHighlight, InteractionHighlight, Item, SelectionHighlight, SpaceViewHighlights, UiLayout, + HoverHighlight, InteractionHighlight, Item, SelectionHighlight, UiLayout, ViewHighlights, ViewQuery, ViewerContext, }; @@ -241,7 +241,7 @@ pub fn draw_entity_rect( ui: &mut Ui, rect: Rect, entity_path: &EntityPath, - highlights: &SpaceViewHighlights, + highlights: &ViewHighlights, ) -> Response { let color = if highlights .entity_outline_mask(entity_path.hash()) @@ -301,7 +301,7 @@ pub fn draw_graph( InstancePath::instance(entity_path.clone(), instance.instance_index); ctx.select_hovered_on_click( &response, - Item::DataResult(query.space_view_id, instance_path.clone()), + Item::DataResult(query.view_id, instance_path.clone()), ); response = response.on_hover_ui_at_pointer(|ui| { @@ -311,7 +311,7 @@ pub fn draw_graph( &query.latest_at_query(), ctx.recording(), ui, - Some(query.space_view_id), + Some(query.view_id), &instance_path, ); @@ -348,7 +348,7 @@ pub fn draw_graph( let instance_path = InstancePath::entity_all(entity_path.clone()); ctx.select_hovered_on_click( &resp, - vec![(Item::DataResult(query.space_view_id, instance_path), None)].into_iter(), + vec![(Item::DataResult(query.view_id, instance_path), None)].into_iter(), ); } } diff --git a/crates/viewer/re_space_view_graph/src/ui/mod.rs b/crates/viewer/re_view_graph/src/ui/mod.rs similarity index 78% rename from crates/viewer/re_space_view_graph/src/ui/mod.rs rename to crates/viewer/re_view_graph/src/ui/mod.rs index 876b32ffb8ac..4e00cdfe7388 100644 --- a/crates/viewer/re_space_view_graph/src/ui/mod.rs +++ b/crates/viewer/re_view_graph/src/ui/mod.rs @@ -4,4 +4,4 @@ mod state; pub use draw::{draw_debug, draw_graph, DrawableLabel}; pub use selection::view_property_force_ui; -pub use state::GraphSpaceViewState; +pub use state::GraphViewState; diff --git a/crates/viewer/re_space_view_graph/src/ui/selection.rs b/crates/viewer/re_view_graph/src/ui/selection.rs similarity index 91% rename from crates/viewer/re_space_view_graph/src/ui/selection.rs rename to crates/viewer/re_view_graph/src/ui/selection.rs index 3b67eeef116f..d8b8906051bc 100644 --- a/crates/viewer/re_space_view_graph/src/ui/selection.rs +++ b/crates/viewer/re_view_graph/src/ui/selection.rs @@ -1,8 +1,8 @@ -use re_space_view::{view_property_component_ui, view_property_component_ui_custom}; use re_types::{ blueprint::components::Enabled, Archetype, ArchetypeReflectionMarker, Component as _, }; -use re_viewer_context::{ComponentFallbackProvider, SpaceViewId, SpaceViewState, ViewerContext}; +use re_view::{view_property_component_ui, view_property_component_ui_custom}; +use re_viewer_context::{ComponentFallbackProvider, ViewId, ViewState, ViewerContext}; use re_viewport_blueprint::ViewProperty; /// This function is similar to [`view_property_component_ui`], but it always @@ -12,9 +12,9 @@ use re_viewport_blueprint::ViewProperty; pub fn view_property_force_ui( ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - view_id: SpaceViewId, + view_id: ViewId, fallback_provider: &dyn ComponentFallbackProvider, - view_state: &dyn SpaceViewState, + view_state: &dyn ViewState, ) { let property = ViewProperty::from_archetype::(ctx.blueprint_db(), ctx.blueprint_query, view_id); diff --git a/crates/viewer/re_space_view_graph/src/ui/state.rs b/crates/viewer/re_view_graph/src/ui/state.rs similarity index 96% rename from crates/viewer/re_space_view_graph/src/ui/state.rs rename to crates/viewer/re_view_graph/src/ui/state.rs index 60f901a3c160..89cc2d232e6a 100644 --- a/crates/viewer/re_space_view_graph/src/ui/state.rs +++ b/crates/viewer/re_view_graph/src/ui/state.rs @@ -2,15 +2,15 @@ use egui::Rect; use re_format::format_f32; use re_types::blueprint::components::VisualBounds2D; use re_ui::UiExt; -use re_viewer_context::SpaceViewState; +use re_viewer_context::ViewState; use crate::layout::{ForceLayoutParams, ForceLayoutProvider, Layout, LayoutRequest}; -/// Space view state for the custom space view. +/// View state for the custom view. /// /// This state is preserved between frames, but not across Viewer sessions. #[derive(Default)] -pub struct GraphSpaceViewState { +pub struct GraphViewState { pub layout_state: LayoutState, pub show_debug: bool, @@ -18,7 +18,7 @@ pub struct GraphSpaceViewState { pub visual_bounds: Option, } -impl GraphSpaceViewState { +impl GraphViewState { pub fn layout_ui(&self, ui: &mut egui::Ui) { let Some(rect) = self.layout_state.bounding_rect() else { return; @@ -47,7 +47,7 @@ impl GraphSpaceViewState { } } -impl SpaceViewState for GraphSpaceViewState { +impl ViewState for GraphViewState { fn as_any(&self) -> &dyn std::any::Any { self } diff --git a/crates/viewer/re_space_view_graph/src/view.rs b/crates/viewer/re_view_graph/src/view.rs similarity index 70% rename from crates/viewer/re_space_view_graph/src/view.rs rename to crates/viewer/re_view_graph/src/view.rs index dc84ead92cc3..ff18e5fde607 100644 --- a/crates/viewer/re_space_view_graph/src/view.rs +++ b/crates/viewer/re_view_graph/src/view.rs @@ -1,8 +1,4 @@ use re_log_types::EntityPath; -use re_space_view::{ - controls::{DRAG_PAN2D_BUTTON, ZOOM_SCROLL_MODIFIER}, - view_property_ui, -}; use re_types::{ blueprint::{ self, @@ -11,35 +7,38 @@ use re_types::{ VisualBounds2D, }, }, - SpaceViewClassIdentifier, + ViewClassIdentifier, }; use re_ui::{ self, zoom_pan_area::{fit_to_rect_in_scene, zoom_pan_area}, ModifiersMarkdown, MouseButtonMarkdown, UiExt as _, }; +use re_view::{ + controls::{DRAG_PAN2D_BUTTON, ZOOM_SCROLL_MODIFIER}, + view_property_ui, +}; use re_viewer_context::{ - IdentifiedViewSystem as _, RecommendedSpaceView, SpaceViewClass, SpaceViewClassLayoutPriority, - SpaceViewClassRegistryError, SpaceViewId, SpaceViewSpawnHeuristics, SpaceViewState, - SpaceViewStateExt as _, SpaceViewSystemExecutionError, SpaceViewSystemRegistrator, - SystemExecutionOutput, ViewQuery, ViewerContext, + IdentifiedViewSystem as _, RecommendedView, SystemExecutionOutput, ViewClass, + ViewClassLayoutPriority, ViewClassRegistryError, ViewId, ViewQuery, ViewSpawnHeuristics, + ViewState, ViewStateExt as _, ViewSystemExecutionError, ViewSystemRegistrator, ViewerContext, }; use re_viewport_blueprint::ViewProperty; use crate::{ graph::Graph, layout::{ForceLayoutParams, LayoutRequest}, - ui::{draw_debug, draw_graph, view_property_force_ui, GraphSpaceViewState}, + ui::{draw_debug, draw_graph, view_property_force_ui, GraphViewState}, visualizers::{merge, EdgesVisualizer, NodeVisualizer}, }; #[derive(Default)] -pub struct GraphSpaceView; +pub struct GraphView; -impl SpaceViewClass for GraphSpaceView { +impl ViewClass for GraphView { // State type as described above. - fn identifier() -> SpaceViewClassIdentifier { + fn identifier() -> ViewClassIdentifier { "Graph".into() } @@ -48,7 +47,7 @@ impl SpaceViewClass for GraphSpaceView { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_GRAPH + &re_ui::icons::VIEW_GRAPH } fn help_markdown(&self, egui_ctx: &egui::Context) -> String { @@ -66,21 +65,21 @@ Display a graph of nodes and edges. ) } - /// Register all systems (contexts & parts) that the space view needs. + /// Register all systems (contexts & parts) that the view needs. fn on_register( &self, - system_registry: &mut SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { system_registry.register_visualizer::()?; system_registry.register_visualizer::() } - fn new_state(&self) -> Box { - Box::::default() + fn new_state(&self) -> Box { + Box::::default() } - fn preferred_tile_aspect_ratio(&self, state: &dyn SpaceViewState) -> Option { - let state = state.downcast_ref::().ok()?; + fn preferred_tile_aspect_ratio(&self, state: &dyn ViewState) -> Option { + let state = state.downcast_ref::().ok()?; if let Some(bounds) = state.visual_bounds { let width = bounds.x_range.abs_len() as f32; @@ -96,38 +95,38 @@ Display a graph of nodes and edges. None } - fn layout_priority(&self) -> SpaceViewClassLayoutPriority { + fn layout_priority(&self) -> ViewClassLayoutPriority { Default::default() } - fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> ViewSpawnHeuristics { if let Some(applicable) = ctx .applicable_entities_per_visualizer .get(&NodeVisualizer::identifier()) { - SpaceViewSpawnHeuristics::new( + ViewSpawnHeuristics::new( applicable .iter() .cloned() - .map(RecommendedSpaceView::new_single_entity), + .map(RecommendedView::new_single_entity), ) } else { - SpaceViewSpawnHeuristics::empty() + ViewSpawnHeuristics::empty() } } - /// Additional UI displayed when the space view is selected. + /// Additional UI displayed when the view is selected. /// /// In this sample we show a combo box to select the color coordinates mode. fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _space_origin: &EntityPath, - space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { - let state = state.downcast_mut::()?; + view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { + let state = state.downcast_mut::()?; ui.selection_grid("graph_view_settings_ui").show(ui, |ui| { state.layout_ui(ui); @@ -136,28 +135,28 @@ Display a graph of nodes and edges. }); re_ui::list_item::list_item_scope(ui, "graph_selection_ui", |ui| { - view_property_ui::(ctx, ui, space_view_id, self, state); - view_property_force_ui::(ctx, ui, space_view_id, self, state); - view_property_force_ui::(ctx, ui, space_view_id, self, state); - view_property_force_ui::(ctx, ui, space_view_id, self, state); - view_property_force_ui::(ctx, ui, space_view_id, self, state); - view_property_force_ui::(ctx, ui, space_view_id, self, state); + view_property_ui::(ctx, ui, view_id, self, state); + view_property_force_ui::(ctx, ui, view_id, self, state); + view_property_force_ui::(ctx, ui, view_id, self, state); + view_property_force_ui::(ctx, ui, view_id, self, state); + view_property_force_ui::(ctx, ui, view_id, self, state); + view_property_force_ui::(ctx, ui, view_id, self, state); }); Ok(()) } - /// The contents of the Space View window and all interaction within it. + /// The contents of the View window and all interaction within it. /// /// This is called with freshly created & executed context & part systems. fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, query: &ViewQuery<'_>, system_output: SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); let node_data = &system_output.view_systems.get::()?.data; @@ -167,12 +166,12 @@ Display a graph of nodes and edges. .map(|(ent, nodes, edges)| Graph::new(ui, ent.clone(), nodes, edges)) .collect::>(); - let state = state.downcast_mut::()?; + let state = state.downcast_mut::()?; let bounds_property = ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, - query.space_view_id, + query.view_id, ); let rect_in_scene: blueprint::components::VisualBounds2D = bounds_property.component_or_fallback(ctx, self, state)?; diff --git a/crates/viewer/re_space_view_graph/src/visualizers/edges.rs b/crates/viewer/re_view_graph/src/visualizers/edges.rs similarity index 91% rename from crates/viewer/re_space_view_graph/src/visualizers/edges.rs rename to crates/viewer/re_view_graph/src/visualizers/edges.rs index ac7a45512229..4f980e559df1 100644 --- a/crates/viewer/re_space_view_graph/src/visualizers/edges.rs +++ b/crates/viewer/re_view_graph/src/visualizers/edges.rs @@ -1,14 +1,14 @@ use re_chunk::LatestAtQuery; use re_log_types::{EntityPath, Instance}; -use re_space_view::{DataResultQuery, RangeResultsExt}; use re_types::{ self, archetypes, components::{self, GraphEdge, GraphNode}, Component as _, }; +use re_view::{DataResultQuery, RangeResultsExt}; use re_viewer_context::{ - self, IdentifiedViewSystem, SpaceViewSystemExecutionError, ViewContext, ViewContextCollection, - ViewQuery, ViewSystemIdentifier, VisualizerQueryInfo, VisualizerSystem, + self, IdentifiedViewSystem, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, ViewSystemIdentifier, VisualizerQueryInfo, VisualizerSystem, }; use crate::graph::NodeId; @@ -49,7 +49,7 @@ impl VisualizerSystem for EdgesVisualizer { ctx: &ViewContext<'_>, query: &ViewQuery<'_>, _context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let timeline_query = LatestAtQuery::new(query.timeline, query.latest_at); for data_result in query.iter_visible_data_results(ctx, Self::identifier()) { diff --git a/crates/viewer/re_space_view_graph/src/visualizers/mod.rs b/crates/viewer/re_view_graph/src/visualizers/mod.rs similarity index 100% rename from crates/viewer/re_space_view_graph/src/visualizers/mod.rs rename to crates/viewer/re_view_graph/src/visualizers/mod.rs diff --git a/crates/viewer/re_space_view_graph/src/visualizers/nodes.rs b/crates/viewer/re_view_graph/src/visualizers/nodes.rs similarity index 93% rename from crates/viewer/re_space_view_graph/src/visualizers/nodes.rs rename to crates/viewer/re_view_graph/src/visualizers/nodes.rs index eb02530150a1..2d7c1f0176da 100644 --- a/crates/viewer/re_space_view_graph/src/visualizers/nodes.rs +++ b/crates/viewer/re_view_graph/src/visualizers/nodes.rs @@ -2,7 +2,6 @@ use egui::Color32; use re_chunk::LatestAtQuery; use re_log_types::{EntityPath, Instance}; use re_query::{clamped_zip_2x4, range_zip_1x4}; -use re_space_view::{DataResultQuery, RangeResultsExt}; use re_types::components::{Color, Radius, ShowLabels}; use re_types::datatypes::Float32; use re_types::{ @@ -10,10 +9,11 @@ use re_types::{ components::{self}, ArrowString, Component as _, }; +use re_view::{DataResultQuery, RangeResultsExt}; use re_viewer_context::{ - self, IdentifiedViewSystem, QueryContext, SpaceViewSystemExecutionError, - TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, - ViewSystemIdentifier, VisualizerQueryInfo, VisualizerSystem, + self, IdentifiedViewSystem, QueryContext, TypedComponentFallbackProvider, ViewContext, + ViewContextCollection, ViewQuery, ViewSystemExecutionError, ViewSystemIdentifier, + VisualizerQueryInfo, VisualizerSystem, }; use crate::graph::NodeId; @@ -68,7 +68,7 @@ impl VisualizerSystem for NodeVisualizer { ctx: &ViewContext<'_>, query: &ViewQuery<'_>, _context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let timeline_query = LatestAtQuery::new(query.timeline, query.latest_at); for data_result in query.iter_visible_data_results(ctx, Self::identifier()) { diff --git a/crates/viewer/re_space_view_map/Cargo.toml b/crates/viewer/re_view_map/Cargo.toml similarity index 88% rename from crates/viewer/re_space_view_map/Cargo.toml rename to crates/viewer/re_view_map/Cargo.toml index b3d448f6a721..22587501b106 100644 --- a/crates/viewer/re_space_view_map/Cargo.toml +++ b/crates/viewer/re_view_map/Cargo.toml @@ -1,10 +1,10 @@ [package] authors.workspace = true -description = "A space view that shows a map." +description = "A view that shows a map." edition.workspace = true homepage.workspace = true license.workspace = true -name = "re_space_view_map" +name = "re_view_map" publish = true readme = "README.md" repository.workspace = true @@ -26,7 +26,7 @@ re_log_types.workspace = true re_math.workspace = true re_query.workspace = true re_renderer.workspace = true -re_space_view.workspace = true +re_view.workspace = true re_tracing.workspace = true re_types.workspace = true re_ui.workspace = true diff --git a/crates/viewer/re_view_map/README.md b/crates/viewer/re_view_map/README.md new file mode 100644 index 000000000000..5555ab0cf427 --- /dev/null +++ b/crates/viewer/re_view_map/README.md @@ -0,0 +1,10 @@ +# re_view_map + +Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. + +[![Latest version](https://img.shields.io/crates/v/re_view_map.svg)](https://crates.io/crates/re_view_spatial?speculative-link) +[![Documentation](https://docs.rs/re_view_map/badge.svg)](https://docs.rs/re_view_spatial?speculative-link) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +View that show GPS Coordinates on a map. diff --git a/crates/viewer/re_view_map/src/lib.rs b/crates/viewer/re_view_map/src/lib.rs new file mode 100644 index 000000000000..d07b4449e349 --- /dev/null +++ b/crates/viewer/re_view_map/src/lib.rs @@ -0,0 +1,9 @@ +//! Rerun map visualization View. +//! +//! A View that shows geographic objects on a map. + +mod map_overlays; +mod map_view; +mod visualizers; + +pub use map_view::MapView; diff --git a/crates/viewer/re_space_view_map/src/map_overlays.rs b/crates/viewer/re_view_map/src/map_overlays.rs similarity index 100% rename from crates/viewer/re_space_view_map/src/map_overlays.rs rename to crates/viewer/re_view_map/src/map_overlays.rs diff --git a/crates/viewer/re_space_view_map/src/map_space_view.rs b/crates/viewer/re_view_map/src/map_view.rs similarity index 86% rename from crates/viewer/re_space_view_map/src/map_space_view.rs rename to crates/viewer/re_view_map/src/map_view.rs index 2700a4b3b93d..9d98b0811be4 100644 --- a/crates/viewer/re_space_view_map/src/map_space_view.rs +++ b/crates/viewer/re_view_map/src/map_view.rs @@ -1,5 +1,5 @@ use egui::{Context, NumExt as _, Rect, Response}; -use re_space_view::AnnotationSceneContext; +use re_view::AnnotationSceneContext; use walkers::{HttpTiles, Map, MapMemory, Tiles}; use re_data_ui::{item_ui, DataUi}; @@ -12,21 +12,21 @@ use re_types::{ components::MapProvider, components::ZoomLevel, }, - SpaceViewClassIdentifier, View, + View, ViewClassIdentifier, }; use re_ui::list_item; use re_viewer_context::{ - gpu_bridge, IdentifiedViewSystem as _, Item, SpaceViewClass, SpaceViewClassLayoutPriority, - SpaceViewClassRegistryError, SpaceViewHighlights, SpaceViewId, SpaceViewSpawnHeuristics, - SpaceViewState, SpaceViewStateExt as _, SpaceViewSystemExecutionError, - SpaceViewSystemRegistrator, SystemExecutionOutput, UiLayout, ViewQuery, ViewerContext, + gpu_bridge, IdentifiedViewSystem as _, Item, SystemExecutionOutput, UiLayout, ViewClass, + ViewClassLayoutPriority, ViewClassRegistryError, ViewHighlights, ViewId, ViewQuery, + ViewSpawnHeuristics, ViewState, ViewStateExt as _, ViewSystemExecutionError, + ViewSystemRegistrator, ViewerContext, }; use re_viewport_blueprint::ViewProperty; use crate::map_overlays; use crate::visualizers::{update_span, GeoLineStringsVisualizer, GeoPointsVisualizer}; -pub struct MapSpaceViewState { +pub struct MapViewState { tiles: Option, map_memory: MapMemory, selected_provider: MapProvider, @@ -38,7 +38,7 @@ pub struct MapSpaceViewState { last_gpu_picking_result: Option, } -impl Default for MapSpaceViewState { +impl Default for MapViewState { fn default() -> Self { Self { tiles: None, @@ -53,13 +53,13 @@ impl Default for MapSpaceViewState { } } -impl MapSpaceViewState { +impl MapViewState { // This method ensures that tiles is initialized and returns mutable references to tiles and map_memory. pub fn ensure_and_get_mut_refs( &mut self, ctx: &ViewerContext<'_>, egui_ctx: &egui::Context, - ) -> Result<(&mut HttpTiles, &mut MapMemory), SpaceViewSystemExecutionError> { + ) -> Result<(&mut HttpTiles, &mut MapMemory), ViewSystemExecutionError> { if self.tiles.is_none() { let tiles = get_tile_manager(ctx, self.selected_provider, egui_ctx); self.tiles = Some(tiles); @@ -69,12 +69,12 @@ impl MapSpaceViewState { let tiles_ref = self .tiles .as_mut() - .ok_or(SpaceViewSystemExecutionError::MapTilesError)?; + .ok_or(ViewSystemExecutionError::MapTilesError)?; Ok((tiles_ref, &mut self.map_memory)) } } -impl SpaceViewState for MapSpaceViewState { +impl ViewState for MapViewState { fn as_any(&self) -> &dyn std::any::Any { self } @@ -85,12 +85,12 @@ impl SpaceViewState for MapSpaceViewState { } #[derive(Default)] -pub struct MapSpaceView; +pub struct MapView; type ViewType = re_types::blueprint::views::MapView; -impl SpaceViewClass for MapSpaceView { - fn identifier() -> SpaceViewClassIdentifier { +impl ViewClass for MapView { + fn identifier() -> ViewClassIdentifier { ViewType::identifier() } @@ -99,7 +99,7 @@ impl SpaceViewClass for MapSpaceView { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_MAP + &re_ui::icons::VIEW_MAP } fn help_markdown(&self, _egui_ctx: &egui::Context) -> String { @@ -117,8 +117,8 @@ Displays geospatial primitives on a map. fn on_register( &self, - system_registry: &mut SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { system_registry.register_visualizer::()?; system_registry.register_visualizer::()?; @@ -127,24 +127,24 @@ Displays geospatial primitives on a map. Ok(()) } - fn new_state(&self) -> Box { - Box::::new(MapSpaceViewState::default()) + fn new_state(&self) -> Box { + Box::::new(MapViewState::default()) } - fn preferred_tile_aspect_ratio(&self, _state: &dyn SpaceViewState) -> Option { + fn preferred_tile_aspect_ratio(&self, _state: &dyn ViewState) -> Option { // Prefer a square tile if possible. Some(1.0) } - fn layout_priority(&self) -> SpaceViewClassLayoutPriority { - SpaceViewClassLayoutPriority::default() + fn layout_priority(&self) -> ViewClassLayoutPriority { + ViewClassLayoutPriority::default() } fn supports_visible_time_range(&self) -> bool { true } - fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> ViewSpawnHeuristics { re_tracing::profile_function!(); // Spawn a single map view at the root if any geospatial entity exists. @@ -160,9 +160,9 @@ Displays geospatial primitives on a map. }); if any_map_entity { - SpaceViewSpawnHeuristics::root() + ViewSpawnHeuristics::root() } else { - SpaceViewSpawnHeuristics::default() + ViewSpawnHeuristics::default() } } @@ -170,13 +170,13 @@ Displays geospatial primitives on a map. &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _space_origin: &EntityPath, - space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { + view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { re_ui::list_item::list_item_scope(ui, "map_selection_ui", |ui| { - re_space_view::view_property_ui::(ctx, ui, space_view_id, self, state); - re_space_view::view_property_ui::(ctx, ui, space_view_id, self, state); + re_view::view_property_ui::(ctx, ui, view_id, self, state); + re_view::view_property_ui::(ctx, ui, view_id, self, state); }); Ok(()) @@ -186,21 +186,21 @@ Displays geospatial primitives on a map. &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, query: &ViewQuery<'_>, system_output: SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { - let state = state.downcast_mut::()?; + ) -> Result<(), ViewSystemExecutionError> { + let state = state.downcast_mut::()?; let map_background = ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, - query.space_view_id, + query.view_id, ); let map_zoom = ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, - query.space_view_id, + query.view_id, ); let geo_points_visualizer = system_output.view_systems.get::()?; @@ -304,7 +304,7 @@ Displays geospatial primitives on a map. // let Some(render_ctx) = ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut view_builder = @@ -358,7 +358,7 @@ fn create_view_builder( render_ctx: &RenderContext, egui_ctx: &egui::Context, view_rect: Rect, - highlights: &SpaceViewHighlights, + highlights: &ViewHighlights, ) -> ViewBuilder { let pixels_per_point = egui_ctx.pixels_per_point(); let resolution_in_pixel = @@ -387,7 +387,7 @@ fn create_view_builder( pixels_per_point, outline_config: highlights .any_outlines() - .then(|| re_space_view::outline_config(egui_ctx)), + .then(|| re_view::outline_config(egui_ctx)), // Make sure the map in the background is not completely overwritten blend_with_background: true, @@ -403,11 +403,11 @@ fn handle_picking_and_ui_interactions( egui_ctx: &egui::Context, view_builder: &mut ViewBuilder, query: &ViewQuery<'_>, - state: &mut MapSpaceViewState, + state: &mut MapViewState, map_response: Response, map_rect: Rect, -) -> Result<(), SpaceViewSystemExecutionError> { - let picking_readback_identifier = query.space_view_id.hash(); +) -> Result<(), ViewSystemExecutionError> { + let picking_readback_identifier = query.view_id.hash(); if let Some(pointer_in_ui) = map_response.hover_pos() { let pixels_per_point = egui_ctx.pixels_per_point(); @@ -424,7 +424,7 @@ fn handle_picking_and_ui_interactions( handle_ui_interactions(ctx, query, map_response, picking_result); - // TODO(ab, andreas): this part is copy-pasted-modified from spatial space view and should be factored as an utility + // TODO(ab, andreas): this part is copy-pasted-modified from spatial view and should be factored as an utility /// Radius in which cursor interactions may snap to the nearest object even if the cursor /// does not hover it directly. @@ -473,7 +473,7 @@ fn handle_ui_interactions( &query.latest_at_query(), ctx.recording(), ui, - Some(query.space_view_id), + Some(query.view_id), &instance_path, ); @@ -483,21 +483,21 @@ fn handle_ui_interactions( ctx.select_hovered_on_click( &map_response, - Item::DataResult(query.space_view_id, instance_path.clone()), + Item::DataResult(query.view_id, instance_path.clone()), ); // double click selects the entire entity if map_response.double_clicked() { // Select the entire entity ctx.selection_state().set_selection(Item::DataResult( - query.space_view_id, + query.view_id, instance_path.entity_path.clone().into(), )); } } else if map_response.clicked() { // clicked elsewhere, select the view ctx.selection_state() - .set_selection(Item::SpaceView(query.space_view_id)); + .set_selection(Item::View(query.view_id)); } } @@ -560,9 +560,9 @@ fn get_tile_manager( } } -re_viewer_context::impl_component_fallback_provider!(MapSpaceView => []); +re_viewer_context::impl_component_fallback_provider!(MapView => []); -// TODO(ab, andreas): this is a partial copy past of re_space_view_spatial::picking_gpu. Should be +// TODO(ab, andreas): this is a partial copy past of re_view_spatial::picking_gpu. Should be // turned into a utility function. fn picking_gpu( render_ctx: &re_renderer::RenderContext, @@ -618,9 +618,7 @@ fn picking_gpu( // Nothing found. None } else { - Some(re_space_view::instance_path_hash_from_picking_layer_id( - picked_id, - )) + Some(re_view::instance_path_hash_from_picking_layer_id(picked_id)) }; *last_gpu_picking_result = new_result; diff --git a/crates/viewer/re_space_view_map/src/visualizers/geo_line_strings.rs b/crates/viewer/re_view_map/src/visualizers/geo_line_strings.rs similarity index 94% rename from crates/viewer/re_space_view_map/src/visualizers/geo_line_strings.rs rename to crates/viewer/re_view_map/src/visualizers/geo_line_strings.rs index 8d67da839474..2b2e145d13e2 100644 --- a/crates/viewer/re_space_view_map/src/visualizers/geo_line_strings.rs +++ b/crates/viewer/re_view_map/src/visualizers/geo_line_strings.rs @@ -3,16 +3,16 @@ use re_renderer::{ renderer::{LineDrawDataError, LineStripFlags}, PickingLayerInstanceId, }; -use re_space_view::{DataResultQuery as _, RangeResultsExt as _}; use re_types::{ archetypes::GeoLineStrings, components::{Color, GeoLineString, Radius}, Component as _, }; +use re_view::{DataResultQuery as _, RangeResultsExt as _}; use re_viewer_context::{ - auto_color_for_entity_path, IdentifiedViewSystem, QueryContext, SpaceViewHighlights, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizerQueryInfo, VisualizerSystem, + auto_color_for_entity_path, IdentifiedViewSystem, QueryContext, TypedComponentFallbackProvider, + ViewContext, ViewContextCollection, ViewHighlights, ViewQuery, ViewSystemExecutionError, + VisualizerQueryInfo, VisualizerSystem, }; #[derive(Debug, Default)] @@ -45,7 +45,7 @@ impl VisualizerSystem for GeoLineStringsVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, _context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { for data_result in view_query.iter_visible_data_results(ctx, Self::identifier()) { let results = data_result.query_archetype_with_history::(ctx, view_query); @@ -136,11 +136,11 @@ impl GeoLineStringsVisualizer { render_ctx: &re_renderer::RenderContext, view_builder: &mut re_renderer::ViewBuilder, projector: &walkers::Projector, - highlight: &SpaceViewHighlights, + highlight: &ViewHighlights, ) -> Result<(), LineDrawDataError> { let mut lines = re_renderer::LineDrawableBuilder::new(render_ctx); lines.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); for (entity_path, batch) in &self.batches { diff --git a/crates/viewer/re_space_view_map/src/visualizers/geo_points.rs b/crates/viewer/re_view_map/src/visualizers/geo_points.rs similarity index 96% rename from crates/viewer/re_space_view_map/src/visualizers/geo_points.rs rename to crates/viewer/re_view_map/src/visualizers/geo_points.rs index 0968aa51ac50..29f9426e8d05 100644 --- a/crates/viewer/re_space_view_map/src/visualizers/geo_points.rs +++ b/crates/viewer/re_view_map/src/visualizers/geo_points.rs @@ -1,18 +1,18 @@ use re_log_types::EntityPath; use re_renderer::{renderer::PointCloudDrawDataError, PickingLayerInstanceId}; -use re_space_view::{ - process_annotation_slices, process_color_slice, AnnotationSceneContext, DataResultQuery as _, - RangeResultsExt as _, -}; use re_types::{ archetypes::GeoPoints, components::{ClassId, Color, LatLon, Radius}, Component as _, }; +use re_view::{ + process_annotation_slices, process_color_slice, AnnotationSceneContext, DataResultQuery as _, + RangeResultsExt as _, +}; use re_viewer_context::{ - auto_color_for_entity_path, IdentifiedViewSystem, QueryContext, SpaceViewHighlights, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizerQueryInfo, VisualizerSystem, + auto_color_for_entity_path, IdentifiedViewSystem, QueryContext, TypedComponentFallbackProvider, + ViewContext, ViewContextCollection, ViewHighlights, ViewQuery, ViewSystemExecutionError, + VisualizerQueryInfo, VisualizerSystem, }; #[derive(Debug, Default)] @@ -45,7 +45,7 @@ impl VisualizerSystem for GeoPointsVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let annotation_scene_context = context_systems.get::()?; let latest_at_query = view_query.latest_at_query(); @@ -151,7 +151,7 @@ impl GeoPointsVisualizer { render_ctx: &re_renderer::RenderContext, view_builder: &mut re_renderer::ViewBuilder, projector: &walkers::Projector, - highlight: &SpaceViewHighlights, + highlight: &ViewHighlights, ) -> Result<(), PointCloudDrawDataError> { let mut points = re_renderer::PointCloudBuilder::new(render_ctx); // NOTE: Do not `points.radius_boost_in_ui_points_for_outlines`! The points are not shaded, diff --git a/crates/viewer/re_space_view_map/src/visualizers/mod.rs b/crates/viewer/re_view_map/src/visualizers/mod.rs similarity index 100% rename from crates/viewer/re_space_view_map/src/visualizers/mod.rs rename to crates/viewer/re_view_map/src/visualizers/mod.rs diff --git a/crates/viewer/re_space_view_spatial/Cargo.toml b/crates/viewer/re_view_spatial/Cargo.toml similarity index 92% rename from crates/viewer/re_space_view_spatial/Cargo.toml rename to crates/viewer/re_view_spatial/Cargo.toml index 7dce5b2ea216..71c69a1082df 100644 --- a/crates/viewer/re_space_view_spatial/Cargo.toml +++ b/crates/viewer/re_view_spatial/Cargo.toml @@ -1,10 +1,10 @@ [package] authors.workspace = true -description = "Space Views that show entities in a 2D or 3D spatial relationship." +description = "Views that show entities in a 2D or 3D spatial relationship." edition.workspace = true homepage.workspace = true license.workspace = true -name = "re_space_view_spatial" +name = "re_view_spatial" publish = true readme = "README.md" repository.workspace = true @@ -33,7 +33,7 @@ re_renderer = { workspace = true, features = [ "import-obj", "import-stl", ] } -re_space_view.workspace = true +re_view.workspace = true re_tracing.workspace = true re_types = { workspace = true, features = ["ecolor", "glam", "image"] } re_ui.workspace = true diff --git a/crates/viewer/re_view_spatial/README.md b/crates/viewer/re_view_spatial/README.md new file mode 100644 index 000000000000..950c5eb13548 --- /dev/null +++ b/crates/viewer/re_view_spatial/README.md @@ -0,0 +1,10 @@ +# re_view_spatial + +Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. + +[![Latest version](https://img.shields.io/crates/v/re_view_spatial.svg)](https://crates.io/crates/re_view_spatial?speculative-link) +[![Documentation](https://docs.rs/re_view_spatial/badge.svg)](https://docs.rs/re_view_spatial?speculative-link) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +Views that show entities in a 2D or 3D spatial relationship. diff --git a/crates/viewer/re_space_view_spatial/src/contexts/depth_offsets.rs b/crates/viewer/re_view_spatial/src/contexts/depth_offsets.rs similarity index 98% rename from crates/viewer/re_space_view_spatial/src/contexts/depth_offsets.rs rename to crates/viewer/re_view_spatial/src/contexts/depth_offsets.rs index e785186d054e..37461b1daad5 100644 --- a/crates/viewer/re_space_view_spatial/src/contexts/depth_offsets.rs +++ b/crates/viewer/re_view_spatial/src/contexts/depth_offsets.rs @@ -3,8 +3,8 @@ use std::collections::{BTreeMap, BTreeSet}; use ahash::HashMap; use re_log_types::EntityPathHash; -use re_space_view::latest_at_with_blueprint_resolved_data; use re_types::{components::DrawOrder, Component as _, ComponentNameSet}; +use re_view::latest_at_with_blueprint_resolved_data; use re_viewer_context::{IdentifiedViewSystem, ViewContextSystem, ViewSystemIdentifier}; use crate::visualizers::visualizers_processing_draw_order; diff --git a/crates/viewer/re_space_view_spatial/src/contexts/mod.rs b/crates/viewer/re_view_spatial/src/contexts/mod.rs similarity index 63% rename from crates/viewer/re_space_view_spatial/src/contexts/mod.rs rename to crates/viewer/re_view_spatial/src/contexts/mod.rs index 5956680d872b..7bab048b990c 100644 --- a/crates/viewer/re_space_view_spatial/src/contexts/mod.rs +++ b/crates/viewer/re_view_spatial/src/contexts/mod.rs @@ -2,14 +2,14 @@ mod depth_offsets; mod transform_context; pub use depth_offsets::EntityDepthOffsets; -use re_space_view::AnnotationSceneContext; -use re_types::SpaceViewClassIdentifier; +use re_types::ViewClassIdentifier; +use re_view::AnnotationSceneContext; pub use transform_context::{TransformContext, TransformInfo, TwoDInThreeDTransformInfo}; // ----------------------------------------------------------------------------- use re_renderer::DepthOffset; -use re_viewer_context::{Annotations, SpaceViewClassRegistryError}; +use re_viewer_context::{Annotations, ViewClassRegistryError}; /// Context objects for a single entity in a spatial scene. pub struct SpatialSceneEntityContext<'a> { @@ -17,13 +17,13 @@ pub struct SpatialSceneEntityContext<'a> { pub depth_offset: DepthOffset, pub annotations: std::sync::Arc, - pub highlight: &'a re_viewer_context::SpaceViewOutlineMasks, // Not part of the context, but convenient to have here. - pub space_view_class_identifier: SpaceViewClassIdentifier, + pub highlight: &'a re_viewer_context::ViewOutlineMasks, // Not part of the context, but convenient to have here. + pub view_class_identifier: ViewClassIdentifier, } pub fn register_spatial_contexts( - system_registry: &mut re_viewer_context::SpaceViewSystemRegistrator<'_>, -) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut re_viewer_context::ViewSystemRegistrator<'_>, +) -> Result<(), ViewClassRegistryError> { system_registry.register_context_system::()?; system_registry.register_context_system::()?; system_registry.register_context_system::()?; diff --git a/crates/viewer/re_space_view_spatial/src/contexts/transform_context.rs b/crates/viewer/re_view_spatial/src/contexts/transform_context.rs similarity index 98% rename from crates/viewer/re_space_view_spatial/src/contexts/transform_context.rs rename to crates/viewer/re_view_spatial/src/contexts/transform_context.rs index e424797049b7..2c088526cf2d 100644 --- a/crates/viewer/re_space_view_spatial/src/contexts/transform_context.rs +++ b/crates/viewer/re_view_spatial/src/contexts/transform_context.rs @@ -3,7 +3,6 @@ use nohash_hasher::IntMap; use re_chunk_store::LatestAtQuery; use re_entity_db::{EntityDb, EntityPath, EntityTree}; -use re_space_view::DataResultQuery as _; use re_types::{ archetypes::{InstancePoses3D, Pinhole, Transform3D}, components::{ @@ -13,6 +12,7 @@ use re_types::{ }, Archetype, Component as _, ComponentNameSet, }; +use re_view::DataResultQuery as _; use re_viewer_context::{IdentifiedViewSystem, ViewContext, ViewContextSystem}; use vec1::smallvec_v1::SmallVec1; @@ -47,7 +47,7 @@ pub struct TwoDInThreeDTransformInfo { /// Pinhole camera ancestor (may be this entity itself). /// /// None indicates that this entity is under the eye camera with no Pinhole camera in-between. - /// Some indicates that the entity is under a pinhole camera at the given entity path that is not at the root of the space view. + /// Some indicates that the entity is under a pinhole camera at the given entity path that is not at the root of the view. pub parent_pinhole: EntityPath, /// The last 3D from 3D transform at the pinhole camera, before the pinhole transformation itself. @@ -119,7 +119,7 @@ enum UnreachableTransformReason { /// for the currently selected time & timeline. /// /// The renderer then uses this reference space as its world space, -/// making world and reference space equivalent for a given space view. +/// making world and reference space equivalent for a given view. /// /// Should be recomputed every frame. /// @@ -193,7 +193,7 @@ impl ViewContextSystem for TransformContext { // Find the entity path tree for the root. let Some(current_tree) = &entity_tree.subtree(query.space_origin) else { // It seems the space path is not part of the object tree! - // This happens frequently when the viewer remembers space views from a previous run that weren't shown yet. + // This happens frequently when the viewer remembers views from a previous run that weren't shown yet. // Naturally, in this case we don't have any transforms yet. return; }; @@ -207,7 +207,7 @@ impl ViewContextSystem for TransformContext { current_tree, ctx.recording(), &time_query, - // Ignore potential pinhole camera at the root of the space view, since it regarded as being "above" this root. + // Ignore potential pinhole camera at the root of the view, since it regarded as being "above" this root. TransformInfo::default(), ); @@ -309,7 +309,7 @@ impl TransformContext { let child_path = &child_tree.path; let lookup_image_plane = |p: &_| { - let query_result = ctx.viewer_ctx.lookup_query_result(view_query.space_view_id); + let query_result = ctx.viewer_ctx.lookup_query_result(view_query.view_id); query_result .tree diff --git a/crates/viewer/re_space_view_spatial/src/eye.rs b/crates/viewer/re_view_spatial/src/eye.rs similarity index 99% rename from crates/viewer/re_space_view_spatial/src/eye.rs rename to crates/viewer/re_view_spatial/src/eye.rs index 9a3af90cb1fd..8755bad0d977 100644 --- a/crates/viewer/re_space_view_spatial/src/eye.rs +++ b/crates/viewer/re_view_spatial/src/eye.rs @@ -3,7 +3,7 @@ use glam::{vec3, Mat4, Quat, Vec3}; use re_math::IsoTransform; -use re_space_view::controls::{ +use re_view::controls::{ RuntimeModifiers, DRAG_PAN3D_BUTTON, ROLL_MOUSE, ROLL_MOUSE_ALT, ROLL_MOUSE_MODIFIER, ROTATE3D_BUTTON, SPEED_UP_3D_MODIFIER, }; diff --git a/crates/viewer/re_space_view_spatial/src/heuristics.rs b/crates/viewer/re_view_spatial/src/heuristics.rs similarity index 77% rename from crates/viewer/re_space_view_spatial/src/heuristics.rs rename to crates/viewer/re_view_spatial/src/heuristics.rs index a8de8d3caeec..fbed4e7b8634 100644 --- a/crates/viewer/re_space_view_spatial/src/heuristics.rs +++ b/crates/viewer/re_view_spatial/src/heuristics.rs @@ -1,10 +1,10 @@ use nohash_hasher::IntSet; use re_log_types::EntityPath; -use re_types::SpaceViewClassIdentifier; +use re_types::ViewClassIdentifier; use re_viewer_context::ViewerContext; -use crate::{view_kind::SpatialSpaceViewKind, visualizers::SpatialViewVisualizerData}; +use crate::{view_kind::SpatialViewKind, visualizers::SpatialViewVisualizerData}; /// Returns all entities for which a visualizer of the given kind would be picked. /// @@ -12,13 +12,13 @@ use crate::{view_kind::SpatialSpaceViewKind, visualizers::SpatialViewVisualizerD /// *and* has a matching indicator component. pub fn default_visualized_entities_for_visualizer_kind( ctx: &ViewerContext<'_>, - space_view_class_identifier: SpaceViewClassIdentifier, - visualizer_kind: SpatialSpaceViewKind, + view_class_identifier: ViewClassIdentifier, + visualizer_kind: SpatialViewKind, ) -> IntSet { re_tracing::profile_function!(); - ctx.space_view_class_registry - .new_visualizer_collection(space_view_class_identifier) + ctx.view_class_registry + .new_visualizer_collection(view_class_identifier) .iter_with_identifiers() .filter_map(|(id, visualizer)| { let data = visualizer diff --git a/crates/viewer/re_space_view_spatial/src/lib.rs b/crates/viewer/re_view_spatial/src/lib.rs similarity index 95% rename from crates/viewer/re_space_view_spatial/src/lib.rs rename to crates/viewer/re_view_spatial/src/lib.rs index 85c6d8ea275a..62cf77783d4f 100644 --- a/crates/viewer/re_space_view_spatial/src/lib.rs +++ b/crates/viewer/re_view_spatial/src/lib.rs @@ -1,6 +1,6 @@ -//! Rerun Spatial Space Views +//! Rerun Spatial Views //! -//! Space Views that show entities in a 2D or 3D spatial relationship. +//! Views that show entities in a 2D or 3D spatial relationship. // TODO(#6330): remove unwrap() #![allow(clippy::unwrap_used)] @@ -29,14 +29,14 @@ mod view_3d; mod view_3d_properties; mod visualizers; -pub use view_2d::SpatialSpaceView2D; -pub use view_3d::SpatialSpaceView3D; +pub use view_2d::SpatialView2D; +pub use view_3d::SpatialView3D; pub(crate) use pickable_textured_rect::{PickableRectSourceData, PickableTexturedRect}; // --- -use re_space_view::DataResultQuery as _; +use re_view::DataResultQuery as _; use re_viewer_context::{ImageDecodeCache, ViewContext, ViewerContext}; use re_renderer::RenderContext; @@ -50,7 +50,7 @@ use re_viewport_blueprint::{ViewProperty, ViewPropertyQueryError}; mod view_kind { #[derive(Debug, Clone, Copy, PartialEq, Eq)] - pub enum SpatialSpaceViewKind { + pub enum SpatialViewKind { TwoD, ThreeD, } @@ -159,7 +159,7 @@ pub(crate) fn configure_background( background: &ViewProperty, render_ctx: &RenderContext, view_system: &dyn re_viewer_context::ComponentFallbackProvider, - state: &dyn re_viewer_context::SpaceViewState, + state: &dyn re_viewer_context::ViewState, ) -> Result<(Option, re_renderer::Rgba), ViewPropertyQueryError> { use re_renderer::renderer; diff --git a/crates/viewer/re_space_view_spatial/src/max_image_dimension_subscriber.rs b/crates/viewer/re_view_spatial/src/max_image_dimension_subscriber.rs similarity index 100% rename from crates/viewer/re_space_view_spatial/src/max_image_dimension_subscriber.rs rename to crates/viewer/re_view_spatial/src/max_image_dimension_subscriber.rs diff --git a/crates/viewer/re_space_view_spatial/src/mesh_cache.rs b/crates/viewer/re_view_spatial/src/mesh_cache.rs similarity index 100% rename from crates/viewer/re_space_view_spatial/src/mesh_cache.rs rename to crates/viewer/re_view_spatial/src/mesh_cache.rs diff --git a/crates/viewer/re_space_view_spatial/src/mesh_loader.rs b/crates/viewer/re_view_spatial/src/mesh_loader.rs similarity index 100% rename from crates/viewer/re_space_view_spatial/src/mesh_loader.rs rename to crates/viewer/re_view_spatial/src/mesh_loader.rs diff --git a/crates/viewer/re_space_view_spatial/src/pickable_textured_rect.rs b/crates/viewer/re_view_spatial/src/pickable_textured_rect.rs similarity index 85% rename from crates/viewer/re_space_view_spatial/src/pickable_textured_rect.rs rename to crates/viewer/re_view_spatial/src/pickable_textured_rect.rs index 80ca5969fec3..7d65e11b60e4 100644 --- a/crates/viewer/re_space_view_spatial/src/pickable_textured_rect.rs +++ b/crates/viewer/re_view_spatial/src/pickable_textured_rect.rs @@ -1,7 +1,7 @@ use re_log_types::EntityPath; use re_renderer::{renderer::TexturedRect, QueueableDrawData}; use re_types::components::DepthMeter; -use re_viewer_context::{ImageInfo, SpaceViewSystemExecutionError}; +use re_viewer_context::{ImageInfo, ViewSystemExecutionError}; #[derive(Clone)] pub enum PickableRectSourceData { @@ -39,7 +39,7 @@ impl PickableTexturedRect { pub fn to_draw_data( render_ctx: &re_renderer::RenderContext, rects: &[Self], - ) -> Result { + ) -> Result { // TODO(wumpf): Can we avoid this copy, maybe let DrawData take an iterator? let rectangles = rects .iter() @@ -47,9 +47,9 @@ impl PickableTexturedRect { .collect::>(); match re_renderer::renderer::RectangleDrawData::new(render_ctx, &rectangles) { Ok(draw_data) => Ok(draw_data.into()), - Err(err) => Err(SpaceViewSystemExecutionError::DrawDataCreationError( - Box::new(err), - )), + Err(err) => Err(ViewSystemExecutionError::DrawDataCreationError(Box::new( + err, + ))), } } } diff --git a/crates/viewer/re_space_view_spatial/src/picking.rs b/crates/viewer/re_view_spatial/src/picking.rs similarity index 99% rename from crates/viewer/re_space_view_spatial/src/picking.rs rename to crates/viewer/re_view_spatial/src/picking.rs index 2a6ba76c966f..fcd12266d257 100644 --- a/crates/viewer/re_space_view_spatial/src/picking.rs +++ b/crates/viewer/re_view_spatial/src/picking.rs @@ -230,7 +230,7 @@ fn picking_gpu( gpu_picking_result.picked_world_position(picked_on_picking_rect.as_uvec2()); Some(PickingRayHit { - instance_path_hash: re_space_view::instance_path_hash_from_picking_layer_id(picked_id), + instance_path_hash: re_view::instance_path_hash_from_picking_layer_id(picked_id), space_position: picked_world_position, depth_offset: 1, hit_type: PickingHitType::GpuPickingResult, diff --git a/crates/viewer/re_space_view_spatial/src/picking_ui.rs b/crates/viewer/re_view_spatial/src/picking_ui.rs similarity index 90% rename from crates/viewer/re_space_view_spatial/src/picking_ui.rs rename to crates/viewer/re_view_spatial/src/picking_ui.rs index bfd8e096fb88..b91ebcdf5c7f 100644 --- a/crates/viewer/re_space_view_spatial/src/picking_ui.rs +++ b/crates/viewer/re_view_spatial/src/picking_ui.rs @@ -2,21 +2,21 @@ use egui::NumExt as _; use re_data_ui::{item_ui, DataUi as _}; use re_log_types::Instance; -use re_space_view::AnnotationSceneContext; use re_ui::{ list_item::{list_item_scope, PropertyContent}, UiExt as _, }; +use re_view::AnnotationSceneContext; use re_viewer_context::{ - Item, ItemSpaceContext, SpaceViewSystemExecutionError, UiLayout, ViewQuery, ViewerContext, + Item, ItemSpaceContext, UiLayout, ViewQuery, ViewSystemExecutionError, ViewerContext, VisualizerCollection, }; use crate::{ picking::{PickableUiRect, PickingContext, PickingHitType}, picking_ui_pixel::{textured_rect_hover_ui, PickedPixelInfo}, - ui::SpatialSpaceViewState, - view_kind::SpatialSpaceViewKind, + ui::SpatialViewState, + view_kind::SpatialViewKind, visualizers::{CamerasVisualizer, DepthImageVisualizer, SpatialViewVisualizerData}, PickableRectSourceData, PickableTexturedRect, }; @@ -28,12 +28,12 @@ pub fn picking( ui: &egui::Ui, mut response: egui::Response, view_builder: &mut re_renderer::view_builder::ViewBuilder, - state: &mut SpatialSpaceViewState, + state: &mut SpatialViewState, system_output: &re_viewer_context::SystemExecutionOutput, ui_rects: &[PickableUiRect], query: &ViewQuery<'_>, - spatial_kind: SpatialSpaceViewKind, -) -> Result { + spatial_kind: SpatialViewKind, +) -> Result { re_tracing::profile_function!(); if ui.ctx().dragged_id().is_some() { @@ -42,7 +42,7 @@ pub fn picking( } let Some(render_ctx) = ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let picking_rect_size = PickingContext::UI_INTERACTION_RADIUS * ui.ctx().pixels_per_point(); @@ -59,7 +59,7 @@ pub fn picking( picking_context.pointer_in_pixel.as_ivec2(), glam::uvec2(picking_rect_size, picking_rect_size), ), - query.space_view_id.gpu_readback_id(), + query.view_id.gpu_readback_id(), (), ctx.app_options.show_picking_debug_overlay, ); @@ -70,7 +70,7 @@ pub fn picking( let picking_result = picking_context.pick( render_ctx, - query.space_view_id.gpu_readback_id(), + query.view_id.gpu_readback_id(), &state.previous_picking_result, iter_pickable_rects(&system_output.view_systems), ui_rects, @@ -93,7 +93,7 @@ pub fn picking( instance_path.instance = Instance::ALL; } - let query_result = ctx.lookup_query_result(query.space_view_id); + let query_result = ctx.lookup_query_result(query.view_id); let Some(data_result) = query_result .tree .lookup_result_by_path(&instance_path.entity_path) @@ -153,7 +153,7 @@ pub fn picking( &query.latest_at_query(), ctx.recording(), ui, - Some(query.space_view_id), + Some(query.view_id), &instance_path, ); instance_path.data_ui_recording(ctx, ui, UiLayout::Tooltip); @@ -161,16 +161,16 @@ pub fn picking( }) }; - hovered_items.push(Item::DataResult(query.space_view_id, instance_path.clone())); + hovered_items.push(Item::DataResult(query.view_id, instance_path.clone())); } if hovered_items.is_empty() { - // If we hover nothing, we are hovering the space-view itself. - hovered_items.push(Item::SpaceView(query.space_view_id)); + // If we hover nothing, we are hovering the view itself. + hovered_items.push(Item::View(query.view_id)); } // Associate the hovered space with the first item in the hovered item list. - // If we were to add several, space views might render unnecessary additional hints. + // If we were to add several, views might render unnecessary additional hints. // TODO(andreas): Should there be context if no item is hovered at all? There's no usecase for that today it seems. let mut hovered_items = hovered_items .into_iter() @@ -179,13 +179,13 @@ pub fn picking( if let Some((_, context)) = hovered_items.first_mut() { *context = Some(match spatial_kind { - SpatialSpaceViewKind::TwoD => ItemSpaceContext::TwoD { + SpatialViewKind::TwoD => ItemSpaceContext::TwoD { space_2d: query.space_origin.clone(), pos: picking_context .pointer_in_camera_plane .extend(depth_at_pointer.unwrap_or(f32::INFINITY)), }, - SpatialSpaceViewKind::ThreeD => { + SpatialViewKind::ThreeD => { let hovered_point = picking_result.space_position(); let cameras_visualizer_output = system_output.view_systems.get::()?; diff --git a/crates/viewer/re_space_view_spatial/src/picking_ui_pixel.rs b/crates/viewer/re_view_spatial/src/picking_ui_pixel.rs similarity index 98% rename from crates/viewer/re_space_view_spatial/src/picking_ui_pixel.rs rename to crates/viewer/re_view_spatial/src/picking_ui_pixel.rs index ce1da8fc537b..05f7307408a1 100644 --- a/crates/viewer/re_space_view_spatial/src/picking_ui_pixel.rs +++ b/crates/viewer/re_view_spatial/src/picking_ui_pixel.rs @@ -1,11 +1,11 @@ use re_data_ui::item_ui; use re_renderer::{external::wgpu, renderer::ColormappedTexture, resource_managers::GpuTexture2D}; -use re_space_view::AnnotationSceneContext; use re_types::{datatypes::ColorModel, image::ImageKind, tensor_data::TensorElement}; use re_ui::UiExt as _; +use re_view::AnnotationSceneContext; use re_viewer_context::{gpu_bridge, Annotations, ImageInfo, ViewQuery, ViewerContext}; -use crate::{view_kind::SpatialSpaceViewKind, PickableRectSourceData}; +use crate::{view_kind::SpatialViewKind, PickableRectSourceData}; pub struct PickedPixelInfo { pub source_data: PickableRectSourceData, @@ -19,7 +19,7 @@ pub fn textured_rect_hover_ui( ui: &mut egui::Ui, instance_path: &re_entity_db::InstancePath, query: &ViewQuery<'_>, - spatial_kind: SpatialSpaceViewKind, + spatial_kind: SpatialViewKind, ui_pan_and_zoom_from_ui: egui::emath::RectTransform, annotations: &AnnotationSceneContext, picked_pixel_info: PickedPixelInfo, @@ -51,7 +51,7 @@ pub fn textured_rect_hover_ui( &query.latest_at_query(), ctx.recording(), ui, - Some(query.space_view_id), + Some(query.view_id), instance_path, ); @@ -61,7 +61,7 @@ pub fn textured_rect_hover_ui( let [w, h] = texture.width_height(); let (w, h) = (w as f32, h as f32); - if spatial_kind == SpatialSpaceViewKind::TwoD { + if spatial_kind == SpatialViewKind::TwoD { let rect = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(w, h)); show_zoomed_image_region_area_outline( diff --git a/crates/viewer/re_space_view_spatial/src/proc_mesh.rs b/crates/viewer/re_view_spatial/src/proc_mesh.rs similarity index 100% rename from crates/viewer/re_space_view_spatial/src/proc_mesh.rs rename to crates/viewer/re_view_spatial/src/proc_mesh.rs diff --git a/crates/viewer/re_space_view_spatial/src/scene_bounding_boxes.rs b/crates/viewer/re_view_spatial/src/scene_bounding_boxes.rs similarity index 94% rename from crates/viewer/re_space_view_spatial/src/scene_bounding_boxes.rs rename to crates/viewer/re_view_spatial/src/scene_bounding_boxes.rs index 986106e14f14..44484a46e4e5 100644 --- a/crates/viewer/re_space_view_spatial/src/scene_bounding_boxes.rs +++ b/crates/viewer/re_view_spatial/src/scene_bounding_boxes.rs @@ -3,7 +3,7 @@ use nohash_hasher::IntMap; use re_log_types::EntityPathHash; use re_viewer_context::VisualizerCollection; -use crate::{view_kind::SpatialSpaceViewKind, visualizers::SpatialViewVisualizerData}; +use crate::{view_kind::SpatialViewKind, visualizers::SpatialViewVisualizerData}; #[derive(Clone)] pub struct SceneBoundingBoxes { @@ -34,7 +34,7 @@ impl SceneBoundingBoxes { &mut self, ui: &egui::Ui, visualizers: &VisualizerCollection, - space_kind: SpatialSpaceViewKind, + space_kind: SpatialViewKind, ) { re_tracing::profile_function!(); @@ -48,8 +48,8 @@ impl SceneBoundingBoxes { // bounding box, creating a feedback loop if we were to add it here. let data_is_only_2d = data .preferred_view_kind - .map_or(false, |kind| kind == SpatialSpaceViewKind::TwoD); - if space_kind == SpatialSpaceViewKind::ThreeD && data_is_only_2d { + .map_or(false, |kind| kind == SpatialViewKind::TwoD); + if space_kind == SpatialViewKind::ThreeD && data_is_only_2d { continue; } diff --git a/crates/viewer/re_space_view_spatial/src/space_camera_3d.rs b/crates/viewer/re_view_spatial/src/space_camera_3d.rs similarity index 100% rename from crates/viewer/re_space_view_spatial/src/space_camera_3d.rs rename to crates/viewer/re_view_spatial/src/space_camera_3d.rs diff --git a/crates/viewer/re_space_view_spatial/src/spatial_topology.rs b/crates/viewer/re_view_spatial/src/spatial_topology.rs similarity index 99% rename from crates/viewer/re_space_view_spatial/src/spatial_topology.rs rename to crates/viewer/re_view_spatial/src/spatial_topology.rs index 6d6407fc85d4..67d3b942ec7c 100644 --- a/crates/viewer/re_space_view_spatial/src/spatial_topology.rs +++ b/crates/viewer/re_view_spatial/src/spatial_topology.rs @@ -176,7 +176,7 @@ impl ChunkStoreSubscriber for SpatialTopologyStoreSubscriber { /// Describes how 2D & 3D spaces are connected/disconnected. /// /// Used to determine whether 2D/3D visualizers are applicable and to inform -/// space view generation heuristics. +/// view generation heuristics. /// /// Spatial topology is time independent but may change as new data comes in. /// Generally, the assumption is that topological cuts stay constant over time. diff --git a/crates/viewer/re_space_view_spatial/src/transform_component_tracker.rs b/crates/viewer/re_view_spatial/src/transform_component_tracker.rs similarity index 100% rename from crates/viewer/re_space_view_spatial/src/transform_component_tracker.rs rename to crates/viewer/re_view_spatial/src/transform_component_tracker.rs diff --git a/crates/viewer/re_space_view_spatial/src/ui.rs b/crates/viewer/re_view_spatial/src/ui.rs similarity index 93% rename from crates/viewer/re_space_view_spatial/src/ui.rs rename to crates/viewer/re_view_spatial/src/ui.rs index 69c13d7932b9..732ddd11da8e 100644 --- a/crates/viewer/re_space_view_spatial/src/ui.rs +++ b/crates/viewer/re_view_spatial/src/ui.rs @@ -7,14 +7,14 @@ use re_types::{ image::ImageKind, }; use re_ui::UiExt as _; -use re_viewer_context::{HoverHighlight, SelectionHighlight, SpaceViewHighlights, SpaceViewState}; +use re_viewer_context::{HoverHighlight, SelectionHighlight, ViewHighlights, ViewState}; use crate::{ eye::EyeMode, pickable_textured_rect::PickableRectSourceData, picking::{PickableUiRect, PickingResult}, scene_bounding_boxes::SceneBoundingBoxes, - view_kind::SpatialSpaceViewKind, + view_kind::SpatialViewKind, visualizers::{SpatialViewVisualizerData, UiLabel, UiLabelStyle, UiLabelTarget}, }; @@ -37,9 +37,9 @@ impl From for WidgetText { } } -/// TODO(andreas): Should turn this "inside out" - [`SpatialSpaceViewState`] should be used by [`View3DState`], not the other way round. +/// TODO(andreas): Should turn this "inside out" - [`SpatialViewState`] should be used by [`View3DState`], not the other way round. #[derive(Clone, Default)] -pub struct SpatialSpaceViewState { +pub struct SpatialViewState { pub bounding_boxes: SceneBoundingBoxes, /// Number of images & depth images processed last frame. @@ -56,7 +56,7 @@ pub struct SpatialSpaceViewState { pub visual_bounds_2d: Option, } -impl SpaceViewState for SpatialSpaceViewState { +impl ViewState for SpatialViewState { fn as_any(&self) -> &dyn std::any::Any { self } @@ -66,13 +66,13 @@ impl SpaceViewState for SpatialSpaceViewState { } } -impl SpatialSpaceViewState { +impl SpatialViewState { /// Updates the state with statistics from the latest system outputs. pub fn update_frame_statistics( &mut self, ui: &egui::Ui, system_output: &re_viewer_context::SystemExecutionOutput, - space_kind: SpatialSpaceViewKind, + space_kind: SpatialViewKind, ) { re_tracing::profile_function!(); @@ -95,7 +95,7 @@ impl SpatialSpaceViewState { .sum(); } - pub fn bounding_box_ui(&self, ui: &mut egui::Ui, spatial_kind: SpatialSpaceViewKind) { + pub fn bounding_box_ui(&self, ui: &mut egui::Ui, spatial_kind: SpatialViewKind) { ui.grid_left_hand_label("Bounding box") .on_hover_text("The bounding box encompassing all Entities in the view right now"); ui.vertical(|ui| { @@ -103,7 +103,7 @@ impl SpatialSpaceViewState { let BoundingBox { min, max } = self.bounding_boxes.current; ui.label(format!("x [{} - {}]", format_f32(min.x), format_f32(max.x),)); ui.label(format!("y [{} - {}]", format_f32(min.y), format_f32(max.y),)); - if spatial_kind == SpatialSpaceViewKind::ThreeD { + if spatial_kind == SpatialViewKind::ThreeD { ui.label(format!("z [{} - {}]", format_f32(min.z), format_f32(max.z),)); } }); @@ -155,8 +155,8 @@ pub fn create_labels( ui_from_scene: egui::emath::RectTransform, eye3d: &Eye, parent_ui: &egui::Ui, - highlights: &SpaceViewHighlights, - spatial_kind: SpatialSpaceViewKind, + highlights: &ViewHighlights, + spatial_kind: SpatialViewKind, ) -> (Vec, Vec) { re_tracing::profile_function!(); @@ -178,7 +178,7 @@ pub fn create_labels( let (wrap_width, text_anchor_pos) = match label.target { UiLabelTarget::Rect(rect) => { // TODO(#1640): 2D labels are not visible in 3D for now. - if spatial_kind == SpatialSpaceViewKind::ThreeD { + if spatial_kind == SpatialViewKind::ThreeD { continue; } let rect_in_ui = ui_from_scene.transform_rect(rect); @@ -190,7 +190,7 @@ pub fn create_labels( } UiLabelTarget::Point2D(pos) => { // TODO(#1640): 2D labels are not visible in 3D for now. - if spatial_kind == SpatialSpaceViewKind::ThreeD { + if spatial_kind == SpatialViewKind::ThreeD { continue; } let pos_in_ui = ui_from_scene.transform_pos(pos); @@ -198,7 +198,7 @@ pub fn create_labels( } UiLabelTarget::Position3D(pos) => { // TODO(#1640): 3D labels are not visible in 2D for now. - if spatial_kind == SpatialSpaceViewKind::TwoD { + if spatial_kind == SpatialViewKind::TwoD { continue; } let pos_in_ui = ui_from_world_3d * pos.extend(1.0); diff --git a/crates/viewer/re_space_view_spatial/src/ui_2d.rs b/crates/viewer/re_view_spatial/src/ui_2d.rs similarity index 95% rename from crates/viewer/re_space_view_spatial/src/ui_2d.rs rename to crates/viewer/re_view_spatial/src/ui_2d.rs index 6f5ae55cfd15..bf557b8a6a07 100644 --- a/crates/viewer/re_space_view_spatial/src/ui_2d.rs +++ b/crates/viewer/re_view_spatial/src/ui_2d.rs @@ -4,7 +4,6 @@ use re_math::IsoTransform; use re_entity_db::EntityPath; use re_log::ResultExt as _; use re_renderer::view_builder::{TargetConfiguration, ViewBuilder}; -use re_space_view::controls::{DRAG_PAN2D_BUTTON, ZOOM_SCROLL_MODIFIER}; use re_types::{ archetypes::Pinhole, blueprint::{ @@ -14,15 +13,16 @@ use re_types::{ components::ViewCoordinates, }; use re_ui::{ContextExt as _, ModifiersMarkdown, MouseButtonMarkdown}; +use re_view::controls::{DRAG_PAN2D_BUTTON, ZOOM_SCROLL_MODIFIER}; use re_viewer_context::{ - gpu_bridge, ItemSpaceContext, SpaceViewSystemExecutionError, ViewQuery, ViewerContext, + gpu_bridge, ItemSpaceContext, ViewQuery, ViewSystemExecutionError, ViewerContext, }; use re_viewport_blueprint::ViewProperty; use super::{eye::Eye, ui::create_labels}; use crate::{ - query_pinhole_legacy, ui::SpatialSpaceViewState, view_kind::SpatialSpaceViewKind, - visualizers::collect_ui_labels, SpatialSpaceView2D, + query_pinhole_legacy, ui::SpatialViewState, view_kind::SpatialViewKind, + visualizers::collect_ui_labels, SpatialView2D, }; // --- @@ -31,8 +31,8 @@ use crate::{ fn ui_from_scene( ctx: &ViewerContext<'_>, response: &egui::Response, - view_class: &SpatialSpaceView2D, - view_state: &mut SpatialSpaceViewState, + view_class: &SpatialView2D, + view_state: &mut SpatialViewState, bounds_property: &ViewProperty, ) -> RectTransform { let bounds: blueprint_components::VisualBounds2D = bounds_property @@ -134,15 +134,15 @@ Display 2D content in the reference frame defined by the space origin. } /// Create the outer 2D view, which consists of a scrollable region -impl SpatialSpaceView2D { +impl SpatialView2D { pub fn view_2d( &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut SpatialSpaceViewState, + state: &mut SpatialViewState, query: &ViewQuery<'_>, system_output: re_viewer_context::SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); if ui.available_size().min_elem() <= 0.0 { @@ -166,7 +166,7 @@ impl SpatialSpaceView2D { let bounds_property = ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, - query.space_view_id, + query.view_id, ); // Convert ui coordinates to/from scene coordinates. @@ -206,11 +206,11 @@ impl SpatialSpaceView2D { &eye, ui, &query.highlights, - SpatialSpaceViewKind::TwoD, + SpatialViewKind::TwoD, ); let Some(render_ctx) = ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut view_builder = ViewBuilder::new(render_ctx, target_config); @@ -232,7 +232,7 @@ impl SpatialSpaceView2D { &system_output, &ui_rects, query, - SpatialSpaceViewKind::TwoD, + SpatialViewKind::TwoD, )?; } else { state.previous_picking_result = None; @@ -245,7 +245,7 @@ impl SpatialSpaceView2D { let background = ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, - query.space_view_id, + query.view_id, ); let (background_drawable, clear_color) = crate::configure_background(ctx, &background, render_ctx, self, state)?; @@ -405,7 +405,7 @@ fn setup_target_config( projection_from_view, viewport_transformation, pixels_per_point, - outline_config: any_outlines.then(|| re_space_view::outline_config(egui_painter.ctx())), + outline_config: any_outlines.then(|| re_view::outline_config(egui_painter.ctx())), blend_with_background: false, } }) diff --git a/crates/viewer/re_space_view_spatial/src/ui_3d.rs b/crates/viewer/re_view_spatial/src/ui_3d.rs similarity index 97% rename from crates/viewer/re_space_view_spatial/src/ui_3d.rs rename to crates/viewer/re_view_spatial/src/ui_3d.rs index e5e5d5e104c9..9532a7f69abf 100644 --- a/crates/viewer/re_space_view_spatial/src/ui_3d.rs +++ b/crates/viewer/re_view_spatial/src/ui_3d.rs @@ -8,10 +8,6 @@ use re_renderer::{ view_builder::{Projection, TargetConfiguration, ViewBuilder}, LineDrawableBuilder, Size, }; -use re_space_view::controls::{ - RuntimeModifiers, DRAG_PAN3D_BUTTON, ROLL_MOUSE, ROLL_MOUSE_ALT, ROLL_MOUSE_MODIFIER, - ROTATE3D_BUTTON, SPEED_UP_3D_MODIFIER, TRACKED_OBJECT_RESTORE_KEY, -}; use re_types::{ blueprint::{ archetypes::{Background, LineGrid3D}, @@ -21,18 +17,22 @@ use re_types::{ view_coordinates::SignedAxis3, }; use re_ui::{ContextExt, ModifiersMarkdown, MouseButtonMarkdown}; +use re_view::controls::{ + RuntimeModifiers, DRAG_PAN3D_BUTTON, ROLL_MOUSE, ROLL_MOUSE_ALT, ROLL_MOUSE_MODIFIER, + ROTATE3D_BUTTON, SPEED_UP_3D_MODIFIER, TRACKED_OBJECT_RESTORE_KEY, +}; use re_viewer_context::{ - gpu_bridge, Item, ItemSpaceContext, SpaceViewSystemExecutionError, ViewQuery, ViewerContext, + gpu_bridge, Item, ItemSpaceContext, ViewQuery, ViewSystemExecutionError, ViewerContext, }; use re_viewport_blueprint::ViewProperty; use crate::{ scene_bounding_boxes::SceneBoundingBoxes, space_camera_3d::SpaceCamera3D, - ui::{create_labels, SpatialSpaceViewState}, - view_kind::SpatialSpaceViewKind, + ui::{create_labels, SpatialViewState}, + view_kind::SpatialViewKind, visualizers::{collect_ui_labels, image_view_coordinates, CamerasVisualizer}, - SpatialSpaceView3D, + SpatialView3D, }; use super::eye::{Eye, ViewEye}; @@ -418,15 +418,15 @@ Display 3D content in the reference frame defined by the space origin. ) } -impl SpatialSpaceView3D { +impl SpatialView3D { pub fn view_3d( &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut SpatialSpaceViewState, + state: &mut SpatialViewState, query: &ViewQuery<'_>, system_output: re_viewer_context::SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); let highlights = &query.highlights; @@ -481,18 +481,18 @@ impl SpatialSpaceView3D { outline_config: query .highlights .any_outlines() - .then(|| re_space_view::outline_config(ui.ctx())), + .then(|| re_view::outline_config(ui.ctx())), blend_with_background: false, }; let Some(render_ctx) = ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; // Various ui interactions draw additional lines. let mut line_builder = LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); // We don't know ahead of time how many lines we need, but it's not gonna be a huge amount! line_builder.reserve_strips(32)?; @@ -524,7 +524,7 @@ impl SpatialSpaceView3D { &eye, ui, highlights, - SpatialSpaceViewKind::ThreeD, + SpatialViewKind::ThreeD, ); if let Some(pointer_pos_ui) = response.hover_pos() { @@ -547,7 +547,7 @@ impl SpatialSpaceView3D { &system_output, &ui_rects, query, - SpatialSpaceViewKind::ThreeD, + SpatialViewKind::ThreeD, )?; } else { state.previous_picking_result = None; @@ -560,8 +560,8 @@ impl SpatialSpaceView3D { None } - Item::SpaceView(space_view_id) => { - if space_view_id == &query.space_view_id { + Item::View(view_id) => { + if view_id == &query.view_id { state .state_3d .reset_camera(&state.bounding_boxes, scene_view_coordinates); @@ -573,8 +573,8 @@ impl SpatialSpaceView3D { Item::InstancePath(instance_path) => Some(&instance_path.entity_path), - Item::DataResult(space_view_id, instance_path) => { - if *space_view_id == query.space_view_id { + Item::DataResult(view_id, instance_path) => { + if *view_id == query.view_id { Some(&instance_path.entity_path) } else { None @@ -669,7 +669,7 @@ impl SpatialSpaceView3D { let grid_config = ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, - query.space_view_id, + query.view_id, ); if let Some(draw_data) = self.setup_grid_3d(ctx, &grid_config, state)? { view_builder.queue_draw(draw_data); @@ -681,7 +681,7 @@ impl SpatialSpaceView3D { let background = ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, - query.space_view_id, + query.view_id, ); let (background_drawable, clear_color) = crate::configure_background(ctx, &background, render_ctx, self, state)?; @@ -714,9 +714,8 @@ impl SpatialSpaceView3D { &self, ctx: &ViewerContext<'_>, grid_config: &ViewProperty, - state: &SpatialSpaceViewState, - ) -> Result, SpaceViewSystemExecutionError> - { + state: &SpatialViewState, + ) -> Result, ViewSystemExecutionError> { if !**grid_config.component_or_fallback::(ctx, self, state)? { return Ok(None); } @@ -848,7 +847,7 @@ fn show_orbit_eye_center( fn show_projections_from_2d_space( line_builder: &mut re_renderer::LineDrawableBuilder<'_>, space_cameras: &[SpaceCamera3D], - state: &SpatialSpaceViewState, + state: &SpatialViewState, space_context: &ItemSpaceContext, ray_color: egui::Color32, ) { diff --git a/crates/viewer/re_space_view_spatial/src/view_2d.rs b/crates/viewer/re_view_spatial/src/view_2d.rs similarity index 78% rename from crates/viewer/re_space_view_spatial/src/view_2d.rs rename to crates/viewer/re_view_spatial/src/view_2d.rs index 00b77f578f74..7a8afd046f8e 100644 --- a/crates/viewer/re_space_view_spatial/src/view_2d.rs +++ b/crates/viewer/re_view_spatial/src/view_2d.rs @@ -3,18 +3,18 @@ use nohash_hasher::{IntMap, IntSet}; use re_entity_db::{EntityDb, EntityTree}; use re_log_types::EntityPath; -use re_space_view::view_property_ui; use re_types::View; use re_types::{ archetypes::{DepthImage, Image}, blueprint::archetypes::{Background, VisualBounds2D}, - Archetype, ComponentName, SpaceViewClassIdentifier, + Archetype, ComponentName, ViewClassIdentifier, }; use re_ui::UiExt as _; +use re_view::view_property_ui; use re_viewer_context::{ - RecommendedSpaceView, SpaceViewClass, SpaceViewClassRegistryError, SpaceViewId, - SpaceViewSpawnHeuristics, SpaceViewState, SpaceViewStateExt as _, - SpaceViewSystemExecutionError, ViewQuery, ViewerContext, VisualizableFilterContext, + RecommendedView, ViewClass, ViewClassRegistryError, ViewId, ViewQuery, ViewSpawnHeuristics, + ViewState, ViewStateExt as _, ViewSystemExecutionError, ViewerContext, + VisualizableFilterContext, }; use crate::{ @@ -22,8 +22,8 @@ use crate::{ heuristics::default_visualized_entities_for_visualizer_kind, max_image_dimension_subscriber::{MaxDimensions, MaxImageDimensions}, spatial_topology::{SpatialTopology, SubSpaceConnectionFlags}, - ui::SpatialSpaceViewState, - view_kind::SpatialSpaceViewKind, + ui::SpatialViewState, + view_kind::SpatialViewKind, visualizers::register_2d_spatial_visualizers, }; @@ -41,12 +41,12 @@ impl VisualizableFilterContext for VisualizableFilterContext2D { } #[derive(Default)] -pub struct SpatialSpaceView2D; +pub struct SpatialView2D; type ViewType = re_types::blueprint::views::Spatial2DView; -impl SpaceViewClass for SpatialSpaceView2D { - fn identifier() -> SpaceViewClassIdentifier { +impl ViewClass for SpatialView2D { + fn identifier() -> ViewClassIdentifier { ViewType::identifier() } @@ -55,7 +55,7 @@ impl SpaceViewClass for SpatialSpaceView2D { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_2D + &re_ui::icons::VIEW_2D } fn help_markdown(&self, egui_ctx: &egui::Context) -> String { @@ -64,8 +64,8 @@ impl SpaceViewClass for SpatialSpaceView2D { fn on_register( &self, - system_registry: &mut re_viewer_context::SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut re_viewer_context::ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { // Ensure spatial topology & max image dimension is registered. crate::spatial_topology::SpatialTopologyStoreSubscriber::subscription_handle(); crate::transform_component_tracker::TransformComponentTrackerStoreSubscriber::subscription_handle(); @@ -77,41 +77,38 @@ impl SpaceViewClass for SpatialSpaceView2D { Ok(()) } - fn new_state(&self) -> Box { - Box::::default() + fn new_state(&self) -> Box { + Box::::default() } - fn preferred_tile_aspect_ratio(&self, state: &dyn SpaceViewState) -> Option { - state - .downcast_ref::() - .ok() - .map(|state| { - let (width, height) = state.visual_bounds_2d.map_or_else( - || { - let bbox = &state.bounding_boxes.smoothed; - ( - (bbox.max.x - bbox.min.x).abs(), - (bbox.max.y - bbox.min.y).abs(), - ) - }, - |bounds| { - ( - bounds.x_range.abs_len() as f32, - bounds.y_range.abs_len() as f32, - ) - }, - ); + fn preferred_tile_aspect_ratio(&self, state: &dyn ViewState) -> Option { + state.downcast_ref::().ok().map(|state| { + let (width, height) = state.visual_bounds_2d.map_or_else( + || { + let bbox = &state.bounding_boxes.smoothed; + ( + (bbox.max.x - bbox.min.x).abs(), + (bbox.max.y - bbox.min.y).abs(), + ) + }, + |bounds| { + ( + bounds.x_range.abs_len() as f32, + bounds.y_range.abs_len() as f32, + ) + }, + ); - width / height - }) + width / height + }) } fn supports_visible_time_range(&self) -> bool { true } - fn layout_priority(&self) -> re_viewer_context::SpaceViewClassLayoutPriority { - re_viewer_context::SpaceViewClassLayoutPriority::High + fn layout_priority(&self) -> re_viewer_context::ViewClassLayoutPriority { + re_viewer_context::ViewClassLayoutPriority::High } fn recommended_root_for_entities( @@ -121,7 +118,7 @@ impl SpaceViewClass for SpatialSpaceView2D { ) -> Option { let common_ancestor = EntityPath::common_ancestor_of(entities.iter()); - // For a 2D space view, the origin of the subspace defined by the common ancestor is always + // For a 2D view, the origin of the subspace defined by the common ancestor is always // better. SpatialTopology::access(&entity_db.store_id(), |topo| { topo.subspace_for_entity(&common_ancestor).origin.clone() @@ -170,16 +167,13 @@ impl SpaceViewClass for SpatialSpaceView2D { Box::new(context.unwrap_or_default()) } - fn spawn_heuristics( - &self, - ctx: &ViewerContext<'_>, - ) -> re_viewer_context::SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> re_viewer_context::ViewSpawnHeuristics { re_tracing::profile_function!(); let indicated_entities = default_visualized_entities_for_visualizer_kind( ctx, Self::identifier(), - SpatialSpaceViewKind::TwoD, + SpatialViewKind::TwoD, ); let image_dimensions = @@ -188,11 +182,11 @@ impl SpaceViewClass for SpatialSpaceView2D { }) .unwrap_or_default(); - // Spawn a space view at each subspace that has any potential 2D content. + // Spawn a view at each subspace that has any potential 2D content. // Note that visualizability filtering is all about being in the right subspace, // so we don't need to call the visualizers' filter functions here. SpatialTopology::access(&ctx.recording_id(), |topo| { - SpaceViewSpawnHeuristics::new(topo.iter_subspaces().flat_map(|subspace| { + ViewSpawnHeuristics::new(topo.iter_subspaces().flat_map(|subspace| { if !subspace.supports_2d_content() || subspace.entities.is_empty() || indicated_entities.is_disjoint(&subspace.entities) @@ -219,17 +213,17 @@ impl SpaceViewClass for SpatialSpaceView2D { EntityPath::common_ancestor_of(relevant_entities.iter()) }; - let mut recommended_space_views = Vec::::new(); + let mut recommended_views = Vec::::new(); - recommended_space_views_with_image_splits( + recommended_views_with_image_splits( ctx, &image_dimensions, &recommended_root, &relevant_entities, - &mut recommended_space_views, + &mut recommended_views, ); - recommended_space_views + recommended_views })) }) .unwrap_or_default() @@ -239,14 +233,14 @@ impl SpaceViewClass for SpatialSpaceView2D { &self, ctx: &re_viewer_context::ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _space_origin: &EntityPath, - view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { - let state = state.downcast_mut::()?; + view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { + let state = state.downcast_mut::()?; // TODO(andreas): list_item'ify the rest ui.selection_grid("spatial_settings_ui").show(ui, |ui| { - state.bounding_box_ui(ui, SpatialSpaceViewKind::TwoD); + state.bounding_box_ui(ui, SpatialViewKind::TwoD); }); re_ui::list_item::list_item_scope(ui, "spatial_view2d_selection_ui", |ui| { @@ -261,15 +255,15 @@ impl SpaceViewClass for SpatialSpaceView2D { &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, query: &ViewQuery<'_>, system_output: re_viewer_context::SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); - let state = state.downcast_mut::()?; - state.update_frame_statistics(ui, &system_output, SpatialSpaceViewKind::TwoD); + let state = state.downcast_mut::()?; + state.update_frame_statistics(ui, &system_output, SpatialViewKind::TwoD); self.view_2d(ctx, ui, state, query, system_output) } @@ -342,12 +336,12 @@ fn find_non_nested_image_dimensions( } } -fn recommended_space_views_with_image_splits( +fn recommended_views_with_image_splits( ctx: &ViewerContext<'_>, image_dimensions: &IntMap, recommended_root: &EntityPath, entities: &IntSet, - recommended: &mut Vec, + recommended: &mut Vec, ) { re_tracing::profile_function!(); @@ -402,16 +396,14 @@ fn recommended_space_views_with_image_splits( if overlap { // If there are multiple images of the same size but of different types, then we can overlap them on top of each other. // This can be useful for comparing a segmentation image on top of an RGB image, for instance. - recommended.push(RecommendedSpaceView::new_subtree(recommended_root.clone())); + recommended.push(RecommendedView::new_subtree(recommended_root.clone())); } else { // Split the space and recurse // If the root also had a visualizable entity, give it its own space. // TODO(jleibs): Maybe merge this entity into each child if entities.contains(recommended_root) { - recommended.push(RecommendedSpaceView::new_single_entity( - recommended_root.clone(), - )); + recommended.push(RecommendedView::new_single_entity(recommended_root.clone())); } // And then recurse into the children @@ -423,7 +415,7 @@ fn recommended_space_views_with_image_splits( .collect(); if !sub_bucket.is_empty() { - recommended_space_views_with_image_splits( + recommended_views_with_image_splits( ctx, image_dimensions, &child.path, diff --git a/crates/viewer/re_space_view_spatial/src/view_2d_properties.rs b/crates/viewer/re_view_spatial/src/view_2d_properties.rs similarity index 81% rename from crates/viewer/re_space_view_spatial/src/view_2d_properties.rs rename to crates/viewer/re_view_spatial/src/view_2d_properties.rs index 2bb4d17844d0..7f524dab5736 100644 --- a/crates/viewer/re_space_view_spatial/src/view_2d_properties.rs +++ b/crates/viewer/re_view_spatial/src/view_2d_properties.rs @@ -7,11 +7,11 @@ use re_types::{ components::Color, Archetype, }; -use re_viewer_context::{SpaceViewStateExt, TypedComponentFallbackProvider}; +use re_viewer_context::{TypedComponentFallbackProvider, ViewStateExt}; -use crate::{ui::SpatialSpaceViewState, SpatialSpaceView2D}; +use crate::{ui::SpatialViewState, SpatialView2D}; -impl TypedComponentFallbackProvider for SpatialSpaceView2D { +impl TypedComponentFallbackProvider for SpatialView2D { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> Color { // Color is a fairly common component, make sure this is the right context. if ctx.archetype_name == Some(Background::name()) { @@ -22,7 +22,7 @@ impl TypedComponentFallbackProvider for SpatialSpaceView2D { } } -impl TypedComponentFallbackProvider for SpatialSpaceView2D { +impl TypedComponentFallbackProvider for SpatialView2D { fn fallback_for(&self, _ctx: &re_viewer_context::QueryContext<'_>) -> BackgroundKind { BackgroundKind::SolidColor } @@ -40,9 +40,9 @@ fn pinhole_resolution_rect(pinhole: &Pinhole) -> Option { .map(|res| egui::Rect::from_min_max(egui::Pos2::ZERO, egui::pos2(res.x, res.y))) } -impl TypedComponentFallbackProvider for SpatialSpaceView2D { +impl TypedComponentFallbackProvider for SpatialView2D { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> VisualBounds2D { - let Ok(view_state) = ctx.view_state.downcast_ref::() else { + let Ok(view_state) = ctx.view_state.downcast_ref::() else { return VisualBounds2D::default(); }; @@ -70,4 +70,4 @@ impl TypedComponentFallbackProvider for SpatialSpaceView2D { } } -re_viewer_context::impl_component_fallback_provider!(SpatialSpaceView2D => [BackgroundKind, Color, VisualBounds2D]); +re_viewer_context::impl_component_fallback_provider!(SpatialView2D => [BackgroundKind, Color, VisualBounds2D]); diff --git a/crates/viewer/re_space_view_spatial/src/view_3d.rs b/crates/viewer/re_view_spatial/src/view_3d.rs similarity index 89% rename from crates/viewer/re_space_view_spatial/src/view_3d.rs rename to crates/viewer/re_view_spatial/src/view_3d.rs index 3beb4cc28ff8..08761f932fc1 100644 --- a/crates/viewer/re_space_view_spatial/src/view_3d.rs +++ b/crates/viewer/re_view_spatial/src/view_3d.rs @@ -4,18 +4,17 @@ use nohash_hasher::IntSet; use re_entity_db::EntityDb; use re_log_types::EntityPath; -use re_space_view::view_property_ui; use re_types::blueprint::archetypes::LineGrid3D; use re_types::{ - blueprint::archetypes::Background, components::ViewCoordinates, Component, - SpaceViewClassIdentifier, View, + blueprint::archetypes::Background, components::ViewCoordinates, Component, View, + ViewClassIdentifier, }; use re_ui::{list_item, UiExt as _}; +use re_view::view_property_ui; use re_viewer_context::{ - ApplicableEntities, IdentifiedViewSystem, IndicatedEntities, PerVisualizer, - RecommendedSpaceView, SmallVisualizerSet, SpaceViewClass, SpaceViewClassRegistryError, - SpaceViewId, SpaceViewSpawnHeuristics, SpaceViewState, SpaceViewStateExt as _, - SpaceViewSystemExecutionError, ViewQuery, ViewSystemIdentifier, ViewerContext, + ApplicableEntities, IdentifiedViewSystem, IndicatedEntities, PerVisualizer, RecommendedView, + SmallVisualizerSet, ViewClass, ViewClassRegistryError, ViewId, ViewQuery, ViewSpawnHeuristics, + ViewState, ViewStateExt as _, ViewSystemExecutionError, ViewSystemIdentifier, ViewerContext, VisualizableEntities, VisualizableFilterContext, }; use re_viewport_blueprint::ViewProperty; @@ -25,8 +24,8 @@ use crate::{ contexts::register_spatial_contexts, heuristics::default_visualized_entities_for_visualizer_kind, spatial_topology::{HeuristicHints, SpatialTopology, SubSpaceConnectionFlags}, - ui::{format_vector, SpatialSpaceViewState}, - view_kind::SpatialSpaceViewKind, + ui::{format_vector, SpatialViewState}, + view_kind::SpatialViewKind, visualizers::register_3d_spatial_visualizers, }; @@ -44,12 +43,12 @@ impl VisualizableFilterContext for VisualizableFilterContext3D { } #[derive(Default)] -pub struct SpatialSpaceView3D; +pub struct SpatialView3D; type ViewType = re_types::blueprint::views::Spatial3DView; -impl SpaceViewClass for SpatialSpaceView3D { - fn identifier() -> SpaceViewClassIdentifier { +impl ViewClass for SpatialView3D { + fn identifier() -> ViewClassIdentifier { ViewType::identifier() } @@ -58,21 +57,21 @@ impl SpaceViewClass for SpatialSpaceView3D { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_3D + &re_ui::icons::VIEW_3D } fn help_markdown(&self, egui_ctx: &egui::Context) -> String { super::ui_3d::help_markdown(egui_ctx) } - fn new_state(&self) -> Box { - Box::::default() + fn new_state(&self) -> Box { + Box::::default() } fn on_register( &self, - system_registry: &mut re_viewer_context::SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut re_viewer_context::ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { // Ensure spatial topology is registered. crate::spatial_topology::SpatialTopologyStoreSubscriber::subscription_handle(); crate::transform_component_tracker::TransformComponentTrackerStoreSubscriber::subscription_handle(); @@ -83,7 +82,7 @@ impl SpaceViewClass for SpatialSpaceView3D { Ok(()) } - fn preferred_tile_aspect_ratio(&self, _state: &dyn SpaceViewState) -> Option { + fn preferred_tile_aspect_ratio(&self, _state: &dyn ViewState) -> Option { None } @@ -91,8 +90,8 @@ impl SpaceViewClass for SpatialSpaceView3D { true } - fn layout_priority(&self) -> re_viewer_context::SpaceViewClassLayoutPriority { - re_viewer_context::SpaceViewClassLayoutPriority::High + fn layout_priority(&self) -> re_viewer_context::ViewClassLayoutPriority { + re_viewer_context::ViewClassLayoutPriority::High } fn recommended_root_for_entities( @@ -102,7 +101,7 @@ impl SpaceViewClass for SpatialSpaceView3D { ) -> Option { let common_ancestor = EntityPath::common_ancestor_of(entities.iter()); - // For 3D space view, the origin of the subspace defined by the common ancestor is usually + // For 3D view, the origin of the subspace defined by the common ancestor is usually // the best choice. However, if the subspace is defined by a pinhole, we should use its // parent. // @@ -263,19 +262,16 @@ impl SpaceViewClass for SpatialSpaceView3D { chosen } - fn spawn_heuristics( - &self, - ctx: &ViewerContext<'_>, - ) -> re_viewer_context::SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> re_viewer_context::ViewSpawnHeuristics { re_tracing::profile_function!(); let mut indicated_entities = default_visualized_entities_for_visualizer_kind( ctx, Self::identifier(), - SpatialSpaceViewKind::ThreeD, + SpatialViewKind::ThreeD, ); - // ViewCoordinates is a strong indicator that a 3D space view is needed. + // ViewCoordinates is a strong indicator that a 3D view is needed. // Note that if the root has `ViewCoordinates`, this will stop the root splitting heuristic // from splitting the root space into several subspaces. // @@ -293,11 +289,11 @@ impl SpaceViewClass for SpatialSpaceView3D { } }); - // Spawn a space view at each subspace that has any potential 3D content. + // Spawn a view at each subspace that has any potential 3D content. // Note that visualizability filtering is all about being in the right subspace, // so we don't need to call the visualizers' filter functions here. SpatialTopology::access(&ctx.recording_id(), |topo| { - SpaceViewSpawnHeuristics::new( + ViewSpawnHeuristics::new( topo.iter_subspaces() .filter_map(|subspace| { if !subspace.supports_3d_content() { @@ -317,12 +313,12 @@ impl SpaceViewClass for SpatialSpaceView3D { }) .peekable(); // Don't collect the iterator, we're only interested in 'any'-style operations. - // Empty space views are still of interest if any of the child spaces is connected via a pinhole. + // Empty views are still of interest if any of the child spaces is connected via a pinhole. if subspace.entities.is_empty() && pinhole_child_spaces.peek().is_none() { return None; } - // Creates space views at each view coordinates if there's any. + // Creates views at each view coordinates if there's any. // (yes, we do so even if they're empty at the moment!) // // An exception to this rule is not to create a view there if this is already _also_ a subspace root. @@ -351,7 +347,7 @@ impl SpaceViewClass for SpatialSpaceView3D { origins.push(subspace.origin.clone()); } - Some(origins.into_iter().map(RecommendedSpaceView::new_subtree)) + Some(origins.into_iter().map(RecommendedView::new_subtree)) }) .flatten(), ) @@ -363,11 +359,11 @@ impl SpaceViewClass for SpatialSpaceView3D { &self, ctx: &re_viewer_context::ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, space_origin: &EntityPath, - view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { - let state = state.downcast_mut::()?; + view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { + let state = state.downcast_mut::()?; let scene_view_coordinates = ctx .recording() @@ -417,7 +413,7 @@ impl SpaceViewClass for SpatialSpaceView3D { }); ui.end_row(); - state.bounding_box_ui(ui, SpatialSpaceViewKind::ThreeD); + state.bounding_box_ui(ui, SpatialViewKind::ThreeD); }); re_ui::list_item::list_item_scope(ui, "spatial_view3d_selection_ui", |ui| { @@ -432,15 +428,15 @@ impl SpaceViewClass for SpatialSpaceView3D { &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, query: &ViewQuery<'_>, system_output: re_viewer_context::SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); - let state = state.downcast_mut::()?; - state.update_frame_statistics(ui, &system_output, SpatialSpaceViewKind::ThreeD); + let state = state.downcast_mut::()?; + state.update_frame_statistics(ui, &system_output, SpatialViewKind::ThreeD); self.view_3d(ctx, ui, state, query, system_output) } @@ -452,9 +448,9 @@ impl SpaceViewClass for SpatialSpaceView3D { fn view_property_ui_grid3d( ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - view_id: SpaceViewId, + view_id: ViewId, fallback_provider: &dyn re_viewer_context::ComponentFallbackProvider, - view_state: &dyn SpaceViewState, + view_state: &dyn ViewState, ) { let property = ViewProperty::from_archetype::( ctx.blueprint_db(), @@ -475,7 +471,7 @@ fn view_property_ui_grid3d( // TODO(#1611): The color picker for the color component doesn't show alpha values so far since alpha is almost never supported. // Here however, we need that alpha color picker! if field.component_name == re_types::components::Color::name() { - re_space_view::view_property_component_ui_custom( + re_view::view_property_component_ui_custom( &query_ctx, ui, &property, @@ -507,7 +503,7 @@ fn view_property_ui_grid3d( None, // No multiline editor. ); } else { - re_space_view::view_property_component_ui( + re_view::view_property_component_ui( &query_ctx, ui, &property, diff --git a/crates/viewer/re_space_view_spatial/src/view_3d_properties.rs b/crates/viewer/re_view_spatial/src/view_3d_properties.rs similarity index 70% rename from crates/viewer/re_space_view_spatial/src/view_3d_properties.rs rename to crates/viewer/re_view_spatial/src/view_3d_properties.rs index 3c9ddac728b9..1e1d60a83e10 100644 --- a/crates/viewer/re_space_view_spatial/src/view_3d_properties.rs +++ b/crates/viewer/re_view_spatial/src/view_3d_properties.rs @@ -6,11 +6,11 @@ use re_types::{ components::{Color, Plane3D, StrokeWidth}, Archetype as _, }; -use re_viewer_context::{SpaceViewStateExt as _, TypedComponentFallbackProvider}; +use re_viewer_context::{TypedComponentFallbackProvider, ViewStateExt as _}; -use crate::{ui::SpatialSpaceViewState, SpatialSpaceView3D}; +use crate::{ui::SpatialViewState, SpatialView3D}; -impl TypedComponentFallbackProvider for SpatialSpaceView3D { +impl TypedComponentFallbackProvider for SpatialView3D { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> Color { // Color is a fairly common component, make sure this is the right context. if ctx.archetype_name == Some(Background::name()) { @@ -23,23 +23,23 @@ impl TypedComponentFallbackProvider for SpatialSpaceView3D { } } -impl TypedComponentFallbackProvider for SpatialSpaceView3D { +impl TypedComponentFallbackProvider for SpatialView3D { fn fallback_for(&self, _ctx: &re_viewer_context::QueryContext<'_>) -> BackgroundKind { BackgroundKind::GradientDark } } -impl TypedComponentFallbackProvider for SpatialSpaceView3D { +impl TypedComponentFallbackProvider for SpatialView3D { fn fallback_for(&self, _ctx: &re_viewer_context::QueryContext<'_>) -> StrokeWidth { 1.0.into() } } -impl TypedComponentFallbackProvider for SpatialSpaceView3D { +impl TypedComponentFallbackProvider for SpatialView3D { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> Plane3D { const DEFAULT_PLANE: Plane3D = Plane3D::XY; - let Ok(view_state) = ctx.view_state.downcast_ref::() else { + let Ok(view_state) = ctx.view_state.downcast_ref::() else { return DEFAULT_PLANE; }; @@ -51,4 +51,4 @@ impl TypedComponentFallbackProvider for SpatialSpaceView3D { } } -re_viewer_context::impl_component_fallback_provider!(SpatialSpaceView3D => [BackgroundKind, Color, StrokeWidth, Plane3D]); +re_viewer_context::impl_component_fallback_provider!(SpatialView3D => [BackgroundKind, Color, StrokeWidth, Plane3D]); diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/arrows2d.rs b/crates/viewer/re_view_spatial/src/visualizers/arrows2d.rs similarity index 93% rename from crates/viewer/re_space_view_spatial/src/visualizers/arrows2d.rs rename to crates/viewer/re_view_spatial/src/visualizers/arrows2d.rs index 55f7f6d84879..e8a01ee5a988 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/arrows2d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/arrows2d.rs @@ -1,6 +1,5 @@ use re_log_types::Instance; use re_renderer::{renderer::LineStripFlags, LineDrawableBuilder, PickingLayerInstanceId}; -use re_space_view::{process_annotation_and_keypoint_slices, process_color_slice}; use re_types::{ archetypes::Arrows2D, components::{ @@ -8,15 +7,16 @@ use re_types::{ }, ArrowString, Component as _, }; +use re_view::{process_annotation_and_keypoint_slices, process_color_slice}; use re_viewer_context::{ auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; use crate::{ - contexts::SpatialSceneEntityContext, view_kind::SpatialSpaceViewKind, + contexts::SpatialSceneEntityContext, view_kind::SpatialViewKind, visualizers::filter_visualizable_2d_entities, }; @@ -36,7 +36,7 @@ pub struct Arrows2DVisualizer { impl Default for Arrows2DVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::TwoD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::TwoD)), } } } @@ -190,14 +190,14 @@ impl VisualizerSystem for Arrows2DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut line_builder = LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); use super::entity_iterator::{iter_primitive_array, process_archetype}; @@ -206,7 +206,7 @@ impl VisualizerSystem for Arrows2DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_vector_chunks) = results.get_required_chunks(&Vector2D::name()) else { return Ok(()); diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/arrows3d.rs b/crates/viewer/re_view_spatial/src/visualizers/arrows3d.rs similarity index 93% rename from crates/viewer/re_space_view_spatial/src/visualizers/arrows3d.rs rename to crates/viewer/re_view_spatial/src/visualizers/arrows3d.rs index a0d45641d2e2..5249863867f3 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/arrows3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/arrows3d.rs @@ -1,20 +1,20 @@ use re_log_types::Instance; use re_renderer::{renderer::LineStripFlags, LineDrawableBuilder, PickingLayerInstanceId}; -use re_space_view::{process_annotation_slices, process_color_slice}; use re_types::{ archetypes::Arrows3D, components::{ClassId, Color, Position3D, Radius, ShowLabels, Text, Vector3D}, ArrowString, Component as _, }; +use re_view::{process_annotation_slices, process_color_slice}; use re_viewer_context::{ auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; use crate::{ - contexts::SpatialSceneEntityContext, view_kind::SpatialSpaceViewKind, + contexts::SpatialSceneEntityContext, view_kind::SpatialViewKind, visualizers::filter_visualizable_3d_entities, }; @@ -32,7 +32,7 @@ pub struct Arrows3DVisualizer { impl Default for Arrows3DVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::ThreeD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::ThreeD)), } } } @@ -189,14 +189,14 @@ impl VisualizerSystem for Arrows3DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut line_builder = LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); use super::entity_iterator::{iter_primitive_array, process_archetype}; @@ -205,7 +205,7 @@ impl VisualizerSystem for Arrows3DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_vector_chunks) = results.get_required_chunks(&Vector3D::name()) else { return Ok(()); diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/assets3d.rs b/crates/viewer/re_view_spatial/src/visualizers/assets3d.rs similarity index 90% rename from crates/viewer/re_space_view_spatial/src/visualizers/assets3d.rs rename to crates/viewer/re_view_spatial/src/visualizers/assets3d.rs index 65ab3a5c0fbe..ab884dade8fc 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/assets3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/assets3d.rs @@ -8,8 +8,8 @@ use re_types::{ ArrowBuffer, ArrowString, Component as _, }; use re_viewer_context::{ - ApplicableEntities, IdentifiedViewSystem, QueryContext, SpaceViewSystemExecutionError, - ViewContext, ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, + ApplicableEntities, IdentifiedViewSystem, QueryContext, ViewContext, ViewContextCollection, + ViewQuery, ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, VisualizerSystem, }; @@ -18,7 +18,7 @@ use super::{filter_visualizable_3d_entities, SpatialViewVisualizerData}; use crate::{ contexts::SpatialSceneEntityContext, mesh_cache::{AnyMesh, MeshCache, MeshCacheKey}, - view_kind::SpatialSpaceViewKind, + view_kind::SpatialViewKind, }; pub struct Asset3DVisualizer(SpatialViewVisualizerData); @@ -26,7 +26,7 @@ pub struct Asset3DVisualizer(SpatialViewVisualizerData); impl Default for Asset3DVisualizer { fn default() -> Self { Self(SpatialViewVisualizerData::new(Some( - SpatialSpaceViewKind::ThreeD, + SpatialViewKind::ThreeD, ))) } } @@ -95,10 +95,9 @@ impl Asset3DVisualizer { gpu_mesh: mesh_instance.gpu_mesh.clone(), world_from_mesh, outline_mask_ids, - picking_layer_id: - re_space_view::picking_layer_id_from_instance_path_hash( - picking_instance_hash, - ), + picking_layer_id: re_view::picking_layer_id_from_instance_path_hash( + picking_instance_hash, + ), additive_tint: re_renderer::Color32::TRANSPARENT, } })); @@ -136,9 +135,9 @@ impl VisualizerSystem for Asset3DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut instances = Vec::new(); @@ -149,7 +148,7 @@ impl VisualizerSystem for Asset3DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_blob_chunks) = results.get_required_chunks(&Blob::name()) else { return Ok(()); diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/boxes2d.rs b/crates/viewer/re_view_spatial/src/visualizers/boxes2d.rs similarity index 94% rename from crates/viewer/re_space_view_spatial/src/visualizers/boxes2d.rs rename to crates/viewer/re_view_spatial/src/visualizers/boxes2d.rs index 4f83cab3b8ca..5f05e0f649c1 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/boxes2d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/boxes2d.rs @@ -1,21 +1,21 @@ use re_log_types::Instance; use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId}; -use re_space_view::{process_annotation_slices, process_color_slice}; use re_types::{ archetypes::Boxes2D, components::{ClassId, Color, DrawOrder, HalfSize2D, Position2D, Radius, ShowLabels, Text}, ArrowString, Component as _, }; +use re_view::{process_annotation_slices, process_color_slice}; use re_viewer_context::{ auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; use crate::{ contexts::SpatialSceneEntityContext, - view_kind::SpatialSpaceViewKind, + view_kind::SpatialViewKind, visualizers::{entity_iterator::clamped_or, UiLabelTarget}, }; @@ -34,7 +34,7 @@ pub struct Boxes2DVisualizer { impl Default for Boxes2DVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::TwoD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::TwoD)), } } } @@ -189,14 +189,14 @@ impl VisualizerSystem for Boxes2DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut line_builder = LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); use super::entity_iterator::{iter_primitive_array, process_archetype}; @@ -205,7 +205,7 @@ impl VisualizerSystem for Boxes2DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_half_size_chunks) = results.get_required_chunks(&HalfSize2D::name()) else { diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/boxes3d.rs b/crates/viewer/re_view_spatial/src/visualizers/boxes3d.rs similarity index 93% rename from crates/viewer/re_space_view_spatial/src/visualizers/boxes3d.rs rename to crates/viewer/re_view_spatial/src/visualizers/boxes3d.rs index 9112630bcc69..40dfe1adbf05 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/boxes3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/boxes3d.rs @@ -7,12 +7,12 @@ use re_types::{ }; use re_viewer_context::{ auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; -use crate::{contexts::SpatialSceneEntityContext, proc_mesh, view_kind::SpatialSpaceViewKind}; +use crate::{contexts::SpatialSceneEntityContext, proc_mesh, view_kind::SpatialViewKind}; use super::{ filter_visualizable_3d_entities, @@ -27,7 +27,7 @@ pub struct Boxes3DVisualizer(SpatialViewVisualizerData); impl Default for Boxes3DVisualizer { fn default() -> Self { Self(SpatialViewVisualizerData::new(Some( - SpatialSpaceViewKind::ThreeD, + SpatialViewKind::ThreeD, ))) } } @@ -40,7 +40,7 @@ impl Boxes3DVisualizer { query_context: &QueryContext<'_>, ent_context: &SpatialSceneEntityContext<'_>, batches: impl Iterator>, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { let proc_mesh_key = proc_mesh::ProcMeshKey::Cube; // `ProcMeshKey::Cube` is scaled to side length of 1, i.e. a half-size of 0.5. @@ -113,9 +113,9 @@ impl VisualizerSystem for Boxes3DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut builder = @@ -127,7 +127,7 @@ impl VisualizerSystem for Boxes3DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_half_size_chunks) = results.get_required_chunks(&HalfSize3D::name()) else { diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/cameras.rs b/crates/viewer/re_view_spatial/src/visualizers/cameras.rs similarity index 92% rename from crates/viewer/re_space_view_spatial/src/visualizers/cameras.rs rename to crates/viewer/re_view_spatial/src/visualizers/cameras.rs index d42a29483489..0508caeb221f 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/cameras.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/cameras.rs @@ -6,16 +6,15 @@ use re_types::{ components::{ImagePlaneDistance, ViewCoordinates}, }; use re_viewer_context::{ - ApplicableEntities, DataResult, IdentifiedViewSystem, QueryContext, SpaceViewOutlineMasks, - SpaceViewStateExt as _, SpaceViewSystemExecutionError, TypedComponentFallbackProvider, - ViewContext, ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + ApplicableEntities, DataResult, IdentifiedViewSystem, QueryContext, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewOutlineMasks, + ViewQuery, ViewStateExt as _, ViewSystemExecutionError, VisualizableEntities, + VisualizableFilterContext, VisualizerQueryInfo, VisualizerSystem, }; use super::{filter_visualizable_3d_entities, SpatialViewVisualizerData}; use crate::{ - contexts::TransformContext, query_pinhole, space_camera_3d::SpaceCamera3D, - ui::SpatialSpaceViewState, + contexts::TransformContext, query_pinhole, space_camera_3d::SpaceCamera3D, ui::SpatialViewState, }; const CAMERA_COLOR: re_renderer::Color32 = re_renderer::Color32::from_rgb(150, 150, 150); @@ -51,7 +50,7 @@ impl CamerasVisualizer { data_result: &DataResult, pinhole: &Pinhole, pinhole_view_coordinates: ViewCoordinates, - entity_highlight: &SpaceViewOutlineMasks, + entity_highlight: &ViewOutlineMasks, ) { let instance = Instance::from(0); let ent_path = &data_result.entity_path; @@ -161,7 +160,7 @@ impl CamerasVisualizer { let instance_path_for_picking = re_entity_db::InstancePathHash::instance(ent_path, instance); let instance_layer_id = - re_space_view::picking_layer_id_from_instance_path_hash(instance_path_for_picking); + re_view::picking_layer_id_from_instance_path_hash(instance_path_for_picking); let mut batch = line_builder .batch(ent_path.to_string()) @@ -214,9 +213,9 @@ impl VisualizerSystem for CamerasVisualizer { ctx: &ViewContext<'_>, query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let transforms = context_systems.get::()?; @@ -225,7 +224,7 @@ impl VisualizerSystem for CamerasVisualizer { // so let re_renderer's allocator internally decide what buffer sizes to pick & grow them as we go. let mut line_builder = re_renderer::LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); for data_result in query.iter_visible_data_results(ctx, Self::identifier()) { @@ -265,7 +264,7 @@ impl VisualizerSystem for CamerasVisualizer { impl TypedComponentFallbackProvider for CamerasVisualizer { fn fallback_for(&self, ctx: &QueryContext<'_>) -> ImagePlaneDistance { - let Ok(state) = ctx.view_state.downcast_ref::() else { + let Ok(state) = ctx.view_state.downcast_ref::() else { return Default::default(); }; diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/capsules3d.rs b/crates/viewer/re_view_spatial/src/visualizers/capsules3d.rs similarity index 93% rename from crates/viewer/re_space_view_spatial/src/visualizers/capsules3d.rs rename to crates/viewer/re_view_spatial/src/visualizers/capsules3d.rs index 464197f6194e..a397cb80f8af 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/capsules3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/capsules3d.rs @@ -1,20 +1,20 @@ use std::iter; use ordered_float::NotNan; -use re_space_view::clamped_or_nothing; use re_types::{ archetypes::Capsules3D, components::{self, ClassId, Color, FillMode, HalfSize3D, Length, Radius, ShowLabels, Text}, ArrowString, Component as _, }; +use re_view::clamped_or_nothing; use re_viewer_context::{ auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; -use crate::{contexts::SpatialSceneEntityContext, proc_mesh, view_kind::SpatialSpaceViewKind}; +use crate::{contexts::SpatialSceneEntityContext, proc_mesh, view_kind::SpatialViewKind}; use super::{ filter_visualizable_3d_entities, @@ -29,7 +29,7 @@ pub struct Capsules3DVisualizer(SpatialViewVisualizerData); impl Default for Capsules3DVisualizer { fn default() -> Self { Self(SpatialViewVisualizerData::new(Some( - SpatialSpaceViewKind::ThreeD, + SpatialViewKind::ThreeD, ))) } } @@ -42,7 +42,7 @@ impl Capsules3DVisualizer { query_context: &QueryContext<'_>, ent_context: &SpatialSceneEntityContext<'_>, batches: impl Iterator>, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { for batch in batches { // Number of instances is determined by whichever is *longer* of `lengths` and `radii`. // The other component is clamped (last value repeated) to match. @@ -135,9 +135,9 @@ impl VisualizerSystem for Capsules3DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut builder = ProcMeshDrawableBuilder::new( @@ -154,7 +154,7 @@ impl VisualizerSystem for Capsules3DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_length_chunks) = results.get_required_chunks(&Length::name()) else { return Ok(()); diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/depth_images.rs b/crates/viewer/re_view_spatial/src/visualizers/depth_images.rs similarity index 95% rename from crates/viewer/re_space_view_spatial/src/visualizers/depth_images.rs rename to crates/viewer/re_view_spatial/src/visualizers/depth_images.rs index 2a1c5afbd80c..6d5fbbf68dee 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/depth_images.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/depth_images.rs @@ -14,17 +14,17 @@ use re_types::{ }; use re_viewer_context::{ ApplicableEntities, ColormapWithRange, IdentifiedViewSystem, ImageInfo, ImageStatsCache, - QueryContext, SpaceViewClass, SpaceViewSystemExecutionError, TypedComponentFallbackProvider, - ViewContext, ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, + QueryContext, TypedComponentFallbackProvider, ViewClass, ViewContext, ViewContextCollection, + ViewQuery, ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, VisualizerSystem, }; use crate::{ contexts::{SpatialSceneEntityContext, TwoDInThreeDTransformInfo}, query_pinhole_legacy, - view_kind::SpatialSpaceViewKind, + view_kind::SpatialViewKind, visualizers::filter_visualizable_2d_entities, - PickableRectSourceData, PickableTexturedRect, SpatialSpaceView3D, + PickableRectSourceData, PickableTexturedRect, SpatialView3D, }; use super::{textured_rect_from_image, SpatialViewVisualizerData}; @@ -39,7 +39,7 @@ pub struct DepthImageVisualizer { impl Default for DepthImageVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::TwoD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::TwoD)), depth_cloud_entities: IntMap::default(), } } @@ -61,8 +61,7 @@ impl DepthImageVisualizer { ent_context: &SpatialSceneEntityContext<'_>, images: impl Iterator, ) { - let is_3d_view = - ent_context.space_view_class_identifier == SpatialSpaceView3D::identifier(); + let is_3d_view = ent_context.view_class_identifier == SpatialView3D::identifier(); ent_context .transform_info .warn_on_per_instance_transform(ctx.target_entity_path, "DepthImage"); @@ -253,9 +252,9 @@ impl VisualizerSystem for DepthImageVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut depth_clouds = Vec::new(); @@ -266,7 +265,7 @@ impl VisualizerSystem for DepthImageVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_buffer_chunks) = results.get_required_chunks(&ImageBuffer::name()) else { @@ -330,7 +329,7 @@ impl VisualizerSystem for DepthImageVisualizer { &DepthClouds { clouds: depth_clouds, radius_boost_in_ui_points_for_outlines: - re_space_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, }, ) { Ok(draw_data) => { diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/ellipsoids.rs b/crates/viewer/re_view_spatial/src/visualizers/ellipsoids.rs similarity index 94% rename from crates/viewer/re_space_view_spatial/src/visualizers/ellipsoids.rs rename to crates/viewer/re_view_spatial/src/visualizers/ellipsoids.rs index 84ac9b7e3130..db2add13a89c 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/ellipsoids.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/ellipsoids.rs @@ -7,12 +7,12 @@ use re_types::{ }; use re_viewer_context::{ auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; -use crate::{contexts::SpatialSceneEntityContext, proc_mesh, view_kind::SpatialSpaceViewKind}; +use crate::{contexts::SpatialSceneEntityContext, proc_mesh, view_kind::SpatialViewKind}; use super::{ filter_visualizable_3d_entities, @@ -27,7 +27,7 @@ pub struct Ellipsoids3DVisualizer(SpatialViewVisualizerData); impl Default for Ellipsoids3DVisualizer { fn default() -> Self { Self(SpatialViewVisualizerData::new(Some( - SpatialSpaceViewKind::ThreeD, + SpatialViewKind::ThreeD, ))) } } @@ -40,7 +40,7 @@ impl Ellipsoids3DVisualizer { query_context: &QueryContext<'_>, ent_context: &SpatialSceneEntityContext<'_>, batches: impl Iterator>, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { for batch in batches { // TODO(kpreid): subdivisions should be configurable, and possibly dynamic based on // either world size or screen size (depending on application). @@ -120,9 +120,9 @@ impl VisualizerSystem for Ellipsoids3DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut builder = ProcMeshDrawableBuilder::new( @@ -139,7 +139,7 @@ impl VisualizerSystem for Ellipsoids3DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_half_size_chunks) = results.get_required_chunks(&HalfSize3D::name()) else { diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/encoded_image.rs b/crates/viewer/re_view_spatial/src/visualizers/encoded_image.rs similarity index 92% rename from crates/viewer/re_space_view_spatial/src/visualizers/encoded_image.rs rename to crates/viewer/re_view_spatial/src/visualizers/encoded_image.rs index c7f5bbb92d4b..7e8f24a4fcd5 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/encoded_image.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/encoded_image.rs @@ -1,19 +1,19 @@ -use re_space_view::{diff_component_filter, HybridResults}; use re_types::{ archetypes::EncodedImage, components::{Blob, DrawOrder, MediaType, Opacity}, Component as _, }; +use re_view::{diff_component_filter, HybridResults}; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ImageDecodeCache, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerAdditionalApplicabilityFilter, VisualizerQueryInfo, VisualizerSystem, }; use crate::{ contexts::SpatialSceneEntityContext, - view_kind::SpatialSpaceViewKind, + view_kind::SpatialViewKind, visualizers::{filter_visualizable_2d_entities, textured_rect_from_image}, PickableRectSourceData, PickableTexturedRect, }; @@ -27,7 +27,7 @@ pub struct EncodedImageVisualizer { impl Default for EncodedImageVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::TwoD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::TwoD)), } } } @@ -78,9 +78,9 @@ impl VisualizerSystem for EncodedImageVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; process_archetype::( @@ -134,7 +134,7 @@ impl EncodedImageVisualizer { spatial_ctx: &SpatialSceneEntityContext<'_>, ) { use super::entity_iterator::iter_buffer; - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let entity_path = ctx.target_entity_path; diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/images.rs b/crates/viewer/re_view_spatial/src/visualizers/images.rs similarity index 91% rename from crates/viewer/re_space_view_spatial/src/visualizers/images.rs rename to crates/viewer/re_view_spatial/src/visualizers/images.rs index 59ff2684dec6..00fdecf89b37 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/images.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/images.rs @@ -1,20 +1,20 @@ -use re_space_view::HybridResults; use re_types::{ archetypes::Image, components::{DrawOrder, ImageBuffer, ImageFormat, Opacity}, image::ImageKind, Component as _, }; +use re_view::HybridResults; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ImageInfo, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; use crate::{ contexts::SpatialSceneEntityContext, - view_kind::SpatialSpaceViewKind, + view_kind::SpatialViewKind, visualizers::{filter_visualizable_2d_entities, textured_rect_from_image}, PickableRectSourceData, PickableTexturedRect, }; @@ -28,7 +28,7 @@ pub struct ImageVisualizer { impl Default for ImageVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::TwoD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::TwoD)), } } } @@ -63,9 +63,9 @@ impl VisualizerSystem for ImageVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; process_archetype::( @@ -119,7 +119,7 @@ impl ImageVisualizer { spatial_ctx: &SpatialSceneEntityContext<'_>, ) { use super::entity_iterator::{iter_buffer, iter_component}; - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let entity_path = ctx.target_entity_path; diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/lines2d.rs b/crates/viewer/re_view_spatial/src/visualizers/lines2d.rs similarity index 93% rename from crates/viewer/re_space_view_spatial/src/visualizers/lines2d.rs rename to crates/viewer/re_view_spatial/src/visualizers/lines2d.rs index 6eddf5f91148..c922ec9ecc22 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/lines2d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/lines2d.rs @@ -1,19 +1,19 @@ use re_log_types::Instance; use re_renderer::{renderer::LineStripFlags, LineDrawableBuilder, PickingLayerInstanceId}; -use re_space_view::{process_annotation_slices, process_color_slice}; use re_types::{ archetypes::LineStrips2D, components::{ClassId, Color, DrawOrder, LineStrip2D, Radius, ShowLabels, Text}, ArrowString, Component as _, }; +use re_view::{process_annotation_slices, process_color_slice}; use re_viewer_context::{ auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; -use crate::{contexts::SpatialSceneEntityContext, view_kind::SpatialSpaceViewKind}; +use crate::{contexts::SpatialSceneEntityContext, view_kind::SpatialViewKind}; use super::{ filter_visualizable_2d_entities, process_radius_slice, @@ -30,7 +30,7 @@ pub struct Lines2DVisualizer { impl Default for Lines2DVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::TwoD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::TwoD)), } } } @@ -172,14 +172,14 @@ impl VisualizerSystem for Lines2DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut line_builder = re_renderer::LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); use super::entity_iterator::{iter_primitive_array_list, process_archetype}; @@ -188,7 +188,7 @@ impl VisualizerSystem for Lines2DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_strip_chunks) = results.get_required_chunks(&LineStrip2D::name()) else { diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/lines3d.rs b/crates/viewer/re_view_spatial/src/visualizers/lines3d.rs similarity index 93% rename from crates/viewer/re_space_view_spatial/src/visualizers/lines3d.rs rename to crates/viewer/re_view_spatial/src/visualizers/lines3d.rs index b1e5937bc000..d8dc908f8458 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/lines3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/lines3d.rs @@ -1,21 +1,21 @@ use re_log_types::Instance; use re_renderer::{renderer::LineStripFlags, PickingLayerInstanceId}; -use re_space_view::{process_annotation_slices, process_color_slice}; use re_types::{ archetypes::LineStrips3D, components::{ClassId, Color, LineStrip3D, Radius, ShowLabels, Text}, ArrowString, Component as _, }; +use re_view::{process_annotation_slices, process_color_slice}; use re_viewer_context::{ auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; use crate::{ contexts::SpatialSceneEntityContext, - view_kind::SpatialSpaceViewKind, + view_kind::SpatialViewKind, visualizers::utilities::{process_labels_3d, LabeledBatch}, }; @@ -30,7 +30,7 @@ pub struct Lines3DVisualizer { impl Default for Lines3DVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::ThreeD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::ThreeD)), } } } @@ -177,14 +177,14 @@ impl VisualizerSystem for Lines3DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut line_builder = re_renderer::LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); use super::entity_iterator::{iter_primitive_array_list, process_archetype}; @@ -193,7 +193,7 @@ impl VisualizerSystem for Lines3DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_strip_chunks) = results.get_required_chunks(&LineStrip3D::name()) else { diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/meshes.rs b/crates/viewer/re_view_spatial/src/visualizers/meshes.rs similarity index 93% rename from crates/viewer/re_space_view_spatial/src/visualizers/meshes.rs rename to crates/viewer/re_view_spatial/src/visualizers/meshes.rs index bd50b44e148f..09a73e05bea5 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/meshes.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/meshes.rs @@ -10,8 +10,8 @@ use re_types::{ Component as _, }; use re_viewer_context::{ - ApplicableEntities, IdentifiedViewSystem, QueryContext, SpaceViewSystemExecutionError, - ViewContext, ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, + ApplicableEntities, IdentifiedViewSystem, QueryContext, ViewContext, ViewContextCollection, + ViewQuery, ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, VisualizerSystem, }; @@ -23,7 +23,7 @@ use super::{ use crate::{ contexts::SpatialSceneEntityContext, mesh_cache::{AnyMesh, MeshCache, MeshCacheKey}, - view_kind::SpatialSpaceViewKind, + view_kind::SpatialViewKind, }; // --- @@ -33,7 +33,7 @@ pub struct Mesh3DVisualizer(SpatialViewVisualizerData); impl Default for Mesh3DVisualizer { fn default() -> Self { Self(SpatialViewVisualizerData::new(Some( - SpatialSpaceViewKind::ThreeD, + SpatialViewKind::ThreeD, ))) } } @@ -129,10 +129,9 @@ impl Mesh3DVisualizer { gpu_mesh: mesh_instance.gpu_mesh.clone(), world_from_mesh, outline_mask_ids, - picking_layer_id: - re_space_view::picking_layer_id_from_instance_path_hash( - picking_instance_hash, - ), + picking_layer_id: re_view::picking_layer_id_from_instance_path_hash( + picking_instance_hash, + ), additive_tint: re_renderer::Color32::TRANSPARENT, } })); @@ -170,9 +169,9 @@ impl VisualizerSystem for Mesh3DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut instances = Vec::new(); @@ -183,7 +182,7 @@ impl VisualizerSystem for Mesh3DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_vertex_position_chunks) = results.get_required_chunks(&Position3D::name()) diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/mod.rs b/crates/viewer/re_view_spatial/src/visualizers/mod.rs similarity index 95% rename from crates/viewer/re_space_view_spatial/src/visualizers/mod.rs rename to crates/viewer/re_view_spatial/src/visualizers/mod.rs index f7e0f69be848..b1b5ea34d38f 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/mod.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/mod.rs @@ -50,12 +50,12 @@ use ahash::HashMap; use re_entity_db::EntityPath; use re_types::datatypes::{KeypointId, KeypointPair}; use re_viewer_context::{ - auto_color_egui, ApplicableEntities, IdentifiedViewSystem, SpaceViewClassRegistryError, - SpaceViewSystemExecutionError, SpaceViewSystemRegistrator, ViewSystemIdentifier, - VisualizableEntities, VisualizableFilterContext, VisualizerCollection, + auto_color_egui, ApplicableEntities, IdentifiedViewSystem, ViewClassRegistryError, + ViewSystemExecutionError, ViewSystemIdentifier, ViewSystemRegistrator, VisualizableEntities, + VisualizableFilterContext, VisualizerCollection, }; -use re_space_view::clamped_or_nothing; +use re_view::clamped_or_nothing; use crate::view_2d::VisualizableFilterContext2D; use crate::view_3d::VisualizableFilterContext3D; @@ -66,8 +66,8 @@ use super::contexts::SpatialSceneEntityContext; pub type Keypoints = HashMap<(re_types::components::ClassId, i64), HashMap>; pub fn register_2d_spatial_visualizers( - system_registry: &mut SpaceViewSystemRegistrator<'_>, -) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut ViewSystemRegistrator<'_>, +) -> Result<(), ViewClassRegistryError> { // Note: 2D spatial systems don't include cameras as this // visualizer only shows a 2D projection WITHIN a 3D view. system_registry.register_visualizer::()?; @@ -91,8 +91,8 @@ pub fn register_2d_spatial_visualizers( } pub fn register_3d_spatial_visualizers( - system_registry: &mut SpaceViewSystemRegistrator<'_>, -) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut ViewSystemRegistrator<'_>, +) -> Result<(), ViewClassRegistryError> { system_registry.register_visualizer::()?; system_registry.register_visualizer::()?; system_registry.register_visualizer::()?; @@ -188,7 +188,7 @@ pub fn load_keypoint_connections( ent_context: &SpatialSceneEntityContext<'_>, ent_path: &re_entity_db::EntityPath, keypoints: &Keypoints, -) -> Result<(), SpaceViewSystemExecutionError> { +) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); // TODO(andreas): We should be able to compute this already when we load the keypoints diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/points2d.rs b/crates/viewer/re_view_spatial/src/visualizers/points2d.rs similarity index 93% rename from crates/viewer/re_space_view_spatial/src/visualizers/points2d.rs rename to crates/viewer/re_view_spatial/src/visualizers/points2d.rs index dca18dbad614..55bb5eb9908c 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/points2d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/points2d.rs @@ -1,22 +1,22 @@ use itertools::Itertools as _; use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId, PointCloudBuilder}; -use re_space_view::{process_annotation_and_keypoint_slices, process_color_slice}; use re_types::{ archetypes::Points2D, components::{ClassId, Color, DrawOrder, KeypointId, Position2D, Radius, ShowLabels, Text}, ArrowString, Component as _, }; +use re_view::{process_annotation_and_keypoint_slices, process_color_slice}; use re_viewer_context::{ auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; use crate::{ contexts::SpatialSceneEntityContext, - view_kind::SpatialSpaceViewKind, + view_kind::SpatialViewKind, visualizers::{load_keypoint_connections, process_radius_slice}, }; @@ -35,7 +35,7 @@ pub struct Points2DVisualizer { impl Default for Points2DVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::TwoD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::TwoD)), } } } @@ -51,7 +51,7 @@ impl Points2DVisualizer { query: &ViewQuery<'_>, ent_context: &SpatialSceneEntityContext<'_>, data: impl Iterator>, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { let entity_path = ctx.target_entity_path; for data in data { @@ -189,21 +189,21 @@ impl VisualizerSystem for Points2DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut point_builder = PointCloudBuilder::new(render_ctx); point_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, ); // We need lines from keypoints. The number of lines we'll have is harder to predict, so we'll // go with the dynamic allocation approach. let mut line_builder = LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, ); use super::entity_iterator::{iter_primitive_array, process_archetype}; @@ -212,7 +212,7 @@ impl VisualizerSystem for Points2DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_position_chunks) = results.get_required_chunks(&Position2D::name()) else { diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/points3d.rs b/crates/viewer/re_view_spatial/src/visualizers/points3d.rs similarity index 93% rename from crates/viewer/re_space_view_spatial/src/visualizers/points3d.rs rename to crates/viewer/re_view_spatial/src/visualizers/points3d.rs index 81ad611380b8..4860a6f6128c 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/points3d.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/points3d.rs @@ -1,22 +1,22 @@ use itertools::Itertools; use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId, PointCloudBuilder}; -use re_space_view::{process_annotation_and_keypoint_slices, process_color_slice}; use re_types::{ archetypes::Points3D, components::{ClassId, Color, KeypointId, Position3D, Radius, ShowLabels, Text}, ArrowString, Component, }; +use re_view::{process_annotation_and_keypoint_slices, process_color_slice}; use re_viewer_context::{ auto_color_for_entity_path, ApplicableEntities, IdentifiedViewSystem, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; use crate::{ contexts::SpatialSceneEntityContext, - view_kind::SpatialSpaceViewKind, + view_kind::SpatialViewKind, visualizers::{load_keypoint_connections, process_radius_slice}, }; @@ -34,7 +34,7 @@ pub struct Points3DVisualizer { impl Default for Points3DVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::ThreeD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::ThreeD)), } } } @@ -65,7 +65,7 @@ impl Points3DVisualizer { query: &ViewQuery<'_>, ent_context: &SpatialSceneEntityContext<'_>, data: impl Iterator>, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { let entity_path = ctx.target_entity_path; for data in data { @@ -179,21 +179,21 @@ impl VisualizerSystem for Points3DVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let mut point_builder = PointCloudBuilder::new(render_ctx); point_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, ); // We need lines from keypoints. The number of lines we'll have is harder to predict, so we'll go // with the dynamic allocation approach. let mut line_builder = LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES, ); use super::entity_iterator::{iter_primitive_array, process_archetype}; @@ -202,7 +202,7 @@ impl VisualizerSystem for Points3DVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let Some(all_position_chunks) = results.get_required_chunks(&Position3D::name()) else { diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/segmentation_images.rs b/crates/viewer/re_view_spatial/src/visualizers/segmentation_images.rs similarity index 91% rename from crates/viewer/re_space_view_spatial/src/visualizers/segmentation_images.rs rename to crates/viewer/re_view_spatial/src/visualizers/segmentation_images.rs index 484467dc1c09..87cf23354ec3 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/segmentation_images.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/segmentation_images.rs @@ -6,14 +6,14 @@ use re_types::{ }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ImageInfo, QueryContext, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, + VisualizerSystem, }; use crate::{ - ui::SpatialSpaceViewState, - view_kind::SpatialSpaceViewKind, + ui::SpatialViewState, + view_kind::SpatialViewKind, visualizers::{filter_visualizable_2d_entities, textured_rect_from_image}, PickableRectSourceData, PickableTexturedRect, }; @@ -27,7 +27,7 @@ pub struct SegmentationImageVisualizer { impl Default for SegmentationImageVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::TwoD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::TwoD)), } } } @@ -62,9 +62,9 @@ impl VisualizerSystem for SegmentationImageVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; use super::entity_iterator::{iter_buffer, iter_component, process_archetype}; @@ -73,7 +73,7 @@ impl VisualizerSystem for SegmentationImageVisualizer { view_query, context_systems, |ctx, spatial_ctx, results| { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let entity_path = ctx.target_entity_path; @@ -184,11 +184,7 @@ impl TypedComponentFallbackProvider for SegmentationImageVisualizer { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> Opacity { // Segmentation images should be transparent whenever they're on top of other images, // But fully opaque if there are no other images in the scene. - let Some(view_state) = ctx - .view_state - .as_any() - .downcast_ref::() - else { + let Some(view_state) = ctx.view_state.as_any().downcast_ref::() else { return 1.0.into(); }; diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/transform3d_arrows.rs b/crates/viewer/re_view_spatial/src/visualizers/transform3d_arrows.rs similarity index 92% rename from crates/viewer/re_space_view_spatial/src/visualizers/transform3d_arrows.rs rename to crates/viewer/re_view_spatial/src/visualizers/transform3d_arrows.rs index cd2f9b7b4343..25a3b86eb805 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/transform3d_arrows.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/transform3d_arrows.rs @@ -1,22 +1,19 @@ use egui::Color32; use nohash_hasher::IntSet; use re_log_types::{EntityPath, Instance}; -use re_space_view::{latest_at_with_blueprint_resolved_data, DataResultQuery}; use re_types::{ archetypes::{Pinhole, Transform3D}, components::{AxisLength, ImagePlaneDistance}, Archetype as _, Component, ComponentName, }; +use re_view::{latest_at_with_blueprint_resolved_data, DataResultQuery}; use re_viewer_context::{ - ApplicableEntities, IdentifiedViewSystem, QueryContext, SpaceViewStateExt, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, - ViewContextCollection, ViewQuery, VisualizableEntities, VisualizableFilterContext, - VisualizerQueryInfo, VisualizerSystem, + ApplicableEntities, IdentifiedViewSystem, QueryContext, TypedComponentFallbackProvider, + ViewContext, ViewContextCollection, ViewQuery, ViewStateExt, ViewSystemExecutionError, + VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, VisualizerSystem, }; -use crate::{ - contexts::TransformContext, ui::SpatialSpaceViewState, view_kind::SpatialSpaceViewKind, -}; +use crate::{contexts::TransformContext, ui::SpatialViewState, view_kind::SpatialViewKind}; use super::{filter_visualizable_3d_entities, CamerasVisualizer, SpatialViewVisualizerData}; @@ -25,7 +22,7 @@ pub struct Transform3DArrowsVisualizer(SpatialViewVisualizerData); impl Default for Transform3DArrowsVisualizer { fn default() -> Self { Self(SpatialViewVisualizerData::new(Some( - SpatialSpaceViewKind::ThreeD, + SpatialViewKind::ThreeD, ))) } } @@ -83,9 +80,9 @@ impl VisualizerSystem for Transform3DArrowsVisualizer { ctx: &ViewContext<'_>, query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; let transforms = context_systems.get::()?; @@ -96,7 +93,7 @@ impl VisualizerSystem for Transform3DArrowsVisualizer { // so let re_renderer's allocator internally decide what buffer sizes to pick & grow them as we go. let mut line_builder = re_renderer::LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); for data_result in query.iter_visible_data_results(ctx, Self::identifier()) { @@ -255,7 +252,7 @@ impl TypedComponentFallbackProvider for Transform3DArrowsVisualizer } // If there is a finite bounding box, use the scene size to determine the axis length. - if let Ok(state) = ctx.view_state.downcast_ref::() { + if let Ok(state) = ctx.view_state.downcast_ref::() { let scene_size = state.bounding_boxes.smoothed.size().length(); if scene_size.is_finite() && scene_size > 0.0 { @@ -277,7 +274,7 @@ re_viewer_context::impl_component_fallback_provider!(Transform3DArrowsVisualizer /// The `AxisLengthDetector` doesn't actually visualize anything, but it allows us to detect /// when a transform has set the [`AxisLength`] component. /// -/// See the logic in [`crate::SpatialSpaceView3D`]`::choose_default_visualizers`. +/// See the logic in [`crate::SpatialView3D`]`::choose_default_visualizers`. #[derive(Default)] pub struct AxisLengthDetector(); @@ -302,7 +299,7 @@ impl VisualizerSystem for AxisLengthDetector { _ctx: &ViewContext<'_>, _query: &ViewQuery<'_>, _context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { Ok(vec![]) } diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/utilities/entity_iterator.rs b/crates/viewer/re_view_spatial/src/visualizers/utilities/entity_iterator.rs similarity index 95% rename from crates/viewer/re_space_view_spatial/src/visualizers/utilities/entity_iterator.rs rename to crates/viewer/re_view_spatial/src/visualizers/utilities/entity_iterator.rs index 0e5351386774..f851f4dc0809 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/utilities/entity_iterator.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/utilities/entity_iterator.rs @@ -1,9 +1,9 @@ use re_log_types::{TimeInt, Timeline}; -use re_space_view::{AnnotationSceneContext, DataResultQuery as _, HybridResults}; use re_types::Archetype; +use re_view::{AnnotationSceneContext, DataResultQuery as _, HybridResults}; use re_viewer_context::{ - IdentifiedViewSystem, QueryContext, SpaceViewSystemExecutionError, ViewContext, - ViewContextCollection, ViewQuery, + IdentifiedViewSystem, QueryContext, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, }; use crate::contexts::{EntityDepthOffsets, SpatialSceneEntityContext, TransformContext}; @@ -75,14 +75,14 @@ pub fn process_archetype( query: &ViewQuery<'_>, view_ctx: &ViewContextCollection, mut fun: F, -) -> Result<(), SpaceViewSystemExecutionError> +) -> Result<(), ViewSystemExecutionError> where A: Archetype, F: FnMut( &QueryContext<'_>, &SpatialSceneEntityContext<'_>, &HybridResults<'_>, - ) -> Result<(), SpaceViewSystemExecutionError>, + ) -> Result<(), ViewSystemExecutionError>, { let transforms = view_ctx.get::()?; let depth_offsets = view_ctx.get::()?; @@ -110,7 +110,7 @@ where highlight: query .highlights .entity_outline_mask(data_result.entity_path.hash()), - space_view_class_identifier: view_ctx.space_view_class_identifier(), + view_class_identifier: view_ctx.view_class_identifier(), }; let results = data_result.query_archetype_with_history::(ctx, query); diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/utilities/labels.rs b/crates/viewer/re_view_spatial/src/visualizers/utilities/labels.rs similarity index 100% rename from crates/viewer/re_space_view_spatial/src/visualizers/utilities/labels.rs rename to crates/viewer/re_view_spatial/src/visualizers/utilities/labels.rs diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/utilities/mod.rs b/crates/viewer/re_view_spatial/src/visualizers/utilities/mod.rs similarity index 100% rename from crates/viewer/re_space_view_spatial/src/visualizers/utilities/mod.rs rename to crates/viewer/re_view_spatial/src/visualizers/utilities/mod.rs diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/utilities/proc_mesh_vis.rs b/crates/viewer/re_view_spatial/src/visualizers/utilities/proc_mesh_vis.rs similarity index 94% rename from crates/viewer/re_space_view_spatial/src/visualizers/utilities/proc_mesh_vis.rs rename to crates/viewer/re_view_spatial/src/visualizers/utilities/proc_mesh_vis.rs index 62c500151d09..f30a39821473 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/utilities/proc_mesh_vis.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/utilities/proc_mesh_vis.rs @@ -2,10 +2,10 @@ use re_entity_db::InstancePathHash; use re_log_types::Instance; use re_renderer::renderer::{GpuMeshInstance, LineStripFlags}; use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId, RenderContext}; -use re_space_view::{clamped_or_nothing, process_annotation_slices, process_color_slice}; use re_types::components::{self, FillMode}; +use re_view::{clamped_or_nothing, process_annotation_slices, process_color_slice}; use re_viewer_context::{ - QueryContext, SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewQuery, + QueryContext, TypedComponentFallbackProvider, ViewQuery, ViewSystemExecutionError, }; use crate::contexts::SpatialSceneEntityContext; @@ -73,7 +73,7 @@ where ) -> Self { let mut line_builder = LineDrawableBuilder::new(render_ctx); line_builder.radius_boost_in_ui_points_for_outlines( - re_space_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, + re_view::SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES, ); ProcMeshDrawableBuilder { @@ -94,7 +94,7 @@ where ent_context: &SpatialSceneEntityContext<'_>, constant_instance_transform: glam::Affine3A, batch: ProcMeshBatch<'_, impl Iterator, impl Iterator>, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { let entity_path = query_context.target_entity_path; if batch.half_sizes.is_empty() { @@ -176,7 +176,7 @@ where let Some(wireframe_mesh) = query_context.viewer_ctx.cache.entry( |c: &mut proc_mesh::WireframeCache| c.entry(proc_mesh_key, self.render_ctx), ) else { - return Err(SpaceViewSystemExecutionError::DrawDataCreationError( + return Err(ViewSystemExecutionError::DrawDataCreationError( "Failed to allocate wireframe mesh".into(), )); }; @@ -214,7 +214,7 @@ where c.entry(proc_mesh_key, self.render_ctx) }) else { - return Err(SpaceViewSystemExecutionError::DrawDataCreationError( + return Err(ViewSystemExecutionError::DrawDataCreationError( "Failed to allocate solid mesh".into(), )); }; @@ -223,7 +223,7 @@ where gpu_mesh: solid_mesh.gpu_mesh, world_from_mesh: world_from_instance, outline_mask_ids: ent_context.highlight.index_outline_mask(instance), - picking_layer_id: re_space_view::picking_layer_id_from_instance_path_hash( + picking_layer_id: re_view::picking_layer_id_from_instance_path_hash( InstancePathHash::instance(entity_path, instance), ), additive_tint: color, @@ -261,7 +261,7 @@ where /// Final operation. Produce the [`re_renderer::QueueableDrawData`] to actually be drawn. pub fn into_draw_data( self, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Self { data: _, fallback: _, diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/utilities/spatial_view_visualizer.rs b/crates/viewer/re_view_spatial/src/visualizers/utilities/spatial_view_visualizer.rs similarity index 88% rename from crates/viewer/re_space_view_spatial/src/visualizers/utilities/spatial_view_visualizer.rs rename to crates/viewer/re_view_spatial/src/visualizers/utilities/spatial_view_visualizer.rs index 849876d3fcf4..4b097a4e992e 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/utilities/spatial_view_visualizer.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/utilities/spatial_view_visualizer.rs @@ -1,7 +1,7 @@ use re_log_types::EntityPathHash; use super::UiLabel; -use crate::{view_kind::SpatialSpaceViewKind, visualizers::LoadingSpinner, PickableTexturedRect}; +use crate::{view_kind::SpatialViewKind, visualizers::LoadingSpinner, PickableTexturedRect}; /// Common data struct for all spatial scene elements. /// @@ -20,11 +20,11 @@ pub struct SpatialViewVisualizerData { pub pickable_rects: Vec, /// The view kind preferred by this visualizer (used for heuristics). - pub preferred_view_kind: Option, + pub preferred_view_kind: Option, } impl SpatialViewVisualizerData { - pub fn new(preferred_view_kind: Option) -> Self { + pub fn new(preferred_view_kind: Option) -> Self { Self { loading_spinners: Default::default(), ui_labels: Default::default(), diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/utilities/textured_rect.rs b/crates/viewer/re_view_spatial/src/visualizers/utilities/textured_rect.rs similarity index 92% rename from crates/viewer/re_space_view_spatial/src/visualizers/utilities/textured_rect.rs rename to crates/viewer/re_view_spatial/src/visualizers/utilities/textured_rect.rs index 1a09222abcf7..7c4bcb3d7619 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/utilities/textured_rect.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/utilities/textured_rect.rs @@ -3,10 +3,10 @@ use glam::Vec3; use re_log_types::EntityPath; use re_renderer::renderer; use re_viewer_context::{ - gpu_bridge, ColormapWithRange, ImageInfo, ImageStatsCache, SpaceViewClass as _, ViewerContext, + gpu_bridge, ColormapWithRange, ImageInfo, ImageStatsCache, ViewClass as _, ViewerContext, }; -use crate::{contexts::SpatialSceneEntityContext, SpatialSpaceView2D}; +use crate::{contexts::SpatialSceneEntityContext, SpatialView2D}; use super::SpatialViewVisualizerData; @@ -72,11 +72,11 @@ pub fn textured_rect_from_image( }, }; - // Only update the bounding box if this is a 2D space view. + // Only update the bounding box if this is a 2D view. // This is avoids a cyclic relationship where the image plane grows // the bounds which in turn influence the size of the image plane. // See: https://github.com/rerun-io/rerun/issues/3728 - if ent_context.space_view_class_identifier == SpatialSpaceView2D::identifier() { + if ent_context.view_class_identifier == SpatialView2D::identifier() { visualizer_data.add_bounding_box( ent_path.hash(), bounding_box_for_textured_rect(&textured_rect), diff --git a/crates/viewer/re_space_view_spatial/src/visualizers/videos.rs b/crates/viewer/re_view_spatial/src/visualizers/videos.rs similarity index 94% rename from crates/viewer/re_space_view_spatial/src/visualizers/videos.rs rename to crates/viewer/re_view_spatial/src/visualizers/videos.rs index 3347dd28eeb9..55e0321fae27 100644 --- a/crates/viewer/re_space_view_spatial/src/visualizers/videos.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/videos.rs @@ -15,18 +15,18 @@ use re_types::{ Archetype, Component as _, }; use re_viewer_context::{ - ApplicableEntities, IdentifiedViewSystem, SpaceViewClass as _, SpaceViewId, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, VideoCache, ViewContext, - ViewContextCollection, ViewQuery, ViewerContext, VisualizableEntities, - VisualizableFilterContext, VisualizerQueryInfo, VisualizerSystem, + ApplicableEntities, IdentifiedViewSystem, TypedComponentFallbackProvider, VideoCache, + ViewClass as _, ViewContext, ViewContextCollection, ViewId, ViewQuery, + ViewSystemExecutionError, ViewerContext, VisualizableEntities, VisualizableFilterContext, + VisualizerQueryInfo, VisualizerSystem, }; use crate::{ contexts::SpatialSceneEntityContext, - ui::SpatialSpaceViewState, - view_kind::SpatialSpaceViewKind, + ui::SpatialViewState, + view_kind::SpatialViewKind, visualizers::{entity_iterator, filter_visualizable_2d_entities, LoadingSpinner}, - PickableRectSourceData, PickableTexturedRect, SpatialSpaceView2D, + PickableRectSourceData, PickableTexturedRect, SpatialView2D, }; use super::{ @@ -41,7 +41,7 @@ pub struct VideoFrameReferenceVisualizer { impl Default for VideoFrameReferenceVisualizer { fn default() -> Self { Self { - data: SpatialViewVisualizerData::new(Some(SpatialSpaceViewKind::TwoD)), + data: SpatialViewVisualizerData::new(Some(SpatialViewKind::TwoD)), } } } @@ -71,9 +71,9 @@ impl VisualizerSystem for VideoFrameReferenceVisualizer { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let Some(render_ctx) = ctx.viewer_ctx.render_ctx else { - return Err(SpaceViewSystemExecutionError::NoRenderContextError); + return Err(ViewSystemExecutionError::NoRenderContextError); }; process_archetype::( @@ -85,7 +85,7 @@ impl VisualizerSystem for VideoFrameReferenceVisualizer { // Not only would this simplify the code here quite a bit, it would also avoid lots of overhead. // Same is true for the image visualizers in general - there seems to be no practical reason to do range queries // for visualization here. - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; let timeline = ctx.query.timeline(); let entity_path = ctx.target_entity_path; @@ -117,7 +117,7 @@ impl VisualizerSystem for VideoFrameReferenceVisualizer { video_timestamp, video_references, entity_path, - view_query.space_view_id, + view_query.view_id, ); } @@ -152,7 +152,7 @@ impl VideoFrameReferenceVisualizer { video_timestamp: &VideoTimestamp, video_references: Option>, entity_path: &EntityPath, - view_id: SpaceViewId, + view_id: ViewId, ) { re_tracing::profile_function!(); @@ -276,7 +276,7 @@ impl VideoFrameReferenceVisualizer { }, } - if spatial_ctx.space_view_class_identifier == SpatialSpaceView2D::identifier() { + if spatial_ctx.view_class_identifier == SpatialView2D::identifier() { let bounding_box = re_math::BoundingBox::from_min_size( world_from_entity.transform_point3(glam::Vec3::ZERO), video_resolution.extend(0.0), @@ -335,11 +335,7 @@ impl VideoFrameReferenceVisualizer { ); // If we're in a 2D view, make the error rect take a fixed amount of view space. // This makes it look a lot nicer for very small & very large videos. - if let Some(state) = ctx - .view_state - .as_any() - .downcast_ref::() - { + if let Some(state) = ctx.view_state.as_any().downcast_ref::() { if let Some(bounds) = state.visual_bounds_2d { // Aim for 1/8 of the larger visual bounds axis. let max_extent = bounds.x_range.abs_len().max(bounds.y_range.abs_len()) as f32; diff --git a/crates/viewer/re_space_view_tensor/Cargo.toml b/crates/viewer/re_view_tensor/Cargo.toml similarity index 84% rename from crates/viewer/re_space_view_tensor/Cargo.toml rename to crates/viewer/re_view_tensor/Cargo.toml index 3f4a5a12a64a..7616a3e253d1 100644 --- a/crates/viewer/re_space_view_tensor/Cargo.toml +++ b/crates/viewer/re_view_tensor/Cargo.toml @@ -1,10 +1,10 @@ [package] authors.workspace = true -description = "A space view dedicated to visualizing tensors with arbitrary dimensionality." +description = "A view dedicated to visualizing tensors with arbitrary dimensionality." edition.workspace = true homepage.workspace = true license.workspace = true -name = "re_space_view_tensor" +name = "re_view_tensor" publish = true readme = "README.md" repository.workspace = true @@ -24,7 +24,7 @@ re_data_ui.workspace = true re_log_types.workspace = true re_query.workspace = true re_renderer.workspace = true -re_space_view.workspace = true +re_view.workspace = true re_tracing.workspace = true re_types.workspace = true re_ui.workspace = true diff --git a/crates/viewer/re_view_tensor/README.md b/crates/viewer/re_view_tensor/README.md new file mode 100644 index 000000000000..bd8bab191ee3 --- /dev/null +++ b/crates/viewer/re_view_tensor/README.md @@ -0,0 +1,11 @@ +# re_view_tensor + +Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. + +[![Latest version](https://img.shields.io/crates/v/re_view_tensor.svg)](https://crates.io/crates/re_view_tensor?speculative-link) +[![Documentation](https://docs.rs/re_view_tensor/badge.svg)](https://docs.rs/re_view_tensor?speculative-link) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +A View dedicated to visualizing tensors with arbitrary dimensionality. + diff --git a/crates/viewer/re_space_view_tensor/src/dimension_mapping.rs b/crates/viewer/re_view_tensor/src/dimension_mapping.rs similarity index 100% rename from crates/viewer/re_space_view_tensor/src/dimension_mapping.rs rename to crates/viewer/re_view_tensor/src/dimension_mapping.rs diff --git a/crates/viewer/re_view_tensor/src/lib.rs b/crates/viewer/re_view_tensor/src/lib.rs new file mode 100644 index 000000000000..2dda9636b659 --- /dev/null +++ b/crates/viewer/re_view_tensor/src/lib.rs @@ -0,0 +1,14 @@ +//! Rerun tensor View. +//! +//! A View dedicated to visualizing tensors with arbitrary dimensionality. + +// TODO(#6330): remove unwrap() +#![allow(clippy::unwrap_used)] + +mod dimension_mapping; +mod tensor_dimension_mapper; +mod tensor_slice_to_gpu; +mod view_class; +mod visualizer_system; + +pub use view_class::TensorView; diff --git a/crates/viewer/re_space_view_tensor/src/tensor_dimension_mapper.rs b/crates/viewer/re_view_tensor/src/tensor_dimension_mapper.rs similarity index 100% rename from crates/viewer/re_space_view_tensor/src/tensor_dimension_mapper.rs rename to crates/viewer/re_view_tensor/src/tensor_dimension_mapper.rs diff --git a/crates/viewer/re_space_view_tensor/src/tensor_slice_to_gpu.rs b/crates/viewer/re_view_tensor/src/tensor_slice_to_gpu.rs similarity index 99% rename from crates/viewer/re_space_view_tensor/src/tensor_slice_to_gpu.rs rename to crates/viewer/re_view_tensor/src/tensor_slice_to_gpu.rs index 861c2d022e1e..eb6c0a453f5a 100644 --- a/crates/viewer/re_space_view_tensor/src/tensor_slice_to_gpu.rs +++ b/crates/viewer/re_view_tensor/src/tensor_slice_to_gpu.rs @@ -14,7 +14,7 @@ use re_viewer_context::{ ColormapWithRange, }; -use crate::space_view_class::selected_tensor_slice; +use crate::view_class::selected_tensor_slice; #[derive(thiserror::Error, Debug, PartialEq)] pub enum TensorUploadError { diff --git a/crates/viewer/re_space_view_tensor/src/tensor_tests.rs b/crates/viewer/re_view_tensor/src/tensor_tests.rs similarity index 100% rename from crates/viewer/re_space_view_tensor/src/tensor_tests.rs rename to crates/viewer/re_view_tensor/src/tensor_tests.rs diff --git a/crates/viewer/re_space_view_tensor/src/space_view_class.rs b/crates/viewer/re_view_tensor/src/view_class.rs similarity index 90% rename from crates/viewer/re_space_view_tensor/src/space_view_class.rs rename to crates/viewer/re_view_tensor/src/view_class.rs index 1c9feeb4779d..191c327de4fe 100644 --- a/crates/viewer/re_space_view_tensor/src/space_view_class.rs +++ b/crates/viewer/re_view_tensor/src/view_class.rs @@ -1,6 +1,6 @@ use egui::{epaint::TextShape, Align2, NumExt as _, Vec2}; use ndarray::Axis; -use re_space_view::{suggest_space_view_for_each_entity, view_property_ui}; +use re_view::{suggest_view_for_each_entity, view_property_ui}; use re_data_ui::tensor_summary_ui_grid_contents; use re_log_types::EntityPath; @@ -11,25 +11,25 @@ use re_types::{ }, components::{Colormap, GammaCorrection, MagnificationFilter, TensorDimensionIndexSelection}, datatypes::{TensorData, TensorDimension}, - SpaceViewClassIdentifier, View, + View, ViewClassIdentifier, }; use re_ui::{list_item, UiExt as _}; use re_viewer_context::{ gpu_bridge, ApplicableEntities, ColormapWithRange, IdentifiedViewSystem as _, - IndicatedEntities, PerVisualizer, SpaceViewClass, SpaceViewClassRegistryError, SpaceViewId, - SpaceViewState, SpaceViewStateExt as _, SpaceViewSystemExecutionError, TensorStatsCache, - TypedComponentFallbackProvider, ViewQuery, ViewerContext, VisualizableEntities, + IndicatedEntities, PerVisualizer, TensorStatsCache, TypedComponentFallbackProvider, ViewClass, + ViewClassRegistryError, ViewId, ViewQuery, ViewState, ViewStateExt as _, + ViewSystemExecutionError, ViewerContext, VisualizableEntities, }; use re_viewport_blueprint::ViewProperty; use crate::{ dimension_mapping::load_tensor_slice_selection_and_make_valid, tensor_dimension_mapper::dimension_mapping_ui, - visualizer_system::{TensorSystem, TensorView}, + visualizer_system::{TensorSystem, TensorVisualization}, }; #[derive(Default)] -pub struct TensorSpaceView; +pub struct TensorView; type ViewType = re_types::blueprint::views::TensorView; @@ -37,10 +37,10 @@ type ViewType = re_types::blueprint::views::TensorView; pub struct ViewTensorState { /// Last viewed tensor, copied each frame. /// Used for the selection view. - tensor: Option, + tensor: Option, } -impl SpaceViewState for ViewTensorState { +impl ViewState for ViewTensorState { fn as_any(&self) -> &dyn std::any::Any { self } @@ -50,8 +50,8 @@ impl SpaceViewState for ViewTensorState { } } -impl SpaceViewClass for TensorSpaceView { - fn identifier() -> SpaceViewClassIdentifier { +impl ViewClass for TensorView { + fn identifier() -> ViewClassIdentifier { ViewType::identifier() } @@ -60,7 +60,7 @@ impl SpaceViewClass for TensorSpaceView { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_TENSOR + &re_ui::icons::VIEW_TENSOR } fn help_markdown(&self, _egui_ctx: &egui::Context) -> String { @@ -68,26 +68,26 @@ impl SpaceViewClass for TensorSpaceView { Display an N-dimensional tensor as an arbitrary 2D slice with custom colormap. -Note: select the space view to configure which dimensions are shown." +Note: select the view to configure which dimensions are shown." .to_owned() } fn on_register( &self, - system_registry: &mut re_viewer_context::SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut re_viewer_context::ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { system_registry.register_visualizer::() } - fn preferred_tile_aspect_ratio(&self, _state: &dyn SpaceViewState) -> Option { + fn preferred_tile_aspect_ratio(&self, _state: &dyn ViewState) -> Option { None } - fn layout_priority(&self) -> re_viewer_context::SpaceViewClassLayoutPriority { - re_viewer_context::SpaceViewClassLayoutPriority::Medium + fn layout_priority(&self) -> re_viewer_context::ViewClassLayoutPriority { + re_viewer_context::ViewClassLayoutPriority::Medium } - fn new_state(&self) -> Box { + fn new_state(&self) -> Box { Box::::default() } @@ -117,15 +117,15 @@ Note: select the space view to configure which dimensions are shown." &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _space_origin: &EntityPath, - view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { + view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { let state = state.downcast_mut::()?; // TODO(andreas): Listitemify ui.selection_grid("tensor_selection_ui").show(ui, |ui| { - if let Some(TensorView { + if let Some(TensorVisualization { tensor, tensor_row_id, .. @@ -145,7 +145,7 @@ Note: select the space view to configure which dimensions are shown." }); // TODO(#6075): Listitemify - if let Some(TensorView { tensor, .. }) = &state.tensor { + if let Some(TensorVisualization { tensor, .. }) = &state.tensor { let slice_property = ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, @@ -183,23 +183,20 @@ Note: select the space view to configure which dimensions are shown." Ok(()) } - fn spawn_heuristics( - &self, - ctx: &ViewerContext<'_>, - ) -> re_viewer_context::SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> re_viewer_context::ViewSpawnHeuristics { re_tracing::profile_function!(); - // For tensors create one space view for each tensor (even though we're able to stack them in one view) - suggest_space_view_for_each_entity::(ctx, self) + // For tensors create one view for each tensor (even though we're able to stack them in one view) + suggest_view_for_each_entity::(ctx, self) } fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, query: &ViewQuery<'_>, system_output: re_viewer_context::SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); let state = state.downcast_mut::()?; state.tensor = None; @@ -220,7 +217,7 @@ Note: select the space view to configure which dimensions are shown." }); } else if let Some(tensor_view) = tensors.first() { state.tensor = Some(tensor_view.clone()); - self.view_tensor(ctx, ui, state, query.space_view_id, &tensor_view.tensor)?; + self.view_tensor(ctx, ui, state, query.view_id, &tensor_view.tensor)?; } else { ui.centered_and_justified(|ui| ui.label("(empty)")); } @@ -229,15 +226,15 @@ Note: select the space view to configure which dimensions are shown." } } -impl TensorSpaceView { +impl TensorView { fn view_tensor( &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, state: &ViewTensorState, - view_id: SpaceViewId, + view_id: ViewId, tensor: &TensorData, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); let slice_property = ViewProperty::from_archetype::( @@ -294,7 +291,7 @@ impl TensorSpaceView { ctx: &ViewerContext<'_>, ui: &mut egui::Ui, state: &ViewTensorState, - view_id: SpaceViewId, + view_id: ViewId, dimension_labels: [Option<(String, bool)>; 2], slice_selection: &TensorSliceSelection, ) -> anyhow::Result<()> { @@ -314,7 +311,7 @@ impl TensorSpaceView { ctx: &ViewerContext<'_>, ui: &mut egui::Ui, state: &ViewTensorState, - view_id: SpaceViewId, + view_id: ViewId, slice_selection: &TensorSliceSelection, ) -> anyhow::Result<(egui::Response, egui::Painter, egui::Rect)> { re_tracing::profile_function!(); @@ -322,7 +319,7 @@ impl TensorSpaceView { let Some(tensor_view) = state.tensor.as_ref() else { anyhow::bail!("No tensor data available."); }; - let TensorView { + let TensorVisualization { tensor_row_id, tensor, data_range, @@ -677,7 +674,7 @@ fn selectors_ui( } } -impl TypedComponentFallbackProvider for TensorSpaceView { +impl TypedComponentFallbackProvider for TensorView { fn fallback_for(&self, _ctx: &re_viewer_context::QueryContext<'_>) -> Colormap { // Viridis is a better fallback than Turbo for arbitrary tensors. Colormap::Viridis @@ -685,4 +682,4 @@ impl TypedComponentFallbackProvider for TensorSpaceView { } // Fallback for the various components of `TensorSliceSelection` is handled by `load_tensor_slice_selection_and_make_valid`. -re_viewer_context::impl_component_fallback_provider!(TensorSpaceView => [Colormap]); +re_viewer_context::impl_component_fallback_provider!(TensorView => [Colormap]); diff --git a/crates/viewer/re_space_view_tensor/src/visualizer_system.rs b/crates/viewer/re_view_tensor/src/visualizer_system.rs similarity index 90% rename from crates/viewer/re_space_view_tensor/src/visualizer_system.rs rename to crates/viewer/re_view_tensor/src/visualizer_system.rs index 22a52d3de8e6..ce6bd9a18858 100644 --- a/crates/viewer/re_space_view_tensor/src/visualizer_system.rs +++ b/crates/viewer/re_view_tensor/src/visualizer_system.rs @@ -1,18 +1,18 @@ use re_chunk_store::{LatestAtQuery, RowId}; -use re_space_view::{latest_at_with_blueprint_resolved_data, RangeResultsExt}; use re_types::{ archetypes::Tensor, components::{TensorData, ValueRange}, Component as _, }; +use re_view::{latest_at_with_blueprint_resolved_data, RangeResultsExt}; use re_viewer_context::{ - IdentifiedViewSystem, SpaceViewSystemExecutionError, TensorStats, TensorStatsCache, - TypedComponentFallbackProvider, ViewContext, ViewContextCollection, ViewQuery, - VisualizerQueryInfo, VisualizerSystem, + IdentifiedViewSystem, TensorStats, TensorStatsCache, TypedComponentFallbackProvider, + ViewContext, ViewContextCollection, ViewQuery, ViewSystemExecutionError, VisualizerQueryInfo, + VisualizerSystem, }; #[derive(Clone)] -pub struct TensorView { +pub struct TensorVisualization { pub tensor_row_id: RowId, pub tensor: TensorData, pub data_range: ValueRange, @@ -20,7 +20,7 @@ pub struct TensorView { #[derive(Default)] pub struct TensorSystem { - pub tensors: Vec, + pub tensors: Vec, } impl IdentifiedViewSystem for TensorSystem { @@ -39,7 +39,7 @@ impl VisualizerSystem for TensorSystem { ctx: &ViewContext<'_>, query: &ViewQuery<'_>, _context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { re_tracing::profile_function!(); for data_result in query.iter_visible_data_results(ctx, Self::identifier()) { @@ -84,7 +84,7 @@ impl VisualizerSystem for TensorSystem { tensor_data_range_heuristic(&tensor_stats, tensor.dtype()) }); - self.tensors.push(TensorView { + self.tensors.push(TensorVisualization { tensor_row_id, tensor: tensor.clone(), data_range, diff --git a/crates/viewer/re_space_view_text_document/Cargo.toml b/crates/viewer/re_view_text_document/Cargo.toml similarity index 81% rename from crates/viewer/re_space_view_text_document/Cargo.toml rename to crates/viewer/re_view_text_document/Cargo.toml index d8f0b81a94b3..b124fe746b40 100644 --- a/crates/viewer/re_space_view_text_document/Cargo.toml +++ b/crates/viewer/re_view_text_document/Cargo.toml @@ -1,10 +1,10 @@ [package] authors.workspace = true -description = "A simple space view that shows a single text box." +description = "A simple view that shows a single text box." edition.workspace = true homepage.workspace = true license.workspace = true -name = "re_space_view_text_document" +name = "re_view_text_document" publish = true readme = "README.md" repository.workspace = true @@ -24,7 +24,7 @@ default = [] [dependencies] re_chunk_store.workspace = true re_renderer.workspace = true -re_space_view.workspace = true +re_view.workspace = true re_tracing.workspace = true re_types.workspace = true re_ui.workspace = true diff --git a/crates/viewer/re_view_text_document/README.md b/crates/viewer/re_view_text_document/README.md new file mode 100644 index 000000000000..28580760e6cd --- /dev/null +++ b/crates/viewer/re_view_text_document/README.md @@ -0,0 +1,10 @@ +# re_view_text_document + +Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. + +[![Latest version](https://img.shields.io/crates/v/re_view_text_document.svg)](https://crates.io/crates/re_view_text_document?speculative-link) +[![Documentation](https://docs.rs/re_view_text_document/badge.svg)](https://docs.rs/re_view_text_document?speculative-link) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +A simple View that shows a single text box. diff --git a/crates/viewer/re_view_text_document/src/lib.rs b/crates/viewer/re_view_text_document/src/lib.rs new file mode 100644 index 000000000000..e27fca595b98 --- /dev/null +++ b/crates/viewer/re_view_text_document/src/lib.rs @@ -0,0 +1,8 @@ +//! Rerun Text Document View +//! +//! A simple Viewshows a single text document. + +mod view_class; +mod visualizer_system; + +pub use view_class::TextDocumentView; diff --git a/crates/viewer/re_space_view_text_document/src/space_view_class.rs b/crates/viewer/re_view_text_document/src/view_class.rs similarity index 74% rename from crates/viewer/re_space_view_text_document/src/space_view_class.rs rename to crates/viewer/re_view_text_document/src/view_class.rs index 10d8ed09cb5e..1715b5565ba4 100644 --- a/crates/viewer/re_space_view_text_document/src/space_view_class.rs +++ b/crates/viewer/re_view_text_document/src/view_class.rs @@ -1,27 +1,26 @@ use egui::Label; -use re_space_view::suggest_space_view_for_each_entity; -use re_types::SpaceViewClassIdentifier; use re_types::View; +use re_types::ViewClassIdentifier; use re_ui::UiExt as _; +use re_view::suggest_view_for_each_entity; use re_viewer_context::{ - external::re_log_types::EntityPath, SpaceViewClass, SpaceViewClassRegistryError, SpaceViewId, - SpaceViewState, SpaceViewStateExt as _, SpaceViewSystemExecutionError, ViewQuery, - ViewerContext, + external::re_log_types::EntityPath, ViewClass, ViewClassRegistryError, ViewId, ViewQuery, + ViewState, ViewStateExt as _, ViewSystemExecutionError, ViewerContext, }; use crate::visualizer_system::{TextDocumentEntry, TextDocumentSystem}; // TODO(andreas): This should be a blueprint component. -pub struct TextDocumentSpaceViewState { +pub struct TextDocumentViewState { monospace: bool, word_wrap: bool, commonmark_cache: egui_commonmark::CommonMarkCache, } -impl Default for TextDocumentSpaceViewState { +impl Default for TextDocumentViewState { fn default() -> Self { Self { monospace: false, @@ -31,7 +30,7 @@ impl Default for TextDocumentSpaceViewState { } } -impl SpaceViewState for TextDocumentSpaceViewState { +impl ViewState for TextDocumentViewState { fn as_any(&self) -> &dyn std::any::Any { self } @@ -42,12 +41,12 @@ impl SpaceViewState for TextDocumentSpaceViewState { } #[derive(Default)] -pub struct TextDocumentSpaceView; +pub struct TextDocumentView; type ViewType = re_types::blueprint::views::TextDocumentView; -impl SpaceViewClass for TextDocumentSpaceView { - fn identifier() -> SpaceViewClassIdentifier { +impl ViewClass for TextDocumentView { + fn identifier() -> ViewClassIdentifier { ViewType::identifier() } @@ -56,7 +55,7 @@ impl SpaceViewClass for TextDocumentSpaceView { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_TEXT + &re_ui::icons::VIEW_TEXT } fn help_markdown(&self, _egui_ctx: &egui::Context) -> String { @@ -68,28 +67,28 @@ Displays text from a text component, as raw text or markdown." fn on_register( &self, - system_registry: &mut re_viewer_context::SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut re_viewer_context::ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { system_registry.register_visualizer::() } - fn new_state(&self) -> Box { - Box::::default() + fn new_state(&self) -> Box { + Box::::default() } - fn layout_priority(&self) -> re_viewer_context::SpaceViewClassLayoutPriority { - re_viewer_context::SpaceViewClassLayoutPriority::Low + fn layout_priority(&self) -> re_viewer_context::ViewClassLayoutPriority { + re_viewer_context::ViewClassLayoutPriority::Low } fn selection_ui( &self, _ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _space_origin: &EntityPath, - _space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { - let state = state.downcast_mut::()?; + _view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { + let state = state.downcast_mut::()?; ui.selection_grid("text_config").show(ui, |ui| { ui.grid_left_hand_label("Text style"); @@ -104,25 +103,22 @@ Displays text from a text component, as raw text or markdown." Ok(()) } - fn spawn_heuristics( - &self, - ctx: &ViewerContext<'_>, - ) -> re_viewer_context::SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> re_viewer_context::ViewSpawnHeuristics { re_tracing::profile_function!(); - // By default spawn a space view for every text document. - suggest_space_view_for_each_entity::(ctx, self) + // By default spawn a view for every text document. + suggest_view_for_each_entity::(ctx, self) } fn ui( &self, _ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _query: &ViewQuery<'_>, system_output: re_viewer_context::SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { - let state = state.downcast_mut::()?; + ) -> Result<(), ViewSystemExecutionError> { + let state = state.downcast_mut::()?; let text_document = system_output.view_systems.get::()?; egui::Frame { diff --git a/crates/viewer/re_space_view_text_document/src/visualizer_system.rs b/crates/viewer/re_view_text_document/src/visualizer_system.rs similarity index 87% rename from crates/viewer/re_space_view_text_document/src/visualizer_system.rs rename to crates/viewer/re_view_text_document/src/visualizer_system.rs index be61c3a4c8af..1f23ccb13ece 100644 --- a/crates/viewer/re_space_view_text_document/src/visualizer_system.rs +++ b/crates/viewer/re_view_text_document/src/visualizer_system.rs @@ -1,12 +1,12 @@ use re_chunk_store::LatestAtQuery; -use re_space_view::DataResultQuery as _; use re_types::{ archetypes::TextDocument, components::{self}, }; +use re_view::DataResultQuery as _; use re_viewer_context::{ - IdentifiedViewSystem, SpaceViewSystemExecutionError, TypedComponentFallbackProvider, - ViewContext, ViewContextCollection, ViewQuery, VisualizerQueryInfo, VisualizerSystem, + IdentifiedViewSystem, TypedComponentFallbackProvider, ViewContext, ViewContextCollection, + ViewQuery, ViewSystemExecutionError, VisualizerQueryInfo, VisualizerSystem, }; // --- @@ -39,7 +39,7 @@ impl VisualizerSystem for TextDocumentSystem { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, _context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { let timeline_query = LatestAtQuery::new(view_query.timeline, view_query.latest_at); for data_result in view_query.iter_visible_data_results(ctx, Self::identifier()) { diff --git a/crates/viewer/re_space_view_text_log/Cargo.toml b/crates/viewer/re_view_text_log/Cargo.toml similarity index 81% rename from crates/viewer/re_space_view_text_log/Cargo.toml rename to crates/viewer/re_view_text_log/Cargo.toml index 8e6e17446496..e1a2ec98271e 100644 --- a/crates/viewer/re_space_view_text_log/Cargo.toml +++ b/crates/viewer/re_view_text_log/Cargo.toml @@ -1,10 +1,10 @@ [package] authors.workspace = true -description = "A space view that shows text entries in a table and scrolls with the active time." +description = "A view that shows text entries in a table and scrolls with the active time." edition.workspace = true homepage.workspace = true license.workspace = true -name = "re_space_view_text_log" +name = "re_view_text_log" publish = true readme = "README.md" repository.workspace = true @@ -25,7 +25,7 @@ re_entity_db.workspace = true re_log_types.workspace = true re_query.workspace = true re_renderer.workspace = true -re_space_view.workspace = true +re_view.workspace = true re_tracing.workspace = true re_types.workspace = true re_ui.workspace = true diff --git a/crates/viewer/re_view_text_log/README.md b/crates/viewer/re_view_text_log/README.md new file mode 100644 index 000000000000..8ae9b824d012 --- /dev/null +++ b/crates/viewer/re_view_text_log/README.md @@ -0,0 +1,11 @@ +# re_view_text_log + +Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. + +[![Latest version](https://img.shields.io/crates/v/re_view_text_log.svg)](https://crates.io/crates/re_view_text_log?speculative-link) +[![Documentation](https://docs.rs/re_view_text_log/badge.svg)](https://docs.rs/re_view_text_log?speculative-link) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +A View that shows text entries in a table and scrolls with the active time. + diff --git a/crates/viewer/re_view_text_log/src/lib.rs b/crates/viewer/re_view_text_log/src/lib.rs new file mode 100644 index 000000000000..5126cd0fd8f7 --- /dev/null +++ b/crates/viewer/re_view_text_log/src/lib.rs @@ -0,0 +1,8 @@ +//! Rerun `TextLog` View +//! +//! A View that shows `TextLog` entries in a table and scrolls with the active time. + +mod view_class; +mod visualizer_system; + +pub use view_class::TextView; diff --git a/crates/viewer/re_space_view_text_log/src/space_view_class.rs b/crates/viewer/re_view_text_log/src/view_class.rs similarity index 88% rename from crates/viewer/re_space_view_text_log/src/space_view_class.rs rename to crates/viewer/re_view_text_log/src/view_class.rs index 594d7ad98408..7e9aba2fc536 100644 --- a/crates/viewer/re_space_view_text_log/src/space_view_class.rs +++ b/crates/viewer/re_view_text_log/src/view_class.rs @@ -3,19 +3,19 @@ use std::collections::BTreeMap; use re_data_ui::item_ui; use re_log_types::{EntityPath, Timeline}; use re_types::View; -use re_types::{components::TextLogLevel, SpaceViewClassIdentifier}; +use re_types::{components::TextLogLevel, ViewClassIdentifier}; use re_ui::UiExt as _; use re_viewer_context::{ - level_to_rich_text, IdentifiedViewSystem as _, SpaceViewClass, SpaceViewClassRegistryError, - SpaceViewId, SpaceViewSpawnHeuristics, SpaceViewState, SpaceViewStateExt, - SpaceViewSystemExecutionError, ViewQuery, ViewerContext, + level_to_rich_text, IdentifiedViewSystem as _, ViewClass, ViewClassRegistryError, ViewId, + ViewQuery, ViewSpawnHeuristics, ViewState, ViewStateExt, ViewSystemExecutionError, + ViewerContext, }; use super::visualizer_system::{Entry, TextLogSystem}; // TODO(andreas): This should be a blueprint component. #[derive(Clone, PartialEq, Eq, Default)] -pub struct TextSpaceViewState { +pub struct TextViewState { /// Keeps track of the latest time selection made by the user. /// /// We need this because we want the user to be able to manually scroll the @@ -27,7 +27,7 @@ pub struct TextSpaceViewState { monospace: bool, } -impl SpaceViewState for TextSpaceViewState { +impl ViewState for TextViewState { fn as_any(&self) -> &dyn std::any::Any { self } @@ -38,12 +38,12 @@ impl SpaceViewState for TextSpaceViewState { } #[derive(Default)] -pub struct TextSpaceView; +pub struct TextView; type ViewType = re_types::blueprint::views::TextLogView; -impl SpaceViewClass for TextSpaceView { - fn identifier() -> SpaceViewClassIdentifier { +impl ViewClass for TextView { + fn identifier() -> ViewClassIdentifier { ViewType::identifier() } @@ -52,7 +52,7 @@ impl SpaceViewClass for TextSpaceView { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_LOG + &re_ui::icons::VIEW_LOG } fn help_markdown(&self, _egui_ctx: &egui::Context) -> String { @@ -60,33 +60,30 @@ impl SpaceViewClass for TextSpaceView { Shows `TextLog` entries over time. -Note: select the Space View for filtering options." +Note: select the View for filtering options." .to_owned() } fn on_register( &self, - system_registry: &mut re_viewer_context::SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut re_viewer_context::ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { system_registry.register_visualizer::() } - fn new_state(&self) -> Box { - Box::::default() + fn new_state(&self) -> Box { + Box::::default() } - fn preferred_tile_aspect_ratio(&self, _state: &dyn SpaceViewState) -> Option { + fn preferred_tile_aspect_ratio(&self, _state: &dyn ViewState) -> Option { Some(2.0) // Make text logs wide } - fn layout_priority(&self) -> re_viewer_context::SpaceViewClassLayoutPriority { - re_viewer_context::SpaceViewClassLayoutPriority::Low + fn layout_priority(&self) -> re_viewer_context::ViewClassLayoutPriority { + re_viewer_context::ViewClassLayoutPriority::Low } - fn spawn_heuristics( - &self, - ctx: &ViewerContext<'_>, - ) -> re_viewer_context::SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> re_viewer_context::ViewSpawnHeuristics { re_tracing::profile_function!(); // Spawn a single log view at the root if there's any text logs around anywhere. @@ -96,9 +93,9 @@ Note: select the Space View for filtering options." .get(&TextLogSystem::identifier()) .map_or(true, |entities| entities.is_empty()) { - SpaceViewSpawnHeuristics::default() + ViewSpawnHeuristics::default() } else { - SpaceViewSpawnHeuristics::root() + ViewSpawnHeuristics::root() } } @@ -106,11 +103,11 @@ Note: select the Space View for filtering options." &self, _ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _space_origin: &EntityPath, - _space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { - let state = state.downcast_mut::()?; + _view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { + let state = state.downcast_mut::()?; let ViewTextFilters { col_timelines, @@ -153,14 +150,14 @@ Note: select the Space View for filtering options." &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _query: &ViewQuery<'_>, system_output: re_viewer_context::SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); - let state = state.downcast_mut::()?; + let state = state.downcast_mut::()?; let text = system_output.view_systems.get::()?; // TODO(andreas): Should filter text entries in the part-system instead. @@ -275,7 +272,7 @@ impl ViewTextFilters { fn table_ui( ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &TextSpaceViewState, + state: &TextViewState, entries: &[&Entry], scroll_to_row: Option, ) { @@ -296,8 +293,8 @@ fn table_ui( let mut table_builder = egui_extras::TableBuilder::new(ui) .resizable(true) .vscroll(true) - .auto_shrink([false; 2]) // expand to take up the whole Space View - .min_scrolled_height(0.0) // we can go as small as we need to be in order to fit within the space view! + .auto_shrink([false; 2]) // expand to take up the whole View + .min_scrolled_height(0.0) // we can go as small as we need to be in order to fit within the view! .max_scroll_height(f32::INFINITY) // Fill up whole height .cell_layout(egui::Layout::left_to_right(egui::Align::TOP)); diff --git a/crates/viewer/re_space_view_text_log/src/visualizer_system.rs b/crates/viewer/re_view_text_log/src/visualizer_system.rs similarity index 93% rename from crates/viewer/re_space_view_text_log/src/visualizer_system.rs rename to crates/viewer/re_view_text_log/src/visualizer_system.rs index 2b964a32f64c..9440dbf5883d 100644 --- a/crates/viewer/re_space_view_text_log/src/visualizer_system.rs +++ b/crates/viewer/re_view_text_log/src/visualizer_system.rs @@ -4,15 +4,15 @@ use re_entity_db::EntityPath; use re_log_types::TimeInt; use re_log_types::TimePoint; use re_query::{clamped_zip_1x2, range_zip_1x2}; -use re_space_view::{range_with_blueprint_resolved_data, RangeResultsExt}; use re_types::{ archetypes::TextLog, components::{Color, Text, TextLogLevel}, Component as _, }; +use re_view::{range_with_blueprint_resolved_data, RangeResultsExt}; use re_viewer_context::{ - IdentifiedViewSystem, SpaceViewSystemExecutionError, ViewContext, ViewContextCollection, - ViewQuery, VisualizerQueryInfo, VisualizerSystem, + IdentifiedViewSystem, ViewContext, ViewContextCollection, ViewQuery, ViewSystemExecutionError, + VisualizerQueryInfo, VisualizerSystem, }; #[derive(Debug, Clone)] @@ -47,7 +47,7 @@ impl VisualizerSystem for TextLogSystem { ctx: &ViewContext<'_>, view_query: &ViewQuery<'_>, _context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { re_tracing::profile_function!(); let query = diff --git a/crates/viewer/re_space_view_time_series/Cargo.toml b/crates/viewer/re_view_time_series/Cargo.toml similarity index 85% rename from crates/viewer/re_space_view_time_series/Cargo.toml rename to crates/viewer/re_view_time_series/Cargo.toml index 7f67d194dfa8..aceec9cdbbfe 100644 --- a/crates/viewer/re_space_view_time_series/Cargo.toml +++ b/crates/viewer/re_view_time_series/Cargo.toml @@ -1,10 +1,10 @@ [package] authors.workspace = true -description = "A space view that shows plots over Rerun timelines." +description = "A view that shows plots over Rerun timelines." edition.workspace = true homepage.workspace = true license.workspace = true -name = "re_space_view_time_series" +name = "re_view_time_series" publish = true readme = "README.md" repository.workspace = true @@ -25,7 +25,7 @@ re_log.workspace = true re_log_types.workspace = true re_query.workspace = true re_renderer.workspace = true -re_space_view.workspace = true +re_view.workspace = true re_tracing.workspace = true re_types = { workspace = true, features = ["egui_plot"] } re_ui.workspace = true diff --git a/crates/viewer/re_view_time_series/README.md b/crates/viewer/re_view_time_series/README.md new file mode 100644 index 000000000000..2c6c7fb5ab32 --- /dev/null +++ b/crates/viewer/re_view_time_series/README.md @@ -0,0 +1,11 @@ +# re_view_bar_chart + +Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. + +[![Latest version](https://img.shields.io/crates/v/re_view_bar_chart.svg)](https://crates.io/crates/re_view_bar_chart?speculative-link) +[![Documentation](https://docs.rs/re_view_bar_chart/badge.svg)](https://docs.rs/re_view_bar_chart?speculative-link) +![MIT](https://img.shields.io/badge/license-MIT-blue.svg) +![Apache](https://img.shields.io/badge/license-Apache-blue.svg) + +A View that shows plots over Rerun timelines. + diff --git a/crates/viewer/re_space_view_time_series/src/aggregation.rs b/crates/viewer/re_view_time_series/src/aggregation.rs similarity index 100% rename from crates/viewer/re_space_view_time_series/src/aggregation.rs rename to crates/viewer/re_view_time_series/src/aggregation.rs diff --git a/crates/viewer/re_space_view_time_series/src/lib.rs b/crates/viewer/re_view_time_series/src/lib.rs similarity index 85% rename from crates/viewer/re_space_view_time_series/src/lib.rs rename to crates/viewer/re_view_time_series/src/lib.rs index f3e2b4fbdf23..8a075f817f38 100644 --- a/crates/viewer/re_space_view_time_series/src/lib.rs +++ b/crates/viewer/re_view_time_series/src/lib.rs @@ -1,6 +1,6 @@ -//! Rerun time series Space View +//! Rerun time series View //! -//! A Space View that shows plots over Rerun timelines. +//! A View that shows plots over Rerun timelines. // TODO(#6330): remove unwrap() #![allow(clippy::unwrap_used)] @@ -8,23 +8,23 @@ mod aggregation; mod line_visualizer_system; mod point_visualizer_system; -mod space_view_class; mod util; +mod view_class; use re_log_types::EntityPath; use re_types::components::{AggregationPolicy, MarkerShape}; -pub use space_view_class::TimeSeriesSpaceView; +pub use view_class::TimeSeriesView; -/// Computes a deterministic, globally unique ID for the plot based on the ID of the space view +/// Computes a deterministic, globally unique ID for the plot based on the ID of the view /// itself. /// /// Use it to access the plot's state from anywhere, e.g.: /// ```ignore -/// let plot_mem = egui_plot::PlotMemory::load(egui_ctx, crate::plot_id(query.space_view_id)); +/// let plot_mem = egui_plot::PlotMemory::load(egui_ctx, crate::plot_id(query.view_id)); /// ``` #[inline] -pub(crate) fn plot_id(space_view_id: re_viewer_context::SpaceViewId) -> egui::Id { - egui::Id::new(("plot", space_view_id)) +pub(crate) fn plot_id(view_id: re_viewer_context::ViewId) -> egui::Id { + egui::Id::new(("plot", view_id)) } // --- diff --git a/crates/viewer/re_space_view_time_series/src/line_visualizer_system.rs b/crates/viewer/re_view_time_series/src/line_visualizer_system.rs similarity index 96% rename from crates/viewer/re_space_view_time_series/src/line_visualizer_system.rs rename to crates/viewer/re_view_time_series/src/line_visualizer_system.rs index 212ef41733c2..140bc073bf28 100644 --- a/crates/viewer/re_space_view_time_series/src/line_visualizer_system.rs +++ b/crates/viewer/re_view_time_series/src/line_visualizer_system.rs @@ -2,7 +2,6 @@ use itertools::Itertools; use re_chunk_store::{RangeQuery, RowId}; use re_log_types::{EntityPath, TimeInt}; -use re_space_view::range_with_blueprint_resolved_data; use re_types::archetypes; use re_types::components::{AggregationPolicy, ClearIsRecursive}; use re_types::external::arrow2::datatypes::DataType as Arrow2Datatype; @@ -11,14 +10,15 @@ use re_types::{ components::{Color, Name, Scalar, StrokeWidth}, Archetype as _, Component, Loggable, }; +use re_view::range_with_blueprint_resolved_data; use re_viewer_context::{ - auto_color_for_entity_path, IdentifiedViewSystem, QueryContext, SpaceViewStateExt as _, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, ViewQuery, - VisualizerQueryInfo, VisualizerSystem, + auto_color_for_entity_path, IdentifiedViewSystem, QueryContext, TypedComponentFallbackProvider, + ViewContext, ViewQuery, ViewStateExt as _, ViewSystemExecutionError, VisualizerQueryInfo, + VisualizerSystem, }; -use crate::space_view_class::TimeSeriesSpaceViewState; use crate::util::{determine_time_per_pixel, determine_time_range, points_to_series}; +use crate::view_class::TimeSeriesViewState; use crate::{PlotPoint, PlotPointAttrs, PlotSeries, PlotSeriesKind}; /// The system for rendering [`SeriesLine`] archetypes. @@ -55,7 +55,7 @@ impl VisualizerSystem for SeriesLineSystem { ctx: &ViewContext<'_>, query: &ViewQuery<'_>, _context: &re_viewer_context::ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { re_tracing::profile_function!(); self.load_scalars(ctx, query); @@ -85,7 +85,7 @@ impl TypedComponentFallbackProvider for SeriesLineSystem { impl TypedComponentFallbackProvider for SeriesLineSystem { fn fallback_for(&self, ctx: &QueryContext<'_>) -> Name { - let state = ctx.view_state.downcast_ref::(); + let state = ctx.view_state.downcast_ref::(); state .ok() @@ -110,10 +110,8 @@ impl SeriesLineSystem { fn load_scalars(&mut self, ctx: &ViewContext<'_>, query: &ViewQuery<'_>) { re_tracing::profile_function!(); - let plot_mem = egui_plot::PlotMemory::load( - ctx.viewer_ctx.egui_ctx, - crate::plot_id(query.space_view_id), - ); + let plot_mem = + egui_plot::PlotMemory::load(ctx.viewer_ctx.egui_ctx, crate::plot_id(query.view_id)); let time_per_pixel = determine_time_per_pixel(ctx.viewer_ctx, plot_mem.as_ref()); let data_results = query.iter_visible_data_results(ctx, Self::identifier()); @@ -191,12 +189,12 @@ impl SeriesLineSystem { let time_offset = ctx .view_state - .downcast_ref::() + .downcast_ref::() .map_or(0, |state| state.time_offset); let time_range = determine_time_range(view_query.latest_at, time_offset, data_result, plot_mem); { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; re_tracing::profile_scope!("primary", &data_result.entity_path.to_string()); diff --git a/crates/viewer/re_space_view_time_series/src/point_visualizer_system.rs b/crates/viewer/re_view_time_series/src/point_visualizer_system.rs similarity index 96% rename from crates/viewer/re_space_view_time_series/src/point_visualizer_system.rs rename to crates/viewer/re_view_time_series/src/point_visualizer_system.rs index dc232568df7c..9ab73b3855f1 100644 --- a/crates/viewer/re_space_view_time_series/src/point_visualizer_system.rs +++ b/crates/viewer/re_view_time_series/src/point_visualizer_system.rs @@ -1,21 +1,21 @@ use itertools::Itertools as _; -use re_space_view::range_with_blueprint_resolved_data; use re_types::{ archetypes::{self, SeriesPoint}, components::{Color, MarkerShape, MarkerSize, Name, Scalar}, external::arrow2::datatypes::DataType as Arrow2Datatype, Archetype as _, Component as _, Loggable as _, }; +use re_view::range_with_blueprint_resolved_data; use re_viewer_context::{ - auto_color_for_entity_path, IdentifiedViewSystem, QueryContext, SpaceViewStateExt as _, - SpaceViewSystemExecutionError, TypedComponentFallbackProvider, ViewContext, ViewQuery, - VisualizerQueryInfo, VisualizerSystem, + auto_color_for_entity_path, IdentifiedViewSystem, QueryContext, TypedComponentFallbackProvider, + ViewContext, ViewQuery, ViewStateExt as _, ViewSystemExecutionError, VisualizerQueryInfo, + VisualizerSystem, }; use crate::{ - space_view_class::TimeSeriesSpaceViewState, util::{determine_time_per_pixel, determine_time_range, points_to_series}, + view_class::TimeSeriesViewState, PlotPoint, PlotPointAttrs, PlotSeries, PlotSeriesKind, ScatterAttrs, }; @@ -55,7 +55,7 @@ impl VisualizerSystem for SeriesPointSystem { ctx: &ViewContext<'_>, query: &ViewQuery<'_>, _context: &re_viewer_context::ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { + ) -> Result, ViewSystemExecutionError> { re_tracing::profile_function!(); self.load_scalars(ctx, query); @@ -85,7 +85,7 @@ impl TypedComponentFallbackProvider for SeriesPointSystem { impl TypedComponentFallbackProvider for SeriesPointSystem { fn fallback_for(&self, ctx: &QueryContext<'_>) -> Name { - let state = ctx.view_state.downcast_ref::(); + let state = ctx.view_state.downcast_ref::(); state .ok() @@ -110,10 +110,8 @@ impl SeriesPointSystem { fn load_scalars(&mut self, ctx: &ViewContext<'_>, query: &ViewQuery<'_>) { re_tracing::profile_function!(); - let plot_mem = egui_plot::PlotMemory::load( - ctx.viewer_ctx.egui_ctx, - crate::plot_id(query.space_view_id), - ); + let plot_mem = + egui_plot::PlotMemory::load(ctx.viewer_ctx.egui_ctx, crate::plot_id(query.view_id)); let time_per_pixel = determine_time_per_pixel(ctx.viewer_ctx, plot_mem.as_ref()); let data_results = query.iter_visible_data_results(ctx, Self::identifier()); @@ -205,13 +203,13 @@ impl SeriesPointSystem { let time_offset = ctx .view_state - .downcast_ref::() + .downcast_ref::() .map_or(0, |state| state.time_offset); let time_range = determine_time_range(view_query.latest_at, time_offset, data_result, plot_mem); { - use re_space_view::RangeResultsExt as _; + use re_view::RangeResultsExt as _; re_tracing::profile_scope!("primary", &data_result.entity_path.to_string()); diff --git a/crates/viewer/re_space_view_time_series/src/util.rs b/crates/viewer/re_view_time_series/src/util.rs similarity index 98% rename from crates/viewer/re_space_view_time_series/src/util.rs rename to crates/viewer/re_view_time_series/src/util.rs index f268f1aaa722..eca8c7848294 100644 --- a/crates/viewer/re_space_view_time_series/src/util.rs +++ b/crates/viewer/re_view_time_series/src/util.rs @@ -147,7 +147,7 @@ pub fn apply_aggregation( // TODO(#4969): output a thicker line instead of zig-zagging. let aggregation_duration = time_per_pixel; // aggregate all points covering one physical pixel - // So it can be displayed in the UI by the SpaceViewClass. + // So it can be displayed in the UI by the ViewClass. let num_points_before = points.len() as f64; // If the user logged multiples scalars per time stamp, we should aggregate them, @@ -187,7 +187,7 @@ pub fn apply_aggregation( let actual_aggregation_factor = num_points_before / num_points_after; re_log::trace!( - id = %query.space_view_id, + id = %query.view_id, ?aggregator, aggregation_duration, num_points_before, diff --git a/crates/viewer/re_space_view_time_series/src/space_view_class.rs b/crates/viewer/re_view_time_series/src/view_class.rs similarity index 89% rename from crates/viewer/re_space_view_time_series/src/space_view_class.rs rename to crates/viewer/re_view_time_series/src/view_class.rs index 2b1b8581ca1d..b865b32fd716 100644 --- a/crates/viewer/re_space_view_time_series/src/space_view_class.rs +++ b/crates/viewer/re_view_time_series/src/view_class.rs @@ -5,22 +5,22 @@ use egui_plot::{Legend, Line, Plot, PlotPoint, Points}; use re_chunk_store::TimeType; use re_format::next_grid_tick_magnitude_ns; use re_log_types::{EntityPath, TimeInt, TimeZone}; -use re_space_view::controls::{ - ASPECT_SCROLL_MODIFIER, HORIZONTAL_SCROLL_MODIFIER, MOVE_TIME_CURSOR_BUTTON, - SELECTION_RECT_ZOOM_BUTTON, ZOOM_SCROLL_MODIFIER, -}; -use re_space_view::{controls, view_property_ui}; use re_types::blueprint::archetypes::{PlotLegend, ScalarAxis}; use re_types::blueprint::components::{Corner2D, LockRangeDuringZoom, Visible}; use re_types::components::AggregationPolicy; -use re_types::{components::Range1D, datatypes::TimeRange, SpaceViewClassIdentifier, View}; +use re_types::{components::Range1D, datatypes::TimeRange, View, ViewClassIdentifier}; use re_ui::{list_item, ModifiersMarkdown, MouseButtonMarkdown, UiExt as _}; +use re_view::controls::{ + ASPECT_SCROLL_MODIFIER, HORIZONTAL_SCROLL_MODIFIER, MOVE_TIME_CURSOR_BUTTON, + SELECTION_RECT_ZOOM_BUTTON, ZOOM_SCROLL_MODIFIER, +}; +use re_view::{controls, view_property_ui}; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, IndicatedEntities, PerVisualizer, QueryRange, - RecommendedSpaceView, SmallVisualizerSet, SpaceViewClass, SpaceViewClassRegistryError, - SpaceViewId, SpaceViewSpawnHeuristics, SpaceViewState, SpaceViewStateExt as _, - SpaceViewSystemExecutionError, SystemExecutionOutput, TypedComponentFallbackProvider, - ViewQuery, ViewSystemIdentifier, ViewerContext, VisualizableEntities, + RecommendedView, SmallVisualizerSet, SystemExecutionOutput, TypedComponentFallbackProvider, + ViewClass, ViewClassRegistryError, ViewId, ViewQuery, ViewSpawnHeuristics, ViewState, + ViewStateExt as _, ViewSystemExecutionError, ViewSystemIdentifier, ViewerContext, + VisualizableEntities, }; use re_viewport_blueprint::ViewProperty; @@ -31,7 +31,7 @@ use crate::PlotSeriesKind; // --- #[derive(Clone)] -pub struct TimeSeriesSpaceViewState { +pub struct TimeSeriesViewState { /// Is the user dragging the cursor this frame? is_dragging_time_cursor: bool, @@ -58,7 +58,7 @@ pub struct TimeSeriesSpaceViewState { pub(crate) default_names_for_entities: HashMap, } -impl Default for TimeSeriesSpaceViewState { +impl Default for TimeSeriesViewState { fn default() -> Self { Self { is_dragging_time_cursor: false, @@ -71,7 +71,7 @@ impl Default for TimeSeriesSpaceViewState { } } -impl SpaceViewState for TimeSeriesSpaceViewState { +impl ViewState for TimeSeriesViewState { fn as_any(&self) -> &dyn std::any::Any { self } @@ -82,12 +82,12 @@ impl SpaceViewState for TimeSeriesSpaceViewState { } #[derive(Default)] -pub struct TimeSeriesSpaceView; +pub struct TimeSeriesView; type ViewType = re_types::blueprint::views::TimeSeriesView; -impl SpaceViewClass for TimeSeriesSpaceView { - fn identifier() -> SpaceViewClassIdentifier { +impl ViewClass for TimeSeriesView { + fn identifier() -> ViewClassIdentifier { ViewType::identifier() } @@ -96,7 +96,7 @@ impl SpaceViewClass for TimeSeriesSpaceView { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_TIMESERIES + &re_ui::icons::VIEW_TIMESERIES } fn help_markdown(&self, egui_ctx: &egui::Context) -> String { @@ -123,30 +123,30 @@ Display time series data in a plot. fn on_register( &self, - system_registry: &mut re_viewer_context::SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut re_viewer_context::ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { system_registry.register_visualizer::()?; system_registry.register_visualizer::()?; Ok(()) } - fn new_state(&self) -> Box { - Box::::default() + fn new_state(&self) -> Box { + Box::::default() } - fn preferred_tile_aspect_ratio(&self, _state: &dyn SpaceViewState) -> Option { + fn preferred_tile_aspect_ratio(&self, _state: &dyn ViewState) -> Option { None } - fn layout_priority(&self) -> re_viewer_context::SpaceViewClassLayoutPriority { - re_viewer_context::SpaceViewClassLayoutPriority::Low + fn layout_priority(&self) -> re_viewer_context::ViewClassLayoutPriority { + re_viewer_context::ViewClassLayoutPriority::Low } fn supports_visible_time_range(&self) -> bool { true } - fn default_query_range(&self, _view_state: &dyn SpaceViewState) -> QueryRange { + fn default_query_range(&self, _view_state: &dyn ViewState) -> QueryRange { QueryRange::TimeRange(TimeRange::EVERYTHING) } @@ -154,21 +154,21 @@ Display time series data in a plot. &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _space_origin: &EntityPath, - space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { - let state = state.downcast_mut::()?; + view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { + let state = state.downcast_mut::()?; list_item::list_item_scope(ui, "time_series_selection_ui", |ui| { - view_property_ui::(ctx, ui, space_view_id, self, state); - view_property_ui::(ctx, ui, space_view_id, self, state); + view_property_ui::(ctx, ui, view_id, self, state); + view_property_ui::(ctx, ui, view_id, self, state); }); Ok(()) } - fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> ViewSpawnHeuristics { re_tracing::profile_function!(); // For all following lookups, checking indicators is enough, since we know that this is enough to infer visualizability here. @@ -194,7 +194,7 @@ Display time series data in a plot. } if indicated_entities.0.is_empty() { - return SpaceViewSpawnHeuristics::default(); + return ViewSpawnHeuristics::default(); } // Spawn time series data at the root if there's time series data either @@ -208,7 +208,7 @@ Display time series data in a plot. .iter() .any(|(_, subtree)| indicated_entities.contains(&subtree.path)) { - return SpaceViewSpawnHeuristics::root(); + return ViewSpawnHeuristics::root(); } // If there's other entities that have the right indicator & didn't match the above, @@ -220,9 +220,9 @@ Display time series data in a plot. } } - SpaceViewSpawnHeuristics::new(child_of_root_entities.into_iter().map(|path_part| { + ViewSpawnHeuristics::new(child_of_root_entities.into_iter().map(|path_part| { let entity = EntityPath::new(vec![path_part.clone()]); - RecommendedSpaceView::new_subtree(entity) + RecommendedView::new_subtree(entity) })) } @@ -273,16 +273,16 @@ Display time series data in a plot. &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, query: &ViewQuery<'_>, system_output: SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { re_tracing::profile_function!(); - let state = state.downcast_mut::()?; + let state = state.downcast_mut::()?; let blueprint_db = ctx.blueprint_db(); - let view_id = query.space_view_id; + let view_id = query.view_id; let plot_legend = ViewProperty::from_archetype::(blueprint_db, ctx.blueprint_query, view_id); @@ -360,7 +360,7 @@ Display time series data in a plot. // TODO(#5075): Boxed-zoom should be fixed to accommodate the locked range. let time_zone_for_timestamps = ctx.app_options.time_zone; let mut plot = Plot::new(plot_id_src) - .id(crate::plot_id(query.space_view_id)) + .id(crate::plot_id(query.view_id)) .auto_bounds([true, false].into()) // Never use y auto bounds: we dictated bounds via blueprint under all circumstances. .allow_zoom([true, !lock_y_during_zoom]) .x_axis_formatter(move |time, _| { @@ -523,14 +523,11 @@ Display time series data in a plot. if let Some(hovered) = hovered_plot_item .and_then(|hovered_plot_item| plot_item_id_to_entity_path.get(&hovered_plot_item)) .map(|entity_path| { - re_viewer_context::Item::DataResult( - query.space_view_id, - entity_path.clone().into(), - ) + re_viewer_context::Item::DataResult(query.view_id, entity_path.clone().into()) }) .or_else(|| { if response.hovered() { - Some(re_viewer_context::Item::SpaceView(query.space_view_id)) + Some(re_viewer_context::Item::View(query.view_id)) } else { None } @@ -649,7 +646,7 @@ fn round_ns_to_start_of_day(ns: i64) -> i64 { (ns + ns_per_day / 2) / ns_per_day * ns_per_day } -impl TypedComponentFallbackProvider for TimeSeriesSpaceView { +impl TypedComponentFallbackProvider for TimeSeriesView { fn fallback_for(&self, _ctx: &re_viewer_context::QueryContext<'_>) -> Corner2D { // Explicitly pick RightCorner2D::RightBottom, we don't want to make this dependent on the (arbitrary) // default of Corner2D @@ -657,11 +654,11 @@ impl TypedComponentFallbackProvider for TimeSeriesSpaceView { } } -impl TypedComponentFallbackProvider for TimeSeriesSpaceView { +impl TypedComponentFallbackProvider for TimeSeriesView { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> Range1D { ctx.view_state .as_any() - .downcast_ref::() + .downcast_ref::() .map(|s| make_range_sane(s.scalar_range)) .unwrap_or_default() } @@ -690,4 +687,4 @@ fn make_range_sane(y_range: Range1D) -> Range1D { } } -re_viewer_context::impl_component_fallback_provider!(TimeSeriesSpaceView => [Corner2D, Range1D]); +re_viewer_context::impl_component_fallback_provider!(TimeSeriesView => [Corner2D, Range1D]); diff --git a/crates/viewer/re_viewer/Cargo.toml b/crates/viewer/re_viewer/Cargo.toml index 242e8d6a4c65..18f55819dca5 100644 --- a/crates/viewer/re_viewer/Cargo.toml +++ b/crates/viewer/re_viewer/Cargo.toml @@ -38,7 +38,7 @@ default = ["analytics", "map_view"] analytics = ["dep:re_analytics"] ## Enable the map view -map_view = ["dep:re_space_view_map"] +map_view = ["dep:re_view_map"] ## Enable the gRPC Rerun Data Platform data source. grpc = ["re_data_source/grpc", "dep:re_grpc_client"] @@ -71,14 +71,14 @@ re_renderer = { workspace = true, default-features = false } re_selection_panel.workspace = true re_sdk_comms.workspace = true re_smart_channel.workspace = true -re_space_view_bar_chart.workspace = true -re_space_view_dataframe.workspace = true -re_space_view_graph.workspace = true -re_space_view_spatial.workspace = true -re_space_view_tensor.workspace = true -re_space_view_text_document.workspace = true -re_space_view_text_log.workspace = true -re_space_view_time_series.workspace = true +re_view_bar_chart.workspace = true +re_view_dataframe.workspace = true +re_view_graph.workspace = true +re_view_spatial.workspace = true +re_view_tensor.workspace = true +re_view_text_document.workspace = true +re_view_text_log.workspace = true +re_view_time_series.workspace = true re_time_panel.workspace = true re_tracing = { workspace = true, features = ["server"] } re_types_blueprint.workspace = true @@ -94,7 +94,7 @@ re_ws_comms = { workspace = true, features = ["client"] } # Internal (optional): re_analytics = { workspace = true, optional = true } re_grpc_client = { workspace = true, optional = true } -re_space_view_map = { workspace = true, optional = true } +re_view_map = { workspace = true, optional = true } # External diff --git a/crates/viewer/re_viewer/README.md b/crates/viewer/re_viewer/README.md index 10c648321f03..adf3ef575924 100644 --- a/crates/viewer/re_viewer/README.md +++ b/crates/viewer/re_viewer/README.md @@ -2,8 +2,8 @@ Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. -[![Latest version](https://img.shields.io/crates/v/re_viewer.svg)](https://crates.io/crates/viewer/re_viewer) -[![Documentation](https://docs.rs/re_viewer/badge.svg)](https://docs.rs/re_viewer) +[![Latest version](https://img.shields.io/crates/v/re_viewer.svg)](https://crates.io/crates/viewer/re_viewer?speculative-link) +[![Documentation](https://docs.rs/re_viewer/badge.svg)](https://docs.rs/re_viewer?speculative-link) ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) diff --git a/crates/viewer/re_viewer/src/app.rs b/crates/viewer/re_viewer/src/app.rs index 39b3e4c02b2e..b8d36e4d2899 100644 --- a/crates/viewer/re_viewer/src/app.rs +++ b/crates/viewer/re_viewer/src/app.rs @@ -13,8 +13,8 @@ use re_viewer_context::{ command_channel, store_hub::{BlueprintPersistence, StoreHub, StoreHubStats}, AppOptions, BlueprintUndoState, CommandReceiver, CommandSender, ComponentUiRegistry, PlayState, - SpaceViewClass, SpaceViewClassRegistry, SpaceViewClassRegistryError, StoreContext, - SystemCommand, SystemCommandSender, + StoreContext, SystemCommand, SystemCommandSender, ViewClass, ViewClassRegistry, + ViewClassRegistryError, }; use crate::app_blueprint::PanelStateOverrides; @@ -210,8 +210,8 @@ pub struct App { analytics: crate::viewer_analytics::ViewerAnalytics, - /// All known space view types. - space_view_class_registry: SpaceViewClassRegistry, + /// All known view types. + view_class_registry: ViewClassRegistry, pub(crate) panel_state_overrides_active: bool, pub(crate) panel_state_overrides: PanelStateOverrides, @@ -266,12 +266,10 @@ impl App { state.app_options.video_decoder_hw_acceleration = video_decoder_hw_acceleration; } - let mut space_view_class_registry = SpaceViewClassRegistry::default(); - if let Err(err) = - populate_space_view_class_registry_with_builtin(&mut space_view_class_registry) - { + let mut view_class_registry = ViewClassRegistry::default(); + if let Err(err) = populate_view_class_registry_with_builtin(&mut view_class_registry) { re_log::error!( - "Failed to populate the view type registry with built-in space views: {}", + "Failed to populate the view type registry with built-in views: {}", err ); } @@ -344,7 +342,7 @@ impl App { command_receiver, cmd_palette: Default::default(), - space_view_class_registry, + view_class_registry, analytics, @@ -394,11 +392,11 @@ impl App { &self.rx } - /// Adds a new space view class to the viewer. - pub fn add_space_view_class( + /// Adds a new view class to the viewer. + pub fn add_view_class( &mut self, - ) -> Result<(), SpaceViewClassRegistryError> { - self.space_view_class_registry.add_class::() + ) -> Result<(), ViewClassRegistryError> { + self.view_class_registry.add_class::() } fn check_keyboard_shortcuts(&self, egui_ctx: &egui::Context) { @@ -1102,7 +1100,7 @@ impl App { store_context, &self.reflection, &self.component_ui_registry, - &self.space_view_class_registry, + &self.view_class_registry, &self.rx, &self.command_sender, &WelcomeScreenState { @@ -1979,22 +1977,22 @@ impl eframe::App for App { } } -/// Add built-in space views to the registry. -fn populate_space_view_class_registry_with_builtin( - space_view_class_registry: &mut SpaceViewClassRegistry, -) -> Result<(), SpaceViewClassRegistryError> { +/// Add built-in views to the registry. +fn populate_view_class_registry_with_builtin( + view_class_registry: &mut ViewClassRegistry, +) -> Result<(), ViewClassRegistryError> { re_tracing::profile_function!(); - space_view_class_registry.add_class::()?; - space_view_class_registry.add_class::()?; - space_view_class_registry.add_class::()?; + view_class_registry.add_class::()?; + view_class_registry.add_class::()?; + view_class_registry.add_class::()?; #[cfg(feature = "map_view")] - space_view_class_registry.add_class::()?; - space_view_class_registry.add_class::()?; - space_view_class_registry.add_class::()?; - space_view_class_registry.add_class::()?; - space_view_class_registry.add_class::()?; - space_view_class_registry.add_class::()?; - space_view_class_registry.add_class::()?; + view_class_registry.add_class::()?; + view_class_registry.add_class::()?; + view_class_registry.add_class::()?; + view_class_registry.add_class::()?; + view_class_registry.add_class::()?; + view_class_registry.add_class::()?; + view_class_registry.add_class::()?; Ok(()) } diff --git a/crates/viewer/re_viewer/src/app_state.rs b/crates/viewer/re_viewer/src/app_state.rs index 36d6d5cebe78..08a0050fd739 100644 --- a/crates/viewer/re_viewer/src/app_state.rs +++ b/crates/viewer/re_viewer/src/app_state.rs @@ -9,11 +9,11 @@ use re_types::blueprint::components::PanelState; use re_ui::{ContextExt as _, DesignTokens}; use re_viewer_context::{ AppOptions, ApplicationSelectionState, BlueprintUndoState, CommandSender, ComponentUiRegistry, - PlayState, RecordingConfig, SpaceViewClassExt as _, SpaceViewClassRegistry, StoreContext, - StoreHub, SystemCommandSender as _, ViewStates, ViewerContext, + PlayState, RecordingConfig, StoreContext, StoreHub, SystemCommandSender as _, + ViewClassExt as _, ViewClassRegistry, ViewStates, ViewerContext, }; use re_viewport::ViewportUi; -use re_viewport_blueprint::ui::add_space_view_or_container_modal_ui; +use re_viewport_blueprint::ui::add_view_or_container_modal_ui; use re_viewport_blueprint::ViewportBlueprint; use crate::{ @@ -59,7 +59,7 @@ pub struct AppState { #[serde(skip)] pub(crate) show_settings_ui: bool, - /// Storage for the state of each `SpaceView` + /// Storage for the state of each `View` /// /// This is stored here for simplicity. An exclusive reference for that is passed to the users, /// such as [`ViewportUi`] and [`re_selection_panel::SelectionPanel`]. @@ -146,7 +146,7 @@ impl AppState { store_context: &StoreContext<'_>, reflection: &re_types_core::reflection::Reflection, component_ui_registry: &ComponentUiRegistry, - space_view_class_registry: &SpaceViewClassRegistry, + view_class_registry: &ViewClassRegistry, rx: &ReceiveSet, command_sender: &CommandSender, welcome_screen_state: &WelcomeScreenState, @@ -214,36 +214,34 @@ impl AppState { )), ); - let applicable_entities_per_visualizer = space_view_class_registry - .applicable_entities_for_visualizer_systems(&recording.store_id()); + let applicable_entities_per_visualizer = + view_class_registry.applicable_entities_for_visualizer_systems(&recording.store_id()); let indicated_entities_per_visualizer = - space_view_class_registry.indicated_entities_per_visualizer(&recording.store_id()); + view_class_registry.indicated_entities_per_visualizer(&recording.store_id()); - // Execute the queries for every `SpaceView` + // Execute the queries for every `View` let mut query_results = { re_tracing::profile_scope!("query_results"); viewport_ui .blueprint - .space_views + .views .values() - .map(|space_view| { - // TODO(andreas): This needs to be done in a store subscriber that exists per space view (instance, not class!). + .map(|view| { + // TODO(andreas): This needs to be done in a store subscriber that exists per view (instance, not class!). // Note that right now we determine *all* visualizable entities, not just the queried ones. // In a store subscriber set this is fine, but on a per-frame basis it's wasteful. - let visualizable_entities = space_view - .class(space_view_class_registry) + let visualizable_entities = view + .class(view_class_registry) .determine_visualizable_entities( &applicable_entities_per_visualizer, recording, - &space_view_class_registry - .new_visualizer_collection(space_view.class_identifier()), - &space_view.space_origin, + &view_class_registry.new_visualizer_collection(view.class_identifier()), + &view.space_origin, ); ( - space_view.id, - space_view - .contents + view.id, + view.contents .execute_query(store_context, &visualizable_entities), ) }) @@ -256,7 +254,7 @@ impl AppState { let ctx = ViewerContext { app_options, cache: store_context.caches, - space_view_class_registry, + view_class_registry, reflection, component_ui_registry, store_context, @@ -283,24 +281,23 @@ impl AppState { { re_tracing::profile_scope!("updated_query_results"); - for space_view in viewport_ui.blueprint.space_views.values() { - if let Some(query_result) = query_results.get_mut(&space_view.id) { - // TODO(andreas): This needs to be done in a store subscriber that exists per space view (instance, not class!). + for view in viewport_ui.blueprint.views.values() { + if let Some(query_result) = query_results.get_mut(&view.id) { + // TODO(andreas): This needs to be done in a store subscriber that exists per view (instance, not class!). // Note that right now we determine *all* visualizable entities, not just the queried ones. // In a store subscriber set this is fine, but on a per-frame basis it's wasteful. - let visualizable_entities = space_view - .class(space_view_class_registry) + let visualizable_entities = view + .class(view_class_registry) .determine_visualizable_entities( &applicable_entities_per_visualizer, recording, - &space_view_class_registry - .new_visualizer_collection(space_view.class_identifier()), - &space_view.space_origin, + &view_class_registry.new_visualizer_collection(view.class_identifier()), + &view.space_origin, ); - let resolver = space_view.contents.build_resolver( - space_view_class_registry, - space_view, + let resolver = view.contents.build_resolver( + view_class_registry, + view, &applicable_entities_per_visualizer, &visualizable_entities, &indicated_entities_per_visualizer, @@ -310,7 +307,7 @@ impl AppState { store_context.blueprint, &blueprint_query, rec_cfg.time_ctrl.read().timeline(), - space_view_class_registry, + view_class_registry, query_result, view_states, ); @@ -328,7 +325,7 @@ impl AppState { let ctx = ViewerContext { app_options, cache: store_context.caches, - space_view_class_registry, + view_class_registry, reflection, component_ui_registry, store_context, @@ -508,10 +505,10 @@ impl AppState { // Other UI things // - add_space_view_or_container_modal_ui(&ctx, &viewport_ui.blueprint, ui); + add_view_or_container_modal_ui(&ctx, &viewport_ui.blueprint, ui); // Process deferred layout operations and apply updates back to blueprint: - viewport_ui.save_to_blueprint_store(&ctx, space_view_class_registry); + viewport_ui.save_to_blueprint_store(&ctx, view_class_registry); if WATERMARK { ui.ctx().paint_watermark(); diff --git a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs index 0e307fbc746b..bed35cf8a280 100644 --- a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs +++ b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs @@ -23,22 +23,22 @@ pub use re_types::blueprint::components::PanelState; pub use re_types::blueprint::components::QueryExpression; pub use re_types::blueprint::components::RowShare; pub use re_types::blueprint::components::SelectedColumns; -pub use re_types::blueprint::components::SpaceViewClass; -pub use re_types::blueprint::components::SpaceViewOrigin; pub use re_types::blueprint::components::TensorDimensionIndexSlider; pub use re_types::blueprint::components::TimelineName; +pub use re_types::blueprint::components::ViewClass; pub use re_types::blueprint::components::ViewFit; +pub use re_types::blueprint::components::ViewOrigin; pub use re_types::blueprint::components::ViewerRecommendationHash; pub use re_types::blueprint::components::Visible; pub use re_types::blueprint::components::VisibleTimeRange; pub use re_types::blueprint::components::VisualBounds2D; pub use re_types::blueprint::components::ZoomLevel; pub use re_types_blueprint::blueprint::components::AutoLayout; -pub use re_types_blueprint::blueprint::components::AutoSpaceViews; +pub use re_types_blueprint::blueprint::components::AutoViews; pub use re_types_blueprint::blueprint::components::ContainerKind; pub use re_types_blueprint::blueprint::components::GridColumns; pub use re_types_blueprint::blueprint::components::RootContainer; -pub use re_types_blueprint::blueprint::components::SpaceViewMaximized; +pub use re_types_blueprint::blueprint::components::ViewMaximized; pub use re_types_blueprint::blueprint::components::VisualizerOverrides; /// Because blueprints are both read and written the schema must match what @@ -48,7 +48,7 @@ pub fn is_valid_blueprint(blueprint: &EntityDb) -> bool { validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) - && validate_component::(blueprint) + && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) @@ -72,12 +72,12 @@ pub fn is_valid_blueprint(blueprint: &EntityDb) -> bool { && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) - && validate_component::(blueprint) - && validate_component::(blueprint) - && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) + && validate_component::(blueprint) && validate_component::(blueprint) + && validate_component::(blueprint) + && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) diff --git a/crates/viewer/re_viewer/src/reflection/mod.rs b/crates/viewer/re_viewer/src/reflection/mod.rs index 72dd45c8db17..de51ce63624a 100644 --- a/crates/viewer/re_viewer/src/reflection/mod.rs +++ b/crates/viewer/re_viewer/src/reflection/mod.rs @@ -59,11 +59,11 @@ fn generate_component_reflection() -> Result::name(), + ::name(), ComponentReflection { - docstring_md: "Whether or not space views should be created automatically.", - custom_placeholder: Some(AutoSpaceViews::default().to_arrow2()?), - datatype: AutoSpaceViews::arrow2_datatype(), + docstring_md: "Whether or not views should be created automatically.", + custom_placeholder: Some(AutoViews::default().to_arrow2()?), + datatype: AutoViews::arrow2_datatype(), }, ), ( @@ -223,7 +223,7 @@ fn generate_component_reflection() -> Result::name(), ComponentReflection { - docstring_md: "An individual query expression used to filter a set of [`datatypes.EntityPath`](https://rerun.io/docs/reference/types/datatypes/entity_path)s.\n\nEach expression is either an inclusion or an exclusion expression.\nInclusions start with an optional `+` and exclusions must start with a `-`.\n\nMultiple expressions are combined together as part of `SpaceViewContents`.\n\nThe `/**` suffix matches the whole subtree, i.e. self and any child, recursively\n(`/world/**` matches both `/world` and `/world/car/driver`).\nOther uses of `*` are not (yet) supported.", + docstring_md: "An individual query expression used to filter a set of [`datatypes.EntityPath`](https://rerun.io/docs/reference/types/datatypes/entity_path)s.\n\nEach expression is either an inclusion or an exclusion expression.\nInclusions start with an optional `+` and exclusions must start with a `-`.\n\nMultiple expressions are combined together as part of [`archetypes.ViewContents`](https://rerun.io/docs/reference/types/archetypes/view_contents).\n\nThe `/**` suffix matches the whole subtree, i.e. self and any child, recursively\n(`/world/**` matches both `/world` and `/world/car/driver`).\nOther uses of `*` are not (yet) supported.", custom_placeholder: Some(QueryExpression::default().to_arrow2()?), datatype: QueryExpression::arrow2_datatype(), }, @@ -252,30 +252,6 @@ fn generate_component_reflection() -> Result::name(), - ComponentReflection { - docstring_md: "The class identifier of view, e.g. `\"2D\"`, `\"TextLog\"`, ….", - custom_placeholder: Some(SpaceViewClass::default().to_arrow2()?), - datatype: SpaceViewClass::arrow2_datatype(), - }, - ), - ( - ::name(), - ComponentReflection { - docstring_md: "Whether a space view is maximized.", - custom_placeholder: Some(SpaceViewMaximized::default().to_arrow2()?), - datatype: SpaceViewMaximized::arrow2_datatype(), - }, - ), - ( - ::name(), - ComponentReflection { - docstring_md: "The origin of a `SpaceView`.", - custom_placeholder: Some(SpaceViewOrigin::default().to_arrow2()?), - datatype: SpaceViewOrigin::arrow2_datatype(), - }, - ), ( ::name(), ComponentReflection { @@ -294,6 +270,14 @@ fn generate_component_reflection() -> Result::name(), + ComponentReflection { + docstring_md: "The class identifier of view, e.g. `\"2D\"`, `\"TextLog\"`, ….", + custom_placeholder: Some(ViewClass::default().to_arrow2()?), + datatype: ViewClass::arrow2_datatype(), + }, + ), ( ::name(), ComponentReflection { @@ -302,6 +286,22 @@ fn generate_component_reflection() -> Result::name(), + ComponentReflection { + docstring_md: "Whether a view is maximized.", + custom_placeholder: Some(ViewMaximized::default().to_arrow2()?), + datatype: ViewMaximized::arrow2_datatype(), + }, + ), + ( + ::name(), + ComponentReflection { + docstring_md: "The origin of a view.", + custom_placeholder: Some(ViewOrigin::default().to_arrow2()?), + datatype: ViewOrigin::arrow2_datatype(), + }, + ), ( ::name(), ComponentReflection { @@ -435,7 +435,7 @@ fn generate_component_reflection() -> Result::name(), ComponentReflection { - docstring_md: "Spatially disconnect this entity from its parent.\n\nSpecifies that the entity path at which this is logged is spatially disconnected from its parent,\nmaking it impossible to transform the entity path into its parent's space and vice versa.\nIt *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views.\nThis is useful for specifying that a subgraph is independent of the rest of the scene.", + docstring_md: "Spatially disconnect this entity from its parent.\n\nSpecifies that the entity path at which this is logged is spatially disconnected from its parent,\nmaking it impossible to transform the entity path into its parent's space and vice versa.\nIt *only* applies to views that work with spatial transformations, i.e. 2D & 3D views.\nThis is useful for specifying that a subgraph is independent of the rest of the scene.", custom_placeholder: Some(DisconnectedSpace::default().to_arrow2()?), datatype: DisconnectedSpace::arrow2_datatype(), }, @@ -1931,7 +1931,7 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeFieldReflection { component_name : "rerun.blueprint.components.IncludedContent".into(), display_name : "Contents", docstring_md : - "`ContainerId`s or `SpaceViewId`s that are children of this container.", + "`ContainerId`s or `ViewId`s that are children of this container.", is_required : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.ColumnShare".into(), display_name : "Col shares", docstring_md : @@ -2185,44 +2185,6 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ], }, ), - ( - ArchetypeName::new("rerun.blueprint.archetypes.SpaceViewBlueprint"), - ArchetypeReflection { - display_name: "Space view blueprint", - view_types: &[], - fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.SpaceViewClass".into(), display_name : - "Class identifier", docstring_md : "The class of the view.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Name".into(), display_name : "Display name", - docstring_md : "The name of the view.", is_required : false, }, - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.SpaceViewOrigin".into(), display_name : - "Space origin", docstring_md : - "The \"anchor point\" of this space view.\n\nDefaults to the root path '/' if not specified.\n\nThe transform at this path forms the reference point for all scene->world transforms in this space view.\nI.e. the position of this entity path in space forms the origin of the coordinate system in this space view.\nFurthermore, this is the primary indicator for heuristics on what entities we show in this space view.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Visible".into(), display_name : - "Visible", docstring_md : - "Whether this space view is visible.\n\nDefaults to true if not specified.", - is_required : false, }, - ], - }, - ), - ( - ArchetypeName::new("rerun.blueprint.archetypes.SpaceViewContents"), - ArchetypeReflection { - display_name: "Space view contents", - view_types: &[], - fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.QueryExpression".into(), display_name : - "Query", docstring_md : - "The `QueryExpression` that populates the contents for the `SpaceView`.\n\nThey determine which entities are part of the spaceview.", - is_required : false, }, - ], - }, - ), ( ArchetypeName::new("rerun.blueprint.archetypes.TensorScalarMapping"), ArchetypeReflection { @@ -2283,6 +2245,44 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ], }, ), + ( + ArchetypeName::new("rerun.blueprint.archetypes.ViewBlueprint"), + ArchetypeReflection { + display_name: "View blueprint", + view_types: &[], + fields: vec![ + ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.ViewClass".into(), display_name : + "Class identifier", docstring_md : "The class of the view.", + is_required : true, }, ArchetypeFieldReflection { component_name : + "rerun.components.Name".into(), display_name : "Display name", + docstring_md : "The name of the view.", is_required : false, }, + ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.ViewOrigin".into(), display_name : + "Space origin", docstring_md : + "The \"anchor point\" of this view.\n\nDefaults to the root path '/' if not specified.\n\nThe transform at this path forms the reference point for all scene->world transforms in this view.\nI.e. the position of this entity path in space forms the origin of the coordinate system in this view.\nFurthermore, this is the primary indicator for heuristics on what entities we show in this view.", + is_required : false, }, ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.Visible".into(), display_name : + "Visible", docstring_md : + "Whether this view is visible.\n\nDefaults to true if not specified.", + is_required : false, }, + ], + }, + ), + ( + ArchetypeName::new("rerun.blueprint.archetypes.ViewContents"), + ArchetypeReflection { + display_name: "View contents", + view_types: &[], + fields: vec![ + ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.QueryExpression".into(), display_name : + "Query", docstring_md : + "The `QueryExpression` that populates the contents for the view.\n\nThey determine which entities are part of the view.", + is_required : false, }, + ], + }, + ), ( ArchetypeName::new("rerun.blueprint.archetypes.ViewportBlueprint"), ArchetypeReflection { @@ -2291,22 +2291,22 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { fields: vec![ ArchetypeFieldReflection { component_name : "rerun.blueprint.components.RootContainer".into(), display_name : - "Root container", docstring_md : "The layout of the space-views", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.SpaceViewMaximized".into(), display_name - : "Maximized", docstring_md : "Show one tab as maximized?", + "Root container", docstring_md : "The layout of the views", is_required : false, }, ArchetypeFieldReflection { component_name : + "rerun.blueprint.components.ViewMaximized".into(), display_name : + "Maximized", docstring_md : "Show one tab as maximized?", is_required + : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.AutoLayout".into(), display_name : "Auto layout", docstring_md : - "Whether the viewport layout is determined automatically.\n\nIf `true`, the container layout will be reset whenever a new space view is added or removed.\nThis defaults to `false` and is automatically set to `false` when there is user determined layout.", + "Whether the viewport layout is determined automatically.\n\nIf `true`, the container layout will be reset whenever a new view is added or removed.\nThis defaults to `false` and is automatically set to `false` when there is user determined layout.", is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.AutoSpaceViews".into(), display_name : - "Auto space views", docstring_md : - "Whether or not space views should be created automatically.\n\nIf `true`, the viewer will only add space views that it hasn't considered previously (as identified by `past_viewer_recommendations`)\nand which aren't deemed redundant to existing space views.\nThis defaults to `false` and is automatically set to `false` when the user adds space views manually in the viewer.", + "rerun.blueprint.components.AutoViews".into(), display_name : + "Auto views", docstring_md : + "Whether or not views should be created automatically.\n\nIf `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`)\nand which aren't deemed redundant to existing views.\nThis defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer.", is_required : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.ViewerRecommendationHash".into(), display_name : "Past viewer recommendations", docstring_md : - "Hashes of all recommended space views the viewer has already added and that should not be added again.\n\nThis is an internal field and should not be set usually.\nIf you want the viewer from stopping to add space views, you should set `auto_space_views` to `false`.\n\nThe viewer uses this to determine whether it should keep adding space views.", + "Hashes of all recommended views the viewer has already added and that should not be added again.\n\nThis is an internal field and should not be set usually.\nIf you want the viewer from stopping to add views, you should set `auto_views` to `false`.\n\nThe viewer uses this to determine whether it should keep adding views.", is_required : false, }, ], }, diff --git a/crates/viewer/re_viewer_context/README.md b/crates/viewer/re_viewer_context/README.md index 7edbbaaf7fde..fa3ef603ddc5 100644 --- a/crates/viewer/re_viewer_context/README.md +++ b/crates/viewer/re_viewer_context/README.md @@ -2,8 +2,8 @@ Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. -[![Latest version](https://img.shields.io/crates/v/re_viewer_context.svg)](https://crates.io/crates/viewer/re_viewer_context) -[![Documentation](https://docs.rs/re_viewer_context/badge.svg)](https://docs.rs/re_viewer_context) +[![Latest version](https://img.shields.io/crates/v/re_viewer_context.svg)](https://crates.io/crates/viewer/re_viewer_context?speculative-link) +[![Documentation](https://docs.rs/re_viewer_context/badge.svg)](https://docs.rs/re_viewer_context?speculative-link) ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) diff --git a/crates/viewer/re_viewer_context/src/blueprint_id.rs b/crates/viewer/re_viewer_context/src/blueprint_id.rs index b7be9a4a1767..4ebf54d2ccb4 100644 --- a/crates/viewer/re_viewer_context/src/blueprint_id.rs +++ b/crates/viewer/re_viewer_context/src/blueprint_id.rs @@ -175,7 +175,7 @@ macro_rules! define_blueprint_id_type { // ---------------------------------------------------------------------------- // Definitions for the different [`BlueprintId`] types. -define_blueprint_id_type!(SpaceViewId, SpaceViewIdRegistry, "space_view"); +define_blueprint_id_type!(ViewId, ViewIdRegistry, "view"); define_blueprint_id_type!(ContainerId, ContainerIdRegistry, "container"); // ---------------------------------------------------------------------------- @@ -186,9 +186,9 @@ mod tests { #[test] fn test_blueprint_id() { - let id = SpaceViewId::random(); + let id = ViewId::random(); let path = id.as_entity_path(); - assert!(path.is_child_of(&EntityPath::parse_forgiving("space_view/"))); + assert!(path.is_child_of(&EntityPath::parse_forgiving("view/"))); let id = ContainerId::random(); let path = id.as_entity_path(); @@ -197,7 +197,7 @@ mod tests { let roundtrip = ContainerId::from_entity_path(&id.as_entity_path()); assert_eq!(roundtrip, id); - let crossed = ContainerId::from_entity_path(&SpaceViewId::random().as_entity_path()); + let crossed = ContainerId::from_entity_path(&ViewId::random().as_entity_path()); assert_eq!(crossed, ContainerId::invalid()); } } diff --git a/crates/viewer/re_viewer_context/src/collapsed_id.rs b/crates/viewer/re_viewer_context/src/collapsed_id.rs index 6c5e3e7a8a39..9358c8ddc5cc 100644 --- a/crates/viewer/re_viewer_context/src/collapsed_id.rs +++ b/crates/viewer/re_viewer_context/src/collapsed_id.rs @@ -5,7 +5,7 @@ use std::hash::Hash; use re_log_types::EntityPath; -use crate::{ContainerId, SpaceViewId}; +use crate::{ContainerId, ViewId}; /// The various scopes for which we want to track collapsed state. #[derive(Debug, Clone, Copy, Hash)] @@ -34,18 +34,18 @@ impl CollapseScope { } } - /// Create a [`CollapsedId`] for a space view in this scope. - pub fn space_view(self, space_view_id: SpaceViewId) -> CollapsedId { + /// Create a [`CollapsedId`] for a view in this scope. + pub fn view(self, view_id: ViewId) -> CollapsedId { CollapsedId { - item: CollapseItem::SpaceView(space_view_id), + item: CollapseItem::View(view_id), scope: self, } } /// Create a [`CollapsedId`] for a data result in this scope. - pub fn data_result(self, space_view_id: SpaceViewId, entity_path: EntityPath) -> CollapsedId { + pub fn data_result(self, view_id: ViewId, entity_path: EntityPath) -> CollapsedId { CollapsedId { - item: CollapseItem::DataResult(space_view_id, entity_path), + item: CollapseItem::DataResult(view_id, entity_path), scope: self, } } @@ -64,8 +64,8 @@ impl CollapseScope { #[derive(Debug, Clone, Hash)] pub enum CollapseItem { Container(ContainerId), - SpaceView(SpaceViewId), - DataResult(SpaceViewId, EntityPath), + View(ViewId), + DataResult(ViewId, EntityPath), Entity(EntityPath), } diff --git a/crates/viewer/re_viewer_context/src/component_fallbacks.rs b/crates/viewer/re_viewer_context/src/component_fallbacks.rs index 59993c6680db..fba8527b51f0 100644 --- a/crates/viewer/re_viewer_context/src/component_fallbacks.rs +++ b/crates/viewer/re_viewer_context/src/component_fallbacks.rs @@ -35,7 +35,7 @@ pub enum ComponentFallbackError { UnexpectedEmptyFallback, } -/// Provides fallback values for components, implemented typically by [`crate::SpaceViewClass`] and [`crate::VisualizerSystem`]. +/// Provides fallback values for components, implemented typically by [`crate::ViewClass`] and [`crate::VisualizerSystem`]. /// /// Fallbacks can be based on arbitrarily complex & context sensitive heuristics. pub trait ComponentFallbackProvider { diff --git a/crates/viewer/re_viewer_context/src/contents.rs b/crates/viewer/re_viewer_context/src/contents.rs index a0c0d8626f42..558fbe8ad941 100644 --- a/crates/viewer/re_viewer_context/src/contents.rs +++ b/crates/viewer/re_viewer_context/src/contents.rs @@ -5,18 +5,18 @@ use egui_tiles::TileId; use re_log_types::EntityPath; use crate::item::Item; -use crate::{BlueprintId, BlueprintIdRegistry, ContainerId, SpaceViewId}; +use crate::{BlueprintId, BlueprintIdRegistry, ContainerId, ViewId}; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Contents { Container(ContainerId), - SpaceView(SpaceViewId), + View(ViewId), } impl Contents { pub fn try_from(path: &EntityPath) -> Option { - if path.starts_with(SpaceViewId::registry()) { - Some(Self::SpaceView(SpaceViewId::from_entity_path(path))) + if path.starts_with(ViewId::registry()) { + Some(Self::View(ViewId::from_entity_path(path))) } else if path.starts_with(ContainerId::registry()) { Some(Self::Container(ContainerId::from_entity_path(path))) } else { @@ -28,7 +28,7 @@ impl Contents { pub fn as_entity_path(&self) -> EntityPath { match self { Self::Container(id) => id.as_entity_path(), - Self::SpaceView(id) => id.as_entity_path(), + Self::View(id) => id.as_entity_path(), } } @@ -36,7 +36,7 @@ impl Contents { pub fn as_tile_id(&self) -> TileId { match self { Self::Container(id) => blueprint_id_to_tile_id(id), - Self::SpaceView(id) => blueprint_id_to_tile_id(id), + Self::View(id) => blueprint_id_to_tile_id(id), } } @@ -44,7 +44,7 @@ impl Contents { pub fn as_item(&self) -> Item { match self { Self::Container(container_id) => Item::Container(*container_id), - Self::SpaceView(space_view_id) => Item::SpaceView(*space_view_id), + Self::View(view_id) => Item::View(*view_id), } } @@ -52,14 +52,14 @@ impl Contents { pub fn as_container_id(&self) -> Option { match self { Self::Container(id) => Some(*id), - Self::SpaceView(_) => None, + Self::View(_) => None, } } #[inline] - pub fn as_space_view_id(&self) -> Option { + pub fn as_view_id(&self) -> Option { match self { - Self::SpaceView(id) => Some(*id), + Self::View(id) => Some(*id), Self::Container(_) => None, } } @@ -79,16 +79,16 @@ impl TryFrom<&Item> for Contents { fn try_from(item: &Item) -> Result { match item { Item::Container(id) => Ok(Self::Container(*id)), - Item::SpaceView(id) => Ok(Self::SpaceView(*id)), + Item::View(id) => Ok(Self::View(*id)), _ => Err(()), } } } -impl From for Contents { +impl From for Contents { #[inline] - fn from(id: SpaceViewId) -> Self { - Self::SpaceView(id) + fn from(id: ViewId) -> Self { + Self::View(id) } } diff --git a/crates/viewer/re_viewer_context/src/item.rs b/crates/viewer/re_viewer_context/src/item.rs index a8bf7ee1863c..6dec4f817629 100644 --- a/crates/viewer/re_viewer_context/src/item.rs +++ b/crates/viewer/re_viewer_context/src/item.rs @@ -2,7 +2,7 @@ use re_entity_db::{EntityDb, InstancePath}; use re_log_types::{ComponentPath, DataPath, EntityPath}; use re_types::ComponentDescriptor; -use crate::{ContainerId, Contents, SpaceViewId}; +use crate::{ContainerId, Contents, ViewId}; /// One "thing" in the UI. /// @@ -27,11 +27,11 @@ pub enum Item { /// A viewport container. Container(ContainerId), - /// A viwport space view. - SpaceView(SpaceViewId), + /// A viwport view. + View(ViewId), - /// An entity or instance in the context of a space view's data results. - DataResult(SpaceViewId, InstancePath), + /// An entity or instance in the context of a view's data results. + DataResult(ViewId, InstancePath), } impl Item { @@ -39,7 +39,7 @@ impl Item { match self { Self::AppId(_) | Self::DataSource(_) - | Self::SpaceView(_) + | Self::View(_) | Self::Container(_) | Self::StoreId(_) => None, @@ -52,10 +52,10 @@ impl Item { } } -impl From for Item { +impl From for Item { #[inline] - fn from(space_view_id: SpaceViewId) -> Self { - Self::SpaceView(space_view_id) + fn from(view_id: ViewId) -> Self { + Self::View(view_id) } } @@ -85,7 +85,7 @@ impl From for Item { fn from(contents: Contents) -> Self { match contents { Contents::Container(container_id) => Self::Container(container_id), - Contents::SpaceView(space_view_id) => Self::SpaceView(space_view_id), + Contents::View(view_id) => Self::View(view_id), } } } @@ -125,10 +125,10 @@ impl std::fmt::Debug for Item { Self::DataSource(data_source) => data_source.fmt(f), Self::StoreId(store_id) => store_id.fmt(f), Self::ComponentPath(s) => s.fmt(f), - Self::SpaceView(s) => write!(f, "{s:?}"), + Self::View(s) => write!(f, "{s:?}"), Self::InstancePath(path) => write!(f, "{path}"), - Self::DataResult(space_view_id, instance_path) => { - write!(f, "({space_view_id:?}, {instance_path}") + Self::DataResult(view_id, instance_path) => { + write!(f, "({view_id:?}, {instance_path}") } Self::Container(tile_id) => write!(f, "(tile: {tile_id:?})"), } @@ -146,7 +146,7 @@ impl Item { }, Self::InstancePath(instance_path) => instance_path.kind(), Self::ComponentPath(_) => "Entity component", - Self::SpaceView(_) => "View", + Self::View(_) => "View", Self::Container(_) => "Container", Self::DataResult(_, instance_path) => { if instance_path.instance.is_specific() { @@ -170,15 +170,15 @@ pub fn resolve_mono_instance_path_item( Item::InstancePath(instance_path) => { Item::InstancePath(resolve_mono_instance_path(entity_db, query, instance_path)) } - Item::DataResult(space_view_id, instance_path) => Item::DataResult( - *space_view_id, + Item::DataResult(view_id, instance_path) => Item::DataResult( + *view_id, resolve_mono_instance_path(entity_db, query, instance_path), ), Item::AppId(_) | Item::DataSource(_) | Item::StoreId(_) | Item::ComponentPath(_) - | Item::SpaceView(_) + | Item::View(_) | Item::Container(_) => item.clone(), } } diff --git a/crates/viewer/re_viewer_context/src/lib.rs b/crates/viewer/re_viewer_context/src/lib.rs index d52ce46456b5..2a1c89fde387 100644 --- a/crates/viewer/re_viewer_context/src/lib.rs +++ b/crates/viewer/re_viewer_context/src/lib.rs @@ -20,7 +20,6 @@ mod maybe_mut_ref; mod query_context; mod query_range; mod selection_state; -mod space_view; mod store_context; pub mod store_hub; mod tensor; @@ -30,6 +29,7 @@ mod time_drag_value; mod typed_entity_collections; mod undo; mod utils; +mod view; mod viewer_context; // TODO(andreas): Move to its own crate? @@ -39,7 +39,7 @@ pub use self::{ annotations::{AnnotationMap, Annotations, ResolvedAnnotationInfo, ResolvedAnnotationInfos}, app_options::AppOptions, blueprint_helpers::{blueprint_timeline, blueprint_timepoint_for_writes}, - blueprint_id::{BlueprintId, BlueprintIdRegistry, ContainerId, SpaceViewId}, + blueprint_id::{BlueprintId, BlueprintIdRegistry, ContainerId, ViewId}, cache::{Cache, Caches, ImageDecodeCache, ImageStatsCache, TensorStatsCache, VideoCache}, collapsed_id::{CollapseItem, CollapseScope, CollapsedId}, command_sender::{ @@ -64,18 +64,6 @@ pub use self::{ ApplicationSelectionState, HoverHighlight, InteractionHighlight, ItemCollection, ItemSpaceContext, SelectionHighlight, }, - space_view::{ - DataResult, IdentifiedViewSystem, OptionalSpaceViewEntityHighlight, OverridePath, - PerSystemDataResults, PerSystemEntities, PropertyOverrides, RecommendedSpaceView, - SmallVisualizerSet, SpaceViewClass, SpaceViewClassExt, SpaceViewClassLayoutPriority, - SpaceViewClassRegistry, SpaceViewClassRegistryError, SpaceViewEntityHighlight, - SpaceViewHighlights, SpaceViewOutlineMasks, SpaceViewSpawnHeuristics, SpaceViewState, - SpaceViewStateExt, SpaceViewSystemExecutionError, SpaceViewSystemRegistrator, - SystemExecutionOutput, ViewContext, ViewContextCollection, ViewContextSystem, ViewQuery, - ViewStates, ViewSystemIdentifier, VisualizableFilterContext, - VisualizerAdditionalApplicabilityFilter, VisualizerCollection, VisualizerQueryInfo, - VisualizerSystem, - }, store_context::StoreContext, store_hub::StoreHub, tensor::{ImageStats, TensorStats}, @@ -86,6 +74,17 @@ pub use self::{ }, undo::BlueprintUndoState, utils::{auto_color_egui, auto_color_for_entity_path, level_to_rich_text}, + view::{ + DataResult, IdentifiedViewSystem, OptionalViewEntityHighlight, OverridePath, + PerSystemDataResults, PerSystemEntities, PropertyOverrides, RecommendedView, + SmallVisualizerSet, SystemExecutionOutput, ViewClass, ViewClassExt, + ViewClassLayoutPriority, ViewClassRegistry, ViewClassRegistryError, ViewContext, + ViewContextCollection, ViewContextSystem, ViewEntityHighlight, ViewHighlights, + ViewOutlineMasks, ViewQuery, ViewSpawnHeuristics, ViewState, ViewStateExt, ViewStates, + ViewSystemExecutionError, ViewSystemIdentifier, ViewSystemRegistrator, + VisualizableFilterContext, VisualizerAdditionalApplicabilityFilter, VisualizerCollection, + VisualizerQueryInfo, VisualizerSystem, + }, viewer_context::{RecordingConfig, ViewerContext}, }; @@ -121,7 +120,7 @@ pub fn icon_for_container_kind(kind: &egui_tiles::ContainerKind) -> &'static re_ } } -/// The style to use for displaying this space view name in the UI. +/// The style to use for displaying this view name in the UI. pub fn contents_name_style(name: &ContentsName) -> re_ui::LabelStyle { match name { ContentsName::Named(_) => re_ui::LabelStyle::Normal, @@ -138,7 +137,7 @@ pub struct ScreenshotInfo { pub ui_rect: Option, pub pixels_per_point: f32, - /// Name of the screenshot (e.g. space view name), excluding file extension. + /// Name of the screenshot (e.g. view name), excluding file extension. pub name: String, /// Where to put the screenshot. @@ -157,21 +156,21 @@ pub enum ScreenshotTarget { // ---------------------------------------------------------------------------------------- -/// Used to publish info aboutr each space view. +/// Used to publish info aboutr each view. /// -/// We use this for space-view screenshotting. +/// We use this for view screenshotting. /// /// Accessed with [`egui::Memory::caches`]. -pub type SpaceViewRectPublisher = egui::cache::FramePublisher; +pub type ViewRectPublisher = egui::cache::FramePublisher; -/// Information about a space view that is published each frame by [`SpaceViewRectPublisher`]. +/// Information about a view that is published each frame by [`ViewRectPublisher`]. #[derive(Clone, Debug)] -pub struct PublishedSpaceViewInfo { - /// Human-readable name of the space view. +pub struct PublishedViewInfo { + /// Human-readable name of the view. pub name: String, /// Where on screen (in ui coords). /// - /// NOTE: this can include a highlighted border of the space-view. + /// NOTE: this can include a highlighted border of the view. pub rect: egui::Rect, } diff --git a/crates/viewer/re_viewer_context/src/query_context.rs b/crates/viewer/re_viewer_context/src/query_context.rs index 82ce9cc01041..77202194cf30 100644 --- a/crates/viewer/re_viewer_context/src/query_context.rs +++ b/crates/viewer/re_viewer_context/src/query_context.rs @@ -5,7 +5,7 @@ use smallvec::SmallVec; use re_log_types::{EntityPath, EntityPathHash}; -use crate::{DataResult, SpaceViewId, SpaceViewState, ViewContext, ViewerContext}; +use crate::{DataResult, ViewContext, ViewId, ViewState, ViewerContext}; slotmap::new_key_type! { /// Identifier for a [`DataResultNode`] @@ -34,7 +34,7 @@ pub struct QueryContext<'a> { pub query: &'a re_chunk_store::LatestAtQuery, /// The view state of the view in which the query is executed. - pub view_state: &'a dyn SpaceViewState, + pub view_state: &'a dyn ViewState, /// The view context, if available. // TODO(jleibs): Make this non-optional. @@ -201,7 +201,7 @@ impl DataResultTree { static EMPTY_QUERY: Lazy = Lazy::::new(Default::default); impl ViewerContext<'_> { - pub fn lookup_query_result(&self, id: SpaceViewId) -> &DataQueryResult { + pub fn lookup_query_result(&self, id: ViewId) -> &DataQueryResult { self.query_results.get(&id).unwrap_or_else(|| { if cfg!(debug_assertions) { re_log::warn!("Tried looking up a query that doesn't exist: {:?}", id); diff --git a/crates/viewer/re_viewer_context/src/selection_state.rs b/crates/viewer/re_viewer_context/src/selection_state.rs index 202427cac510..e99457d9ad13 100644 --- a/crates/viewer/re_viewer_context/src/selection_state.rs +++ b/crates/viewer/re_viewer_context/src/selection_state.rs @@ -8,7 +8,7 @@ use crate::{item::resolve_mono_instance_path_item, ViewerContext}; use super::Item; -/// Context information that a space view might attach to an item from [`ItemCollection`] and useful +/// Context information that a view might attach to an item from [`ItemCollection`] and useful /// for how a selection might be displayed and interacted with. #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)] pub enum ItemSpaceContext { @@ -45,7 +45,7 @@ pub enum SelectionHighlight { None, /// A closely related object is selected, should apply similar highlight to selection. - /// (e.g. data in a different space view) + /// (e.g. data in a different view) SiblingSelection, /// Should apply selection highlight (i.e. the exact selection is highlighted). @@ -340,14 +340,14 @@ impl ApplicationSelectionState { Item::AppId(_) | Item::DataSource(_) | Item::StoreId(_) - | Item::SpaceView(_) + | Item::View(_) | Item::Container(_) => current == test, Item::ComponentPath(component_path) => match test { Item::AppId(_) | Item::DataSource(_) | Item::StoreId(_) - | Item::SpaceView(_) + | Item::View(_) | Item::Container(_) => false, Item::ComponentPath(test_component_path) => { @@ -368,7 +368,7 @@ impl ApplicationSelectionState { | Item::DataSource(_) | Item::StoreId(_) | Item::ComponentPath(_) - | Item::SpaceView(_) + | Item::View(_) | Item::Container(_) => false, Item::InstancePath(test_instance_path) @@ -381,12 +381,12 @@ impl ApplicationSelectionState { } }, - Item::DataResult(_current_space_view_id, current_instance_path) => match test { + Item::DataResult(_current_view_id, current_instance_path) => match test { Item::AppId(_) | Item::DataSource(_) | Item::StoreId(_) | Item::ComponentPath(_) - | Item::SpaceView(_) + | Item::View(_) | Item::Container(_) => false, Item::InstancePath(test_instance_path) diff --git a/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs b/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs deleted file mode 100644 index 40ddb42900c1..000000000000 --- a/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs +++ /dev/null @@ -1,78 +0,0 @@ -use re_types::SpaceViewClassIdentifier; -use re_ui::UiExt; - -use crate::{ - SpaceViewClass, SpaceViewClassRegistryError, SpaceViewSpawnHeuristics, SpaceViewState, - SpaceViewSystemExecutionError, SpaceViewSystemRegistrator, SystemExecutionOutput, ViewQuery, - ViewerContext, -}; - -/// A placeholder space view class that can be used when the actual class is not registered. -#[derive(Default)] -pub struct SpaceViewClassPlaceholder; - -impl SpaceViewClass for SpaceViewClassPlaceholder { - fn identifier() -> SpaceViewClassIdentifier { - "UnknownSpaceViewClass".into() - } - - fn display_name(&self) -> &'static str { - "Unknown space view class" - } - - fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_UNKNOWN - } - - fn help_markdown(&self, _egui_ctx: &egui::Context) -> String { - "Placeholder view for unknown space view class".to_owned() - } - - fn on_register( - &self, - _system_registry: &mut SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { - Ok(()) - } - - fn new_state(&self) -> Box { - Box::<()>::default() - } - - fn layout_priority(&self) -> crate::SpaceViewClassLayoutPriority { - crate::SpaceViewClassLayoutPriority::Low - } - - fn spawn_heuristics(&self, _ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics { - SpaceViewSpawnHeuristics::empty() - } - - fn ui( - &self, - _ctx: &ViewerContext<'_>, - ui: &mut egui::Ui, - _state: &mut dyn SpaceViewState, - _query: &ViewQuery<'_>, - _system_output: SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { - egui::Frame { - inner_margin: egui::Margin::same(re_ui::DesignTokens::view_padding()), - ..Default::default() - } - .show(ui, |ui| { - ui.warning_label("Unknown space view class"); - - ui.markdown_ui( - "This happens if either the blueprint specifies an invalid space view class or \ - this version of the viewer does not know about this type.\n\n\ - \ - **Note**: some views may require a specific Cargo feature to be enabled. In \ - particular, the map view requires the `map_view` feature.", - ); - }); - - Ok(()) - } -} - -crate::impl_component_fallback_provider!(SpaceViewClassPlaceholder => []); diff --git a/crates/viewer/re_viewer_context/src/space_view/view_states.rs b/crates/viewer/re_viewer_context/src/space_view/view_states.rs deleted file mode 100644 index bf1690d09e45..000000000000 --- a/crates/viewer/re_viewer_context/src/space_view/view_states.rs +++ /dev/null @@ -1,38 +0,0 @@ -//! Storage for the state of each `SpaceView`. -//! -//! The `Viewer` has ownership of this state and pass it around to users (mainly viewport and -//! selection panel). - -use ahash::HashMap; - -use crate::{SpaceViewClass, SpaceViewId, SpaceViewState}; - -/// State for the `SpaceView`s that persists across frames but otherwise -/// is not saved. -#[derive(Default)] -pub struct ViewStates { - states: HashMap>, -} - -impl ViewStates { - pub fn get(&self, space_view_id: SpaceViewId) -> Option<&dyn SpaceViewState> { - self.states.get(&space_view_id).map(|s| s.as_ref()) - } - - pub fn get_mut_or_create( - &mut self, - view_id: SpaceViewId, - view_class: &dyn SpaceViewClass, - ) -> &mut dyn SpaceViewState { - self.states - .entry(view_id) - .or_insert_with(|| view_class.new_state()) - .as_mut() - } - - pub fn ensure_state_exists(&mut self, view_id: SpaceViewId, view_class: &dyn SpaceViewClass) { - self.states - .entry(view_id) - .or_insert_with(|| view_class.new_state()); - } -} diff --git a/crates/viewer/re_viewer_context/src/test_context.rs b/crates/viewer/re_viewer_context/src/test_context.rs index c2c75e74babb..6784ebf54657 100644 --- a/crates/viewer/re_viewer_context/src/test_context.rs +++ b/crates/viewer/re_viewer_context/src/test_context.rs @@ -6,7 +6,7 @@ use re_log_types::{StoreId, StoreKind}; use crate::{ blueprint_timeline, command_channel, ApplicationSelectionState, CommandReceiver, CommandSender, - ComponentUiRegistry, RecordingConfig, SpaceViewClassRegistry, StoreContext, SystemCommand, + ComponentUiRegistry, RecordingConfig, StoreContext, SystemCommand, ViewClassRegistry, ViewerContext, }; @@ -25,7 +25,7 @@ use crate::{ pub struct TestContext { pub recording_store: EntityDb, pub blueprint_store: EntityDb, - pub space_view_class_registry: SpaceViewClassRegistry, + pub view_class_registry: ViewClassRegistry, pub selection_state: ApplicationSelectionState, pub recording_config: RecordingConfig, @@ -54,7 +54,7 @@ impl Default for TestContext { Self { recording_store, blueprint_store, - space_view_class_registry: Default::default(), + view_class_registry: Default::default(), selection_state: Default::default(), recording_config, blueprint_query, @@ -95,7 +95,7 @@ impl TestContext { cache: &Default::default(), reflection: &Default::default(), component_ui_registry: &self.component_ui_registry, - space_view_class_registry: &self.space_view_class_registry, + view_class_registry: &self.view_class_registry, store_context: &store_context, applicable_entities_per_visualizer: &Default::default(), indicated_entities_per_visualizer: &Default::default(), diff --git a/crates/viewer/re_viewer_context/src/typed_entity_collections.rs b/crates/viewer/re_viewer_context/src/typed_entity_collections.rs index 189c1799e0ec..bceb841c9912 100644 --- a/crates/viewer/re_viewer_context/src/typed_entity_collections.rs +++ b/crates/viewer/re_viewer_context/src/typed_entity_collections.rs @@ -37,14 +37,14 @@ impl std::ops::Deref for IndicatedEntities { } /// List of entities that can be visualized at some point in time on any timeline -/// by a concrete visualizer in the context of a specific instantiated space view. +/// by a concrete visualizer in the context of a specific instantiated view. /// -/// It gets invalidated whenever any properties of the respective space view instance +/// It gets invalidated whenever any properties of the respective view instance /// change, e.g. its origin. -/// TODO(andreas): Unclear if any of the space view's configuring blueprint entities are included in this! +/// TODO(andreas): Unclear if any of the view's configuring blueprint entities are included in this! /// /// This is a subset of [`ApplicableEntities`] and differs on a -/// per space view instance base. +/// per view instance base. #[derive(Default, Clone)] pub struct VisualizableEntities(pub IntSet); diff --git a/crates/viewer/re_viewer_context/src/space_view/highlights.rs b/crates/viewer/re_viewer_context/src/view/highlights.rs similarity index 79% rename from crates/viewer/re_viewer_context/src/space_view/highlights.rs rename to crates/viewer/re_viewer_context/src/view/highlights.rs index b1bbf0fcba30..b90a287c71fb 100644 --- a/crates/viewer/re_viewer_context/src/space_view/highlights.rs +++ b/crates/viewer/re_viewer_context/src/view/highlights.rs @@ -6,16 +6,16 @@ use re_renderer::OutlineMaskPreference; use crate::{HoverHighlight, InteractionHighlight, SelectionHighlight}; -/// Highlights of a specific entity path in a specific space view. +/// Highlights of a specific entity path in a specific view. /// /// Using this in bulk on many instances is faster than querying single objects. #[derive(Default)] -pub struct SpaceViewEntityHighlight { +pub struct ViewEntityHighlight { overall: InteractionHighlight, instances: ahash::HashMap, } -impl SpaceViewEntityHighlight { +impl ViewEntityHighlight { /// Adds a new highlight to the entity highlight, combining it with existing highlights. #[inline] pub fn add(&mut self, instance: &InstancePath, highlight: InteractionHighlight) { @@ -53,9 +53,9 @@ impl SpaceViewEntityHighlight { } #[derive(Copy, Clone)] -pub struct OptionalSpaceViewEntityHighlight<'a>(Option<&'a SpaceViewEntityHighlight>); +pub struct OptionalViewEntityHighlight<'a>(Option<&'a ViewEntityHighlight>); -impl OptionalSpaceViewEntityHighlight<'_> { +impl OptionalViewEntityHighlight<'_> { #[inline] pub fn index_highlight(&self, instance: Instance) -> InteractionHighlight { match self.0 { @@ -71,12 +71,12 @@ impl OptionalSpaceViewEntityHighlight<'_> { } #[derive(Default)] -pub struct SpaceViewOutlineMasks { +pub struct ViewOutlineMasks { pub overall: OutlineMaskPreference, pub instances: ahash::HashMap, } -impl SpaceViewOutlineMasks { +impl ViewOutlineMasks { pub fn index_outline_mask(&self, instance: Instance) -> OutlineMaskPreference { self.instances .get(&instance) @@ -96,32 +96,32 @@ impl SpaceViewOutlineMasks { } } -/// Highlights in a specific space view. +/// Highlights in a specific view. /// /// Using this in bulk on many objects is faster than querying single objects. #[derive(Default)] -pub struct SpaceViewHighlights { - pub highlighted_entity_paths: IntMap, - pub outlines_masks: IntMap, +pub struct ViewHighlights { + pub highlighted_entity_paths: IntMap, + pub outlines_masks: IntMap, } -impl SpaceViewHighlights { +impl ViewHighlights { #[inline] pub fn entity_highlight( &self, entity_path_hash: EntityPathHash, - ) -> OptionalSpaceViewEntityHighlight<'_> { - OptionalSpaceViewEntityHighlight(self.highlighted_entity_paths.get(&entity_path_hash)) + ) -> OptionalViewEntityHighlight<'_> { + OptionalViewEntityHighlight(self.highlighted_entity_paths.get(&entity_path_hash)) } #[inline] - pub fn entity_outline_mask(&self, entity_path_hash: EntityPathHash) -> &SpaceViewOutlineMasks { + pub fn entity_outline_mask(&self, entity_path_hash: EntityPathHash) -> &ViewOutlineMasks { use std::sync::OnceLock; - static CELL: OnceLock = OnceLock::new(); + static CELL: OnceLock = OnceLock::new(); self.outlines_masks .get(&entity_path_hash) - .unwrap_or_else(|| CELL.get_or_init(SpaceViewOutlineMasks::default)) + .unwrap_or_else(|| CELL.get_or_init(ViewOutlineMasks::default)) } #[inline] diff --git a/crates/viewer/re_viewer_context/src/space_view/mod.rs b/crates/viewer/re_viewer_context/src/view/mod.rs similarity index 66% rename from crates/viewer/re_viewer_context/src/space_view/mod.rs rename to crates/viewer/re_viewer_context/src/view/mod.rs index f9e2ff307e1b..aa4883baf93c 100644 --- a/crates/viewer/re_viewer_context/src/space_view/mod.rs +++ b/crates/viewer/re_viewer_context/src/view/mod.rs @@ -1,16 +1,16 @@ -//! Rerun Space View class definition +//! Rerun View class definition //! -//! Defines a framework & utilities for defining classes of space views in the Rerun viewer. -//! Does not implement any concrete space view. +//! Defines a framework & utilities for defining classes of views in the Rerun viewer. +//! Does not implement any concrete view. -// TODO(andreas): Can we move some of these to the `re_space_view` crate? +// TODO(andreas): Can we move some of these to the `re_view` crate? mod highlights; mod named_system; -mod space_view_class; -mod space_view_class_placeholder; -mod space_view_class_registry; mod spawn_heuristics; mod system_execution_output; +mod view_class; +mod view_class_placeholder; +mod view_class_registry; mod view_context; mod view_context_system; mod view_query; @@ -19,19 +19,16 @@ mod visualizer_entity_subscriber; mod visualizer_system; pub use highlights::{ - OptionalSpaceViewEntityHighlight, SpaceViewEntityHighlight, SpaceViewHighlights, - SpaceViewOutlineMasks, + OptionalViewEntityHighlight, ViewEntityHighlight, ViewHighlights, ViewOutlineMasks, }; pub use named_system::{IdentifiedViewSystem, PerSystemEntities, ViewSystemIdentifier}; -pub use space_view_class::{ - SpaceViewClass, SpaceViewClassExt, SpaceViewClassLayoutPriority, SpaceViewState, - SpaceViewStateExt, VisualizableFilterContext, -}; -pub use space_view_class_registry::{ - SpaceViewClassRegistry, SpaceViewClassRegistryError, SpaceViewSystemRegistrator, -}; -pub use spawn_heuristics::{RecommendedSpaceView, SpaceViewSpawnHeuristics}; +pub use spawn_heuristics::{RecommendedView, ViewSpawnHeuristics}; pub use system_execution_output::SystemExecutionOutput; +pub use view_class::{ + ViewClass, ViewClassExt, ViewClassLayoutPriority, ViewState, ViewStateExt, + VisualizableFilterContext, +}; +pub use view_class_registry::{ViewClassRegistry, ViewClassRegistryError, ViewSystemRegistrator}; pub use view_context::ViewContext; pub use view_context_system::{ViewContextCollection, ViewContextSystem}; pub use view_query::{ @@ -45,7 +42,7 @@ pub use visualizer_system::{VisualizerCollection, VisualizerQueryInfo, Visualize // --------------------------------------------------------------------------- #[derive(Debug, thiserror::Error)] -pub enum SpaceViewSystemExecutionError { +pub enum ViewSystemExecutionError { #[error("View context system {0} not found")] ContextSystemNotFound(&'static str), @@ -67,7 +64,7 @@ pub enum SpaceViewSystemExecutionError { #[error(transparent)] GpuTransferError(#[from] re_renderer::CpuWriteGpuReadError), - #[error("Failed to downcast space view's to the {0}.")] + #[error("Failed to downcast view's to the {0}.")] StateCastError(&'static str), #[error("No render context error.")] @@ -82,13 +79,13 @@ pub enum SpaceViewSystemExecutionError { // Convenience conversions for some re_renderer error types since these are so frequent. -impl From for SpaceViewSystemExecutionError { +impl From for ViewSystemExecutionError { fn from(val: re_renderer::renderer::LineDrawDataError) -> Self { Self::DrawDataCreationError(Box::new(val)) } } -impl From for SpaceViewSystemExecutionError { +impl From for ViewSystemExecutionError { fn from(val: re_renderer::renderer::PointCloudDrawDataError) -> Self { Self::DrawDataCreationError(Box::new(val)) } diff --git a/crates/viewer/re_viewer_context/src/space_view/named_system.rs b/crates/viewer/re_viewer_context/src/view/named_system.rs similarity index 87% rename from crates/viewer/re_viewer_context/src/space_view/named_system.rs rename to crates/viewer/re_viewer_context/src/view/named_system.rs index e63344a805cb..6a8132d19908 100644 --- a/crates/viewer/re_viewer_context/src/space_view/named_system.rs +++ b/crates/viewer/re_viewer_context/src/view/named_system.rs @@ -3,7 +3,7 @@ use std::collections::{BTreeMap, BTreeSet}; use re_log_types::EntityPath; re_string_interner::declare_new_type!( - /// Unique name for a system within a given [`crate::SpaceViewClass`]. + /// Unique name for a system within a given [`crate::ViewClass`]. /// /// Note that this is *not* unique across the entire application. #[derive(serde::Deserialize, serde::Serialize)] @@ -25,7 +25,7 @@ pub type PerSystemEntities = BTreeMap /// /// Required to be implemented for registration. pub trait IdentifiedViewSystem { - /// Unique name for a system within a given [`crate::SpaceViewClass`]. + /// Unique name for a system within a given [`crate::ViewClass`]. /// /// Note that this is *not* unique across the entire application. fn identifier() -> ViewSystemIdentifier; diff --git a/crates/viewer/re_viewer_context/src/space_view/spawn_heuristics.rs b/crates/viewer/re_viewer_context/src/view/spawn_heuristics.rs similarity index 53% rename from crates/viewer/re_viewer_context/src/space_view/spawn_heuristics.rs rename to crates/viewer/re_viewer_context/src/view/spawn_heuristics.rs index 2d4fbd8aed32..526470376d13 100644 --- a/crates/viewer/re_viewer_context/src/space_view/spawn_heuristics.rs +++ b/crates/viewer/re_viewer_context/src/view/spawn_heuristics.rs @@ -1,54 +1,52 @@ use re_log_types::{hash::Hash64, EntityPath, EntityPathFilter, EntityPathSubs}; -use re_types::SpaceViewClassIdentifier; +use re_types::ViewClassIdentifier; -/// Properties of a space view that as recommended to be spawned by default via space view spawn heuristics. +/// Properties of a view that as recommended to be spawned by default via view spawn heuristics. #[derive(Debug, Clone)] -pub struct RecommendedSpaceView { +pub struct RecommendedView { pub origin: EntityPath, pub query_filter: EntityPathFilter, } -/// Heuristics for spawning space views of a given class. +/// Heuristics for spawning views of a given class. /// -/// Provides information in order to decide whether to spawn a space views, putting them in relationship to others and spawning them. -// TODO(andreas): allow bucketing decisions for 0-n buckets for recommended space views. -// TODO(andreas): Should `SpaceViewClassLayoutPriority` be part of this struct? +/// Provides information in order to decide whether to spawn a views, putting them in relationship to others and spawning them. +// TODO(andreas): allow bucketing decisions for 0-n buckets for recommended views. +// TODO(andreas): Should `ViewClassLayoutPriority` be part of this struct? #[derive(Default)] -pub struct SpaceViewSpawnHeuristics { - /// The recommended space views to spawn - recommended_space_views: Vec, +pub struct ViewSpawnHeuristics { + /// The recommended views to spawn + recommended_views: Vec, } -impl SpaceViewSpawnHeuristics { +impl ViewSpawnHeuristics { #[inline] pub fn empty() -> Self { Self { - recommended_space_views: Vec::new(), + recommended_views: Vec::new(), } } #[inline] pub fn root() -> Self { Self { - recommended_space_views: vec![RecommendedSpaceView::root()], + recommended_views: vec![RecommendedView::root()], } } - pub fn new(iter: impl IntoIterator) -> Self { - let mut recommended_space_views: Vec = iter.into_iter().collect(); - recommended_space_views.sort_by(|a, b| a.origin.cmp(&b.origin)); - Self { - recommended_space_views, - } + pub fn new(iter: impl IntoIterator) -> Self { + let mut recommended_views: Vec = iter.into_iter().collect(); + recommended_views.sort_by(|a, b| a.origin.cmp(&b.origin)); + Self { recommended_views } } #[inline] - pub fn into_vec(self) -> Vec { - self.recommended_space_views + pub fn into_vec(self) -> Vec { + self.recommended_views } } -impl RecommendedSpaceView { +impl RecommendedView { #[inline] pub fn new<'a>(origin: EntityPath, expressions: impl IntoIterator) -> Self { let space_env = EntityPathSubs::new_with_origin(&origin); @@ -76,13 +74,13 @@ impl RecommendedSpaceView { Self::new_subtree(EntityPath::root()) } - /// Hash together with the Space View class id to the `ViewerRecommendationHash` component. + /// Hash together with the View class id to the `ViewerRecommendationHash` component. /// - /// Recommendations are usually tied to a specific Space View class. + /// Recommendations are usually tied to a specific View class. /// Therefore, to identify a recommendation for identification purposes, the class id should be included in the hash. pub fn recommendation_hash( &self, - class_id: SpaceViewClassIdentifier, + class_id: ViewClassIdentifier, ) -> re_types::blueprint::components::ViewerRecommendationHash { let Self { origin, diff --git a/crates/viewer/re_viewer_context/src/space_view/system_execution_output.rs b/crates/viewer/re_viewer_context/src/view/system_execution_output.rs similarity index 90% rename from crates/viewer/re_viewer_context/src/space_view/system_execution_output.rs rename to crates/viewer/re_viewer_context/src/view/system_execution_output.rs index b26f0d7d5983..a30459e14684 100644 --- a/crates/viewer/re_viewer_context/src/space_view/system_execution_output.rs +++ b/crates/viewer/re_viewer_context/src/view/system_execution_output.rs @@ -1,6 +1,6 @@ use crate::{ViewContextCollection, VisualizerCollection}; -/// Output of space view system execution. +/// Output of view system execution. pub struct SystemExecutionOutput { /// Executed view systems, may hold state that the ui method needs. pub view_systems: VisualizerCollection, @@ -11,7 +11,7 @@ pub struct SystemExecutionOutput { /// Draw data gathered during execution of the view part systems. /// /// Ui methods are supposed to use this to create [`re_renderer::ViewBuilder`]s. - // _TODO(andreas)_: In the future view builder execution should be outside of the space view ui method. + // _TODO(andreas)_: In the future view builder execution should be outside of the view ui method. // This would allow to run the wgpu command buffer buildup in parallel. // (This implies that we'd pass out the readily built command buffer here instead of drawables.) pub draw_data: Vec, diff --git a/crates/viewer/re_viewer_context/src/space_view/space_view_class.rs b/crates/viewer/re_viewer_context/src/view/view_class.rs similarity index 66% rename from crates/viewer/re_viewer_context/src/space_view/space_view_class.rs rename to crates/viewer/re_viewer_context/src/view/view_class.rs index f6b9fa1b102b..4b449636dadd 100644 --- a/crates/viewer/re_viewer_context/src/space_view/space_view_class.rs +++ b/crates/viewer/re_viewer_context/src/view/view_class.rs @@ -2,18 +2,17 @@ use nohash_hasher::IntSet; use re_entity_db::EntityDb; use re_log_types::EntityPath; -use re_types::{ComponentName, SpaceViewClassIdentifier}; +use re_types::{ComponentName, ViewClassIdentifier}; use crate::{ ApplicableEntities, IndicatedEntities, PerVisualizer, QueryRange, SmallVisualizerSet, - SpaceViewClassRegistryError, SpaceViewId, SpaceViewSpawnHeuristics, - SpaceViewSystemExecutionError, SpaceViewSystemRegistrator, SystemExecutionOutput, ViewQuery, - ViewerContext, VisualizableEntities, + SystemExecutionOutput, ViewClassRegistryError, ViewId, ViewQuery, ViewSpawnHeuristics, + ViewSystemExecutionError, ViewSystemRegistrator, ViewerContext, VisualizableEntities, }; #[derive(Clone, Copy, Debug, Default, PartialEq, PartialOrd, Ord, Eq)] -pub enum SpaceViewClassLayoutPriority { - /// This space view can share space with others +pub enum ViewClassLayoutPriority { + /// This view can share space with others /// /// Used for boring things like text and plots. Low, @@ -21,12 +20,12 @@ pub enum SpaceViewClassLayoutPriority { #[default] Medium, - /// Give this space view lots of space. + /// Give this view lots of space. /// Used for spatial views (2D/3D). High, } -/// Context object returned by [`crate::SpaceViewClass::visualizable_filter_context`]. +/// Context object returned by [`crate::ViewClass::visualizable_filter_context`]. pub trait VisualizableFilterContext { fn as_any(&self) -> &dyn std::any::Any; } @@ -37,33 +36,33 @@ impl VisualizableFilterContext for () { } } -/// Defines a class of space view without any concrete types making it suitable for storage and interfacing. +/// Defines a class of view without any concrete types making it suitable for storage and interfacing. /// -/// Each Space View in the viewer's viewport has a single class assigned immutable at its creation time. +/// Each View in the viewer's viewport has a single class assigned immutable at its creation time. /// The class defines all aspects of its behavior. /// It determines which entities are queried, how they are rendered, and how the user can interact with them. // -// TODO(andreas): Consider formulating a space view instance context object that is passed to all -// methods that operate on concrete space views as opposed to be about general information on the class. -pub trait SpaceViewClass: Send + Sync { - /// Identifier string of this space view class. +// TODO(andreas): Consider formulating a view instance context object that is passed to all +// methods that operate on concrete views as opposed to be about general information on the class. +pub trait ViewClass: Send + Sync { + /// Identifier string of this view class. /// /// By convention we use `PascalCase`. - fn identifier() -> SpaceViewClassIdentifier + fn identifier() -> ViewClassIdentifier where Self: Sized; - /// User-facing name of this space view class. + /// User-facing name of this view class. /// /// Used for UI display. fn display_name(&self) -> &'static str; - /// Icon used to identify this space view class. + /// Icon used to identify this view class. fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_GENERIC + &re_ui::icons::VIEW_GENERIC } - /// Help text describing how to interact with this space view in the ui. + /// Help text describing how to interact with this view in the ui. fn help_markdown(&self, egui_ctx: &egui::Context) -> String; /// Called once upon registration of the class @@ -71,37 +70,37 @@ pub trait SpaceViewClass: Send + Sync { /// This can be used to register all built-in [`crate::ViewContextSystem`] and [`crate::VisualizerSystem`]. fn on_register( &self, - system_registry: &mut SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError>; + system_registry: &mut ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError>; - /// Called once for every new space view instance of this class. + /// Called once for every new view instance of this class. /// /// The state is *not* persisted across viewer sessions, only shared frame-to-frame. - fn new_state(&self) -> Box; + fn new_state(&self) -> Box; - /// Optional archetype of the Space View's blueprint properties. + /// Optional archetype of the View's blueprint properties. /// - /// Blueprint components that only apply to the space view itself, not to the entities it displays. + /// Blueprint components that only apply to the view itself, not to the entities it displays. fn blueprint_archetype(&self) -> Option> { None } - /// Preferred aspect ratio for the ui tiles of this space view. - fn preferred_tile_aspect_ratio(&self, _state: &dyn SpaceViewState) -> Option { + /// Preferred aspect ratio for the ui tiles of this view. + fn preferred_tile_aspect_ratio(&self, _state: &dyn ViewState) -> Option { None } - /// Controls how likely this space view will get a large tile in the ui. - fn layout_priority(&self) -> SpaceViewClassLayoutPriority; + /// Controls how likely this view will get a large tile in the ui. + fn layout_priority(&self) -> ViewClassLayoutPriority; /// Controls whether the visible time range UI should be displayed for this view. fn supports_visible_time_range(&self) -> bool { false } - /// Default query range for this space view. - //TODO(#6918): also provide ViewerContext and SpaceViewId, to enable reading view properties. - fn default_query_range(&self, _state: &dyn SpaceViewState) -> QueryRange { + /// Default query range for this view. + //TODO(#6918): also provide ViewerContext and ViewId, to enable reading view properties. + fn default_query_range(&self, _state: &dyn ViewState) -> QueryRange { QueryRange::LatestAt } @@ -171,18 +170,18 @@ pub trait SpaceViewClass: Send + Sync { .collect() } - /// Determines which space views should be spawned by default for this class. - fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics; + /// Determines which views should be spawned by default for this class. + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> ViewSpawnHeuristics; - /// Ui shown when the user selects a space view of this class. + /// Ui shown when the user selects a view of this class. fn selection_ui( &self, _ctx: &ViewerContext<'_>, _ui: &mut egui::Ui, - _state: &mut dyn SpaceViewState, + _state: &mut dyn ViewState, _space_origin: &EntityPath, - _space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { + _view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { Ok(()) } @@ -193,34 +192,34 @@ pub trait SpaceViewClass: Send + Sync { &self, _ctx: &ViewerContext<'_>, _ui: &mut egui::Ui, - _state: &mut dyn SpaceViewState, + _state: &mut dyn ViewState, _space_origin: &EntityPath, - _space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { + _view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { Ok(()) } - /// Draws the ui for this space view class and handles ui events. + /// Draws the ui for this view class and handles ui events. /// /// The passed state is kept frame-to-frame. /// /// TODO(wumpf): Right now the ui methods control when and how to create [`re_renderer::ViewBuilder`]s. /// In the future, we likely want to move view builder handling to `re_viewport` with - /// minimal configuration options exposed via [`crate::SpaceViewClass`]. + /// minimal configuration options exposed via [`crate::ViewClass`]. fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, query: &ViewQuery<'_>, system_output: SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError>; + ) -> Result<(), ViewSystemExecutionError>; } -pub trait SpaceViewClassExt<'a>: SpaceViewClass + 'a { - /// Determines the set of visible entities for a given space view. - // TODO(andreas): This should be part of the SpaceView's (non-blueprint) state. - // Updated whenever `applicable_entities_per_visualizer` or the space view blueprint changes. +pub trait ViewClassExt<'a>: ViewClass + 'a { + /// Determines the set of visible entities for a given view. + // TODO(andreas): This should be part of the View's (non-blueprint) state. + // Updated whenever `applicable_entities_per_visualizer` or the view blueprint changes. fn determine_visualizable_entities( &self, applicable_entities_per_visualizer: &PerVisualizer, @@ -254,14 +253,14 @@ pub trait SpaceViewClassExt<'a>: SpaceViewClass + 'a { } } -impl<'a> SpaceViewClassExt<'a> for dyn SpaceViewClass + 'a {} +impl<'a> ViewClassExt<'a> for dyn ViewClass + 'a {} -/// Unserialized frame to frame state of a space view. +/// Unserialized frame to frame state of a view. /// /// For any state that should be persisted, use the Blueprint! /// This state is used for transient state, such as animation or uncommitted ui state like dragging a camera. /// (on mouse release, the camera would be committed to the blueprint). -pub trait SpaceViewState: std::any::Any + Sync + Send { +pub trait ViewState: std::any::Any + Sync + Send { /// Converts itself to a reference of [`std::any::Any`], which enables downcasting to concrete types. fn as_any(&self) -> &dyn std::any::Any; @@ -269,8 +268,8 @@ pub trait SpaceViewState: std::any::Any + Sync + Send { fn as_any_mut(&mut self) -> &mut dyn std::any::Any; } -/// Implementation of an empty space view state. -impl SpaceViewState for () { +/// Implementation of an empty view state. +impl ViewState for () { fn as_any(&self) -> &dyn std::any::Any { self } @@ -280,24 +279,24 @@ impl SpaceViewState for () { } } -pub trait SpaceViewStateExt: SpaceViewState { +pub trait ViewStateExt: ViewState { /// Downcasts this state to a reference of a concrete type. - fn downcast_ref(&self) -> Result<&T, SpaceViewSystemExecutionError> { + fn downcast_ref(&self) -> Result<&T, ViewSystemExecutionError> { self.as_any() .downcast_ref() - .ok_or(SpaceViewSystemExecutionError::StateCastError( + .ok_or(ViewSystemExecutionError::StateCastError( std::any::type_name::(), )) } /// Downcasts this state to a mutable reference of a concrete type. - fn downcast_mut(&mut self) -> Result<&mut T, SpaceViewSystemExecutionError> { + fn downcast_mut(&mut self) -> Result<&mut T, ViewSystemExecutionError> { self.as_any_mut() .downcast_mut() - .ok_or(SpaceViewSystemExecutionError::StateCastError( + .ok_or(ViewSystemExecutionError::StateCastError( std::any::type_name::(), )) } } -impl SpaceViewStateExt for dyn SpaceViewState {} +impl ViewStateExt for dyn ViewState {} diff --git a/crates/viewer/re_viewer_context/src/view/view_class_placeholder.rs b/crates/viewer/re_viewer_context/src/view/view_class_placeholder.rs new file mode 100644 index 000000000000..eb5020bca90a --- /dev/null +++ b/crates/viewer/re_viewer_context/src/view/view_class_placeholder.rs @@ -0,0 +1,77 @@ +use re_types::ViewClassIdentifier; +use re_ui::UiExt; + +use crate::{ + SystemExecutionOutput, ViewClass, ViewClassRegistryError, ViewQuery, ViewSpawnHeuristics, + ViewState, ViewSystemExecutionError, ViewSystemRegistrator, ViewerContext, +}; + +/// A placeholder view class that can be used when the actual class is not registered. +#[derive(Default)] +pub struct ViewClassPlaceholder; + +impl ViewClass for ViewClassPlaceholder { + fn identifier() -> ViewClassIdentifier { + "UnknownViewClass".into() + } + + fn display_name(&self) -> &'static str { + "Unknown view class" + } + + fn icon(&self) -> &'static re_ui::Icon { + &re_ui::icons::VIEW_UNKNOWN + } + + fn help_markdown(&self, _egui_ctx: &egui::Context) -> String { + "Placeholder view for unknown view class".to_owned() + } + + fn on_register( + &self, + _system_registry: &mut ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { + Ok(()) + } + + fn new_state(&self) -> Box { + Box::<()>::default() + } + + fn layout_priority(&self) -> crate::ViewClassLayoutPriority { + crate::ViewClassLayoutPriority::Low + } + + fn spawn_heuristics(&self, _ctx: &ViewerContext<'_>) -> ViewSpawnHeuristics { + ViewSpawnHeuristics::empty() + } + + fn ui( + &self, + _ctx: &ViewerContext<'_>, + ui: &mut egui::Ui, + _state: &mut dyn ViewState, + _query: &ViewQuery<'_>, + _system_output: SystemExecutionOutput, + ) -> Result<(), ViewSystemExecutionError> { + egui::Frame { + inner_margin: egui::Margin::same(re_ui::DesignTokens::view_padding()), + ..Default::default() + } + .show(ui, |ui| { + ui.warning_label("Unknown view class"); + + ui.markdown_ui( + "This happens if either the blueprint specifies an invalid view class or \ + this version of the viewer does not know about this type.\n\n\ + \ + **Note**: some views may require a specific Cargo feature to be enabled. In \ + particular, the map view requires the `map_view` feature.", + ); + }); + + Ok(()) + } +} + +crate::impl_component_fallback_provider!(ViewClassPlaceholder => []); diff --git a/crates/viewer/re_viewer_context/src/space_view/space_view_class_registry.rs b/crates/viewer/re_viewer_context/src/view/view_class_registry.rs similarity index 64% rename from crates/viewer/re_viewer_context/src/space_view/space_view_class_registry.rs rename to crates/viewer/re_viewer_context/src/view/view_class_registry.rs index 4b9866a2eeb5..58ba77b776b2 100644 --- a/crates/viewer/re_viewer_context/src/space_view/space_view_class_registry.rs +++ b/crates/viewer/re_viewer_context/src/view/view_class_registry.rs @@ -2,24 +2,24 @@ use ahash::{HashMap, HashSet}; use itertools::Itertools as _; use re_chunk_store::{ChunkStore, ChunkStoreSubscriberHandle}; -use re_types::SpaceViewClassIdentifier; +use re_types::ViewClassIdentifier; use crate::{ - ApplicableEntities, IdentifiedViewSystem, IndicatedEntities, PerVisualizer, SpaceViewClass, + ApplicableEntities, IdentifiedViewSystem, IndicatedEntities, PerVisualizer, ViewClass, ViewContextCollection, ViewContextSystem, ViewSystemIdentifier, VisualizerCollection, VisualizerSystem, }; use super::{ - space_view_class_placeholder::SpaceViewClassPlaceholder, + view_class_placeholder::ViewClassPlaceholder, visualizer_entity_subscriber::VisualizerEntitySubscriber, }; #[derive(Debug, thiserror::Error)] #[allow(clippy::enum_variant_names)] -pub enum SpaceViewClassRegistryError { - #[error("Space view with class identifier {0:?} was already registered.")] - DuplicateClassIdentifier(SpaceViewClassIdentifier), +pub enum ViewClassRegistryError { + #[error("View with class identifier {0:?} was already registered.")] + DuplicateClassIdentifier(ViewClassIdentifier), #[error("A context system with identifier {0:?} was already registered.")] IdentifierAlreadyInUseForContextSystem(&'static str), @@ -27,35 +27,33 @@ pub enum SpaceViewClassRegistryError { #[error("A visualizer system with identifier {0:?} was already registered.")] IdentifierAlreadyInUseForVisualizer(&'static str), - #[error("Space view with class identifier {0:?} was not registered.")] - UnknownClassIdentifier(SpaceViewClassIdentifier), + #[error("View with class identifier {0:?} was not registered.")] + UnknownClassIdentifier(ViewClassIdentifier), } -/// Utility for registering space view systems, passed on to [`crate::SpaceViewClass::on_register`]. -pub struct SpaceViewSystemRegistrator<'a> { - registry: &'a mut SpaceViewClassRegistry, - identifier: SpaceViewClassIdentifier, +/// Utility for registering view systems, passed on to [`crate::ViewClass::on_register`]. +pub struct ViewSystemRegistrator<'a> { + registry: &'a mut ViewClassRegistry, + identifier: ViewClassIdentifier, context_systems: HashSet, visualizers: HashSet, } -impl SpaceViewSystemRegistrator<'_> { - /// Registers a new [`ViewContextSystem`] type for a space view class that will be created and executed every frame. +impl ViewSystemRegistrator<'_> { + /// Registers a new [`ViewContextSystem`] type for a view class that will be created and executed every frame. /// - /// It is not allowed to register a given type more than once within the same space view class. - /// Different space view classes may however share the same [`ViewContextSystem`] type. + /// It is not allowed to register a given type more than once within the same view class. + /// Different view classes may however share the same [`ViewContextSystem`] type. pub fn register_context_system< T: ViewContextSystem + IdentifiedViewSystem + Default + 'static, >( &mut self, - ) -> Result<(), SpaceViewClassRegistryError> { + ) -> Result<(), ViewClassRegistryError> { // Name should not overlap with context systems. if self.registry.visualizers.contains_key(&T::identifier()) { - return Err( - SpaceViewClassRegistryError::IdentifierAlreadyInUseForVisualizer( - T::identifier().as_str(), - ), - ); + return Err(ViewClassRegistryError::IdentifierAlreadyInUseForVisualizer( + T::identifier().as_str(), + )); } if self.context_systems.insert(T::identifier()) { @@ -72,24 +70,24 @@ impl SpaceViewSystemRegistrator<'_> { Ok(()) } else { Err( - SpaceViewClassRegistryError::IdentifierAlreadyInUseForContextSystem( + ViewClassRegistryError::IdentifierAlreadyInUseForContextSystem( T::identifier().as_str(), ), ) } } - /// Registers a new [`VisualizerSystem`] type for a space view class that will be created and executed every frame. + /// Registers a new [`VisualizerSystem`] type for a view class that will be created and executed every frame. /// - /// It is not allowed to register a given type more than once within the same space view class. - /// Different space view classes may however share the same [`VisualizerSystem`] type. + /// It is not allowed to register a given type more than once within the same view class. + /// Different view classes may however share the same [`VisualizerSystem`] type. pub fn register_visualizer( &mut self, - ) -> Result<(), SpaceViewClassRegistryError> { + ) -> Result<(), ViewClassRegistryError> { // Name should not overlap with context systems. if self.registry.context_systems.contains_key(&T::identifier()) { return Err( - SpaceViewClassRegistryError::IdentifierAlreadyInUseForContextSystem( + ViewClassRegistryError::IdentifierAlreadyInUseForContextSystem( T::identifier().as_str(), ), ); @@ -115,45 +113,43 @@ impl SpaceViewSystemRegistrator<'_> { Ok(()) } else { - Err( - SpaceViewClassRegistryError::IdentifierAlreadyInUseForVisualizer( - T::identifier().as_str(), - ), - ) + Err(ViewClassRegistryError::IdentifierAlreadyInUseForVisualizer( + T::identifier().as_str(), + )) } } } -/// Space view class entry in [`SpaceViewClassRegistry`]. -pub struct SpaceViewClassRegistryEntry { - pub class: Box, - pub identifier: SpaceViewClassIdentifier, +/// View class entry in [`ViewClassRegistry`]. +pub struct ViewClassRegistryEntry { + pub class: Box, + pub identifier: ViewClassIdentifier, pub context_system_ids: HashSet, pub visualizer_system_ids: HashSet, } #[allow(clippy::derivable_impls)] // Clippy gets this one wrong. -impl Default for SpaceViewClassRegistryEntry { +impl Default for ViewClassRegistryEntry { fn default() -> Self { Self { - class: Box::::default(), - identifier: SpaceViewClassPlaceholder::identifier(), + class: Box::::default(), + identifier: ViewClassPlaceholder::identifier(), context_system_ids: Default::default(), visualizer_system_ids: Default::default(), } } } -/// Context system type entry in [`SpaceViewClassRegistry`]. +/// Context system type entry in [`ViewClassRegistry`]. struct ContextSystemTypeRegistryEntry { factory_method: Box Box + Send + Sync>, - used_by: HashSet, + used_by: HashSet, } -/// Visualizer entry in [`SpaceViewClassRegistry`]. +/// Visualizer entry in [`ViewClassRegistry`]. struct VisualizerTypeRegistryEntry { factory_method: Box Box + Send + Sync>, - used_by: HashSet, + used_by: HashSet, /// Handle to subscription of [`VisualizerEntitySubscriber`] for this visualizer. entity_subscriber_handle: ChunkStoreSubscriberHandle, @@ -166,27 +162,27 @@ impl Drop for VisualizerTypeRegistryEntry { } } -/// Registry of all known space view types. +/// Registry of all known view types. /// /// Expected to be populated on viewer startup. #[derive(Default)] -pub struct SpaceViewClassRegistry { - space_view_classes: HashMap, +pub struct ViewClassRegistry { + view_classes: HashMap, context_systems: HashMap, visualizers: HashMap, - placeholder: SpaceViewClassRegistryEntry, + placeholder: ViewClassRegistryEntry, } -impl SpaceViewClassRegistry { - /// Adds a new space view class. +impl ViewClassRegistry { + /// Adds a new view class. /// - /// Fails if a space view class with the same name was already registered. - pub fn add_class( + /// Fails if a view class with the same name was already registered. + pub fn add_class( &mut self, - ) -> Result<(), SpaceViewClassRegistryError> { + ) -> Result<(), ViewClassRegistryError> { let class = Box::::default(); - let mut registrator = SpaceViewSystemRegistrator { + let mut registrator = ViewSystemRegistrator { registry: self, identifier: T::identifier(), context_systems: Default::default(), @@ -195,7 +191,7 @@ impl SpaceViewClassRegistry { class.on_register(&mut registrator)?; - let SpaceViewSystemRegistrator { + let ViewSystemRegistrator { registry: _, identifier, context_systems, @@ -203,10 +199,10 @@ impl SpaceViewClassRegistry { } = registrator; if self - .space_view_classes + .view_classes .insert( identifier, - SpaceViewClassRegistryEntry { + ViewClassRegistryEntry { class, identifier, context_system_ids: context_systems, @@ -215,23 +211,17 @@ impl SpaceViewClassRegistry { ) .is_some() { - return Err(SpaceViewClassRegistryError::DuplicateClassIdentifier( - identifier, - )); + return Err(ViewClassRegistryError::DuplicateClassIdentifier(identifier)); } Ok(()) } - /// Removes a space view class from the registry. - pub fn remove_class( - &mut self, - ) -> Result<(), SpaceViewClassRegistryError> { + /// Removes a view class from the registry. + pub fn remove_class(&mut self) -> Result<(), ViewClassRegistryError> { let identifier = T::identifier(); - if self.space_view_classes.remove(&identifier).is_none() { - return Err(SpaceViewClassRegistryError::UnknownClassIdentifier( - identifier, - )); + if self.view_classes.remove(&identifier).is_none() { + return Err(ViewClassRegistryError::UnknownClassIdentifier(identifier)); } self.context_systems.retain(|_, context_system_entry| { @@ -247,37 +237,35 @@ impl SpaceViewClassRegistry { Ok(()) } - /// Queries a Space View type by class name, returning `None` if it is not registered. - fn get_class(&self, name: SpaceViewClassIdentifier) -> Option<&dyn SpaceViewClass> { - self.space_view_classes + /// Queries a View type by class name, returning `None` if it is not registered. + fn get_class(&self, name: ViewClassIdentifier) -> Option<&dyn ViewClass> { + self.view_classes .get(&name) .map(|boxed| boxed.class.as_ref()) } - /// Returns the user-facing name for the given space view class. + /// Returns the user-facing name for the given view class. /// /// If the class is unknown, returns a placeholder name. - pub fn display_name(&self, name: SpaceViewClassIdentifier) -> &'static str { - self.space_view_classes + pub fn display_name(&self, name: ViewClassIdentifier) -> &'static str { + self.view_classes .get(&name) - .map_or("", |boxed| { - boxed.class.display_name() - }) + .map_or("", |boxed| boxed.class.display_name()) } - /// Queries a Space View type by class name and logs if it fails, returning a placeholder class. - pub fn get_class_or_log_error(&self, name: SpaceViewClassIdentifier) -> &dyn SpaceViewClass { + /// Queries a View type by class name and logs if it fails, returning a placeholder class. + pub fn get_class_or_log_error(&self, name: ViewClassIdentifier) -> &dyn ViewClass { if let Some(result) = self.get_class(name) { result } else { - re_log::error_once!("Unknown space view class {:?}", name); + re_log::error_once!("Unknown view class {:?}", name); self.placeholder.class.as_ref() } } - /// Iterates over all registered Space View class types, sorted by name. - pub fn iter_registry(&self) -> impl Iterator { - self.space_view_classes + /// Iterates over all registered View class types, sorted by name. + pub fn iter_registry(&self) -> impl Iterator { + self.view_classes .values() .sorted_by_key(|entry| entry.class.display_name()) } @@ -336,14 +324,14 @@ impl SpaceViewClassRegistry { pub fn new_context_collection( &self, - space_view_class_identifier: SpaceViewClassIdentifier, + view_class_identifier: ViewClassIdentifier, ) -> ViewContextCollection { re_tracing::profile_function!(); - let Some(class) = self.space_view_classes.get(&space_view_class_identifier) else { + let Some(class) = self.view_classes.get(&view_class_identifier) else { return ViewContextCollection { systems: Default::default(), - space_view_class_identifier, + view_class_identifier, }; }; @@ -358,17 +346,17 @@ impl SpaceViewClassRegistry { }) }) .collect(), - space_view_class_identifier, + view_class_identifier, } } pub fn new_visualizer_collection( &self, - space_view_class_identifier: SpaceViewClassIdentifier, + view_class_identifier: ViewClassIdentifier, ) -> VisualizerCollection { re_tracing::profile_function!(); - let Some(class) = self.space_view_classes.get(&space_view_class_identifier) else { + let Some(class) = self.view_classes.get(&view_class_identifier) else { return VisualizerCollection { systems: Default::default(), }; diff --git a/crates/viewer/re_viewer_context/src/space_view/view_context.rs b/crates/viewer/re_viewer_context/src/view/view_context.rs similarity index 93% rename from crates/viewer/re_viewer_context/src/space_view/view_context.rs rename to crates/viewer/re_viewer_context/src/view/view_context.rs index 6ed6a3e30595..fafa901710dd 100644 --- a/crates/viewer/re_viewer_context/src/space_view/view_context.rs +++ b/crates/viewer/re_viewer_context/src/view/view_context.rs @@ -6,19 +6,19 @@ use re_log_types::{EntityPath, TimePoint}; use re_query::StorageEngineReadGuard; use re_types::{AsComponents, ComponentBatch, ComponentName}; -use crate::{DataQueryResult, DataResult, QueryContext, SpaceViewId}; +use crate::{DataQueryResult, DataResult, QueryContext, ViewId}; /// The context associated with a view. /// -/// This combines our [`crate::ViewerContext`] with [`crate::SpaceViewState`] +/// This combines our [`crate::ViewerContext`] with [`crate::ViewState`] /// and other view-specific information. This is used as the interface for /// execution of view systems and selection panel UI elements that happen /// within the context of a view to simplify plumbing of the necessary /// information to resolve a query with possible overrides and fallback values. pub struct ViewContext<'a> { pub viewer_ctx: &'a crate::ViewerContext<'a>, - pub view_id: SpaceViewId, - pub view_state: &'a dyn crate::SpaceViewState, + pub view_id: ViewId, + pub view_state: &'a dyn crate::ViewState, pub defaults_path: &'a EntityPath, pub visualizer_collection: Arc, } @@ -98,7 +98,7 @@ impl<'a> ViewContext<'a> { } #[inline] - pub fn lookup_query_result(&self, id: SpaceViewId) -> &DataQueryResult { + pub fn lookup_query_result(&self, id: ViewId) -> &DataQueryResult { self.viewer_ctx.lookup_query_result(id) } diff --git a/crates/viewer/re_viewer_context/src/space_view/view_context_system.rs b/crates/viewer/re_viewer_context/src/view/view_context_system.rs similarity index 76% rename from crates/viewer/re_viewer_context/src/space_view/view_context_system.rs rename to crates/viewer/re_viewer_context/src/view/view_context_system.rs index e6b8ce8ed926..92b12ce6ee45 100644 --- a/crates/viewer/re_viewer_context/src/space_view/view_context_system.rs +++ b/crates/viewer/re_viewer_context/src/view/view_context_system.rs @@ -1,8 +1,8 @@ use ahash::HashMap; -use re_types::{ComponentNameSet, SpaceViewClassIdentifier}; +use re_types::{ComponentNameSet, ViewClassIdentifier}; -use crate::{IdentifiedViewSystem, SpaceViewSystemExecutionError, ViewQuery, ViewSystemIdentifier}; +use crate::{IdentifiedViewSystem, ViewQuery, ViewSystemExecutionError, ViewSystemIdentifier}; use super::view_context::ViewContext; @@ -18,7 +18,7 @@ pub trait ViewContextSystem: Send + Sync { /// Return an empty vec to specify that the system should never run automatically for any /// specific entities. /// It may still run once per frame as part of the global context if it has been registered to - /// do so, see [`crate::SpaceViewSystemRegistrator`]. + /// do so, see [`crate::ViewSystemRegistrator`]. fn compatible_component_sets(&self) -> Vec; /// Queries the chunk store and performs data conversions to make it ready for consumption by scene elements. @@ -31,18 +31,18 @@ pub trait ViewContextSystem: Send + Sync { // TODO(jleibs): This probably needs a better name now that it includes class name pub struct ViewContextCollection { pub systems: HashMap>, - pub space_view_class_identifier: SpaceViewClassIdentifier, + pub view_class_identifier: ViewClassIdentifier, } impl ViewContextCollection { pub fn get( &self, - ) -> Result<&T, SpaceViewSystemExecutionError> { + ) -> Result<&T, ViewSystemExecutionError> { self.systems .get(&T::identifier()) .and_then(|s| s.as_any().downcast_ref()) .ok_or_else(|| { - SpaceViewSystemExecutionError::ContextSystemNotFound(T::identifier().as_str()) + ViewSystemExecutionError::ContextSystemNotFound(T::identifier().as_str()) }) } @@ -52,7 +52,7 @@ impl ViewContextCollection { self.systems.iter().map(|s| (*s.0, s.1.as_ref())) } - pub fn space_view_class_identifier(&self) -> SpaceViewClassIdentifier { - self.space_view_class_identifier + pub fn view_class_identifier(&self) -> ViewClassIdentifier { + self.view_class_identifier } } diff --git a/crates/viewer/re_viewer_context/src/space_view/view_query.rs b/crates/viewer/re_viewer_context/src/view/view_query.rs similarity index 97% rename from crates/viewer/re_viewer_context/src/space_view/view_query.rs rename to crates/viewer/re_viewer_context/src/view/view_query.rs index ec4144b841a4..978ab1ba37f4 100644 --- a/crates/viewer/re_viewer_context/src/space_view/view_query.rs +++ b/crates/viewer/re_viewer_context/src/view/view_query.rs @@ -10,8 +10,8 @@ use re_log_types::StoreKind; use re_types::ComponentName; use crate::{ - DataResultTree, QueryRange, SpaceViewHighlights, SpaceViewId, ViewContext, - ViewSystemIdentifier, ViewerContext, + DataResultTree, QueryRange, ViewContext, ViewHighlights, ViewId, ViewSystemIdentifier, + ViewerContext, }; /// Path to a specific entity in a specific store used for overrides. @@ -58,7 +58,7 @@ pub struct PropertyOverrides { pub type SmallVisualizerSet = SmallVec<[ViewSystemIdentifier; 4]>; -/// This is the primary mechanism through which data is passed to a `SpaceView`. +/// This is the primary mechanism through which data is passed to a `View`. /// /// It contains everything necessary to properly use this data in the context of the /// `ViewSystem`s that it is a part of. @@ -249,7 +249,7 @@ pub type PerSystemDataResults<'a> = BTreeMap { /// The id of the space in which context the query happens. - pub space_view_id: SpaceViewId, + pub view_id: ViewId, /// The root of the space in which context the query happens. pub space_origin: &'s EntityPath, @@ -265,10 +265,10 @@ pub struct ViewQuery<'s> { /// The time on the timeline we're currently at. pub latest_at: TimeInt, - /// Hover/select highlighting information for this space view. + /// Hover/select highlighting information for this view. /// /// TODO(andreas): This should be the result of a [`crate::ViewContextSystem`] instead? - pub highlights: SpaceViewHighlights, + pub highlights: ViewHighlights, } impl<'s> ViewQuery<'s> { diff --git a/crates/viewer/re_viewer_context/src/view/view_states.rs b/crates/viewer/re_viewer_context/src/view/view_states.rs new file mode 100644 index 000000000000..4343db0cce31 --- /dev/null +++ b/crates/viewer/re_viewer_context/src/view/view_states.rs @@ -0,0 +1,38 @@ +//! Storage for the state of each `View`. +//! +//! The `Viewer` has ownership of this state and pass it around to users (mainly viewport and +//! selection panel). + +use ahash::HashMap; + +use crate::{ViewClass, ViewId, ViewState}; + +/// State for the `View`s that persists across frames but otherwise +/// is not saved. +#[derive(Default)] +pub struct ViewStates { + states: HashMap>, +} + +impl ViewStates { + pub fn get(&self, view_id: ViewId) -> Option<&dyn ViewState> { + self.states.get(&view_id).map(|s| s.as_ref()) + } + + pub fn get_mut_or_create( + &mut self, + view_id: ViewId, + view_class: &dyn ViewClass, + ) -> &mut dyn ViewState { + self.states + .entry(view_id) + .or_insert_with(|| view_class.new_state()) + .as_mut() + } + + pub fn ensure_state_exists(&mut self, view_id: ViewId, view_class: &dyn ViewClass) { + self.states + .entry(view_id) + .or_insert_with(|| view_class.new_state()); + } +} diff --git a/crates/viewer/re_viewer_context/src/space_view/visualizer_entity_subscriber.rs b/crates/viewer/re_viewer_context/src/view/visualizer_entity_subscriber.rs similarity index 98% rename from crates/viewer/re_viewer_context/src/space_view/visualizer_entity_subscriber.rs rename to crates/viewer/re_viewer_context/src/view/visualizer_entity_subscriber.rs index 20b2dafcd1da..2ddd36cdbb20 100644 --- a/crates/viewer/re_viewer_context/src/space_view/visualizer_entity_subscriber.rs +++ b/crates/viewer/re_viewer_context/src/view/visualizer_entity_subscriber.rs @@ -21,7 +21,7 @@ use crate::{ /// Applicability is determined by the visualizer's set of required components. /// /// There's only a single entity subscriber per visualizer *type*. -/// This means that if the same visualizer is used in multiple space views, only a single +/// This means that if the same visualizer is used in multiple views, only a single /// `VisualizerEntitySubscriber` is created for all of them. pub struct VisualizerEntitySubscriber { /// Visualizer type this subscriber is associated with. diff --git a/crates/viewer/re_viewer_context/src/space_view/visualizer_system.rs b/crates/viewer/re_viewer_context/src/view/visualizer_system.rs similarity index 86% rename from crates/viewer/re_viewer_context/src/space_view/visualizer_system.rs rename to crates/viewer/re_viewer_context/src/view/visualizer_system.rs index 97f8eaf9dee7..408d57e32325 100644 --- a/crates/viewer/re_viewer_context/src/space_view/visualizer_system.rs +++ b/crates/viewer/re_viewer_context/src/view/visualizer_system.rs @@ -3,10 +3,9 @@ use std::collections::BTreeMap; use re_types::{Archetype, ComponentName, ComponentNameSet}; use crate::{ - ApplicableEntities, ComponentFallbackProvider, IdentifiedViewSystem, - SpaceViewSystemExecutionError, ViewContext, ViewContextCollection, ViewQuery, - ViewSystemIdentifier, VisualizableEntities, VisualizableFilterContext, - VisualizerAdditionalApplicabilityFilter, + ApplicableEntities, ComponentFallbackProvider, IdentifiedViewSystem, ViewContext, + ViewContextCollection, ViewQuery, ViewSystemExecutionError, ViewSystemIdentifier, + VisualizableEntities, VisualizableFilterContext, VisualizerAdditionalApplicabilityFilter, }; #[derive(Debug, Clone, Default)] @@ -93,7 +92,7 @@ pub trait VisualizerSystem: Send + Sync + 'static { /// Filters a set of applicable entities (entities that have all required components), /// into to a set of visualizable entities. /// - /// The context passed in here is generated by [`crate::SpaceViewClass::visualizable_filter_context`]. + /// The context passed in here is generated by [`crate::ViewClass::visualizable_filter_context`]. #[inline] fn filter_visualizable_entities( &self, @@ -118,13 +117,13 @@ pub trait VisualizerSystem: Send + Sync + 'static { ctx: &ViewContext<'_>, query: &ViewQuery<'_>, context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError>; + ) -> Result, ViewSystemExecutionError>; /// Optionally retrieves a chunk store reference from the scene element. /// - /// This is useful for retrieving data that is common to several visualizers of a [`crate::SpaceViewClass`]. - /// For example, if most visualizers produce ui elements, a concrete [`crate::SpaceViewClass`] - /// can pick those up in its [`crate::SpaceViewClass::ui`] method by iterating over all visualizers. + /// This is useful for retrieving data that is common to several visualizers of a [`crate::ViewClass`]. + /// For example, if most visualizers produce ui elements, a concrete [`crate::ViewClass`] + /// can pick those up in its [`crate::ViewClass::ui`] method by iterating over all visualizers. fn data(&self) -> Option<&dyn std::any::Any> { None } @@ -147,12 +146,12 @@ impl VisualizerCollection { #[inline] pub fn get( &self, - ) -> Result<&T, SpaceViewSystemExecutionError> { + ) -> Result<&T, ViewSystemExecutionError> { self.systems .get(&T::identifier()) .and_then(|s| s.as_any().downcast_ref()) .ok_or_else(|| { - SpaceViewSystemExecutionError::VisualizerSystemNotFound(T::identifier().as_str()) + ViewSystemExecutionError::VisualizerSystemNotFound(T::identifier().as_str()) }) } @@ -160,11 +159,11 @@ impl VisualizerCollection { pub fn get_by_identifier( &self, name: ViewSystemIdentifier, - ) -> Result<&dyn VisualizerSystem, SpaceViewSystemExecutionError> { + ) -> Result<&dyn VisualizerSystem, ViewSystemExecutionError> { self.systems .get(&name) .map(|s| s.as_ref()) - .ok_or_else(|| SpaceViewSystemExecutionError::VisualizerSystemNotFound(name.as_str())) + .ok_or_else(|| ViewSystemExecutionError::VisualizerSystemNotFound(name.as_str())) } #[inline] diff --git a/crates/viewer/re_viewer_context/src/viewer_context.rs b/crates/viewer/re_viewer_context/src/viewer_context.rs index 5e8cd4f8ce07..024f7fa91893 100644 --- a/crates/viewer/re_viewer_context/src/viewer_context.rs +++ b/crates/viewer/re_viewer_context/src/viewer_context.rs @@ -8,7 +8,7 @@ use re_query::StorageEngineReadGuard; use crate::{ query_context::DataQueryResult, AppOptions, ApplicableEntities, ApplicationSelectionState, Caches, CommandSender, ComponentUiRegistry, IndicatedEntities, ItemCollection, PerVisualizer, - SpaceViewClassRegistry, SpaceViewId, StoreContext, SystemCommandSender as _, TimeControl, + StoreContext, SystemCommandSender as _, TimeControl, ViewClassRegistry, ViewId, }; /// Common things needed by many parts of the viewer. @@ -18,7 +18,7 @@ pub struct ViewerContext<'a> { /// Things that need caching and are shared across the whole viewer. /// - /// Use this only for things that you expected be shared across different panels and/or space views. + /// Use this only for things that you expected be shared across different panels and/or views. pub cache: &'a Caches, /// Runtime info about components and archetypes. @@ -33,8 +33,8 @@ pub struct ViewerContext<'a> { /// How to display components. pub component_ui_registry: &'a ComponentUiRegistry, - /// Registry of all known classes of space views. - pub space_view_class_registry: &'a SpaceViewClassRegistry, + /// Registry of all known classes of views. + pub view_class_registry: &'a ViewClassRegistry, /// The current view of the store pub store_context: &'a StoreContext<'a>, @@ -51,7 +51,7 @@ pub struct ViewerContext<'a> { pub indicated_entities_per_visualizer: &'a PerVisualizer, /// All the query results for this frame. - pub query_results: &'a HashMap, + pub query_results: &'a HashMap, /// UI config for the current recording (found in [`EntityDb`]). pub rec_cfg: &'a RecordingConfig, diff --git a/crates/viewer/re_viewport/Cargo.toml b/crates/viewer/re_viewport/Cargo.toml index f1e9570115be..af5a315504a9 100644 --- a/crates/viewer/re_viewport/Cargo.toml +++ b/crates/viewer/re_viewport/Cargo.toml @@ -29,7 +29,7 @@ re_renderer = { workspace = true, default-features = false, features = [ "import-obj", "serde", ] } -re_space_view.workspace = true +re_view.workspace = true re_tracing.workspace = true re_types.workspace = true re_types_blueprint.workspace = true diff --git a/crates/viewer/re_viewport/README.md b/crates/viewer/re_viewport/README.md index 8bd5548bbb5e..b6bf90cd4967 100644 --- a/crates/viewer/re_viewport/README.md +++ b/crates/viewer/re_viewport/README.md @@ -2,8 +2,8 @@ Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. -[![Latest version](https://img.shields.io/crates/v/re_viewport.svg)](https://crates.io/crates/re_viewport) -[![Documentation](https://docs.rs/re_viewport/badge.svg)](https://docs.rs/re_viewport) +[![Latest version](https://img.shields.io/crates/v/re_viewport.svg)](https://crates.io/crates/re_viewport?speculative-link) +[![Documentation](https://docs.rs/re_viewport/badge.svg)](https://docs.rs/re_viewport?speculative-link) ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) diff --git a/crates/viewer/re_viewport/src/auto_layout.rs b/crates/viewer/re_viewport/src/auto_layout.rs index 96b5fcdeae91..6544544fa246 100644 --- a/crates/viewer/re_viewport/src/auto_layout.rs +++ b/crates/viewer/re_viewport/src/auto_layout.rs @@ -1,4 +1,4 @@ -//! Code for automatic layout of space views. +//! Code for automatic layout of views. //! //! This uses some very rough heuristics and have a lot of room for improvement. @@ -6,41 +6,33 @@ use std::collections::BTreeMap; use itertools::Itertools as _; -use re_types::SpaceViewClassIdentifier; -use re_viewer_context::SpaceViewId; +use re_types::ViewClassIdentifier; +use re_viewer_context::ViewId; -use re_viewport_blueprint::SpaceViewBlueprint; +use re_viewport_blueprint::ViewBlueprint; #[derive(Clone, Debug)] struct SpaceMakeInfo { - id: SpaceViewId, - class_identifier: SpaceViewClassIdentifier, - layout_priority: re_viewer_context::SpaceViewClassLayoutPriority, + id: ViewId, + class_identifier: ViewClassIdentifier, + layout_priority: re_viewer_context::ViewClassLayoutPriority, } -pub(crate) fn tree_from_space_views( - space_view_class_registry: &re_viewer_context::SpaceViewClassRegistry, - space_views: &BTreeMap, -) -> egui_tiles::Tree { - re_log::trace!("Auto-layout of {} space views", space_views.len()); +pub(crate) fn tree_from_views( + view_class_registry: &re_viewer_context::ViewClassRegistry, + views: &BTreeMap, +) -> egui_tiles::Tree { + re_log::trace!("Auto-layout of {} views", views.len()); - let space_make_infos = space_views + let space_make_infos = views .iter() // Sort for determinism: - .sorted_by_key(|(space_view_id, space_view)| { - ( - &space_view.space_origin, - &space_view.display_name, - *space_view_id, - ) - }) - .map(|(space_view_id, space_view)| { - let class_identifier = space_view.class_identifier(); - let layout_priority = space_view - .class(space_view_class_registry) - .layout_priority(); + .sorted_by_key(|(view_id, view)| (&view.space_origin, &view.display_name, *view_id)) + .map(|(view_id, view)| { + let class_identifier = view.class_identifier(); + let layout_priority = view.class(view_class_registry).layout_priority(); SpaceMakeInfo { - id: *space_view_id, + id: *view_id, class_identifier, layout_priority, } @@ -69,8 +61,8 @@ pub(crate) fn tree_from_space_views( .collect_vec(); tiles.insert_grid_tile(child_tile_ids) } else { - // So many space views - lets group by class and put the members of each group into tabs: - let mut grouped_by_class: BTreeMap> = + // So many views - lets group by class and put the members of each group into tabs: + let mut grouped_by_class: BTreeMap> = Default::default(); for smi in space_make_infos { grouped_by_class @@ -107,7 +99,7 @@ pub(crate) fn tree_from_space_views( fn arrange_three( mut spaces: [SpaceMakeInfo; 3], - tiles: &mut egui_tiles::Tiles, + tiles: &mut egui_tiles::Tiles, ) -> egui_tiles::TileId { // We will arrange it like so: // diff --git a/crates/viewer/re_viewport/src/lib.rs b/crates/viewer/re_viewport/src/lib.rs index 2e2266757fc3..d69e424ae48f 100644 --- a/crates/viewer/re_viewport/src/lib.rs +++ b/crates/viewer/re_viewport/src/lib.rs @@ -1,18 +1,18 @@ //! Rerun Viewport Panel //! -//! This crate provides the central panel that contains all space views. +//! This crate provides the central panel that contains all views. // TODO(#6330): remove unwrap() #![allow(clippy::unwrap_used)] mod auto_layout; -mod space_view_highlights; mod system_execution; +mod view_highlights; mod viewport_ui; pub use self::viewport_ui::ViewportUi; pub mod external { - pub use re_space_view; pub use re_types_blueprint; + pub use re_view; } diff --git a/crates/viewer/re_viewport/src/system_execution.rs b/crates/viewer/re_viewport/src/system_execution.rs index a0f8b4372745..396ccbba4fab 100644 --- a/crates/viewer/re_viewport/src/system_execution.rs +++ b/crates/viewer/re_viewport/src/system_execution.rs @@ -5,18 +5,18 @@ use rayon::prelude::*; use re_log_types::TimeInt; use re_viewer_context::{ - PerSystemDataResults, SpaceViewId, SpaceViewState, SystemExecutionOutput, - ViewContextCollection, ViewQuery, ViewStates, ViewerContext, VisualizerCollection, + PerSystemDataResults, SystemExecutionOutput, ViewContextCollection, ViewId, ViewQuery, + ViewState, ViewStates, ViewerContext, VisualizerCollection, }; -use crate::space_view_highlights::highlights_for_space_view; -use re_viewport_blueprint::SpaceViewBlueprint; +use crate::view_highlights::highlights_for_view; +use re_viewport_blueprint::ViewBlueprint; -fn run_space_view_systems( +fn run_view_systems( ctx: &ViewerContext<'_>, - view: &SpaceViewBlueprint, + view: &ViewBlueprint, query: &ViewQuery<'_>, - view_state: &dyn SpaceViewState, + view_state: &dyn ViewState, context_systems: &mut ViewContextCollection, view_systems: &mut VisualizerCollection, ) -> Vec { @@ -53,15 +53,15 @@ fn run_space_view_systems( .collect() } -pub fn execute_systems_for_space_view<'a>( +pub fn execute_systems_for_view<'a>( ctx: &'a ViewerContext<'_>, - view: &'a SpaceViewBlueprint, + view: &'a ViewBlueprint, latest_at: TimeInt, - view_state: &dyn SpaceViewState, + view_state: &dyn ViewState, ) -> (ViewQuery<'a>, SystemExecutionOutput) { re_tracing::profile_function!(view.class_identifier().as_str()); - let highlights = highlights_for_space_view(ctx, view.id); + let highlights = highlights_for_view(ctx, view.id); let query_result = ctx.lookup_query_result(view.id); @@ -81,7 +81,7 @@ pub fn execute_systems_for_space_view<'a>( } let query = re_viewer_context::ViewQuery { - space_view_id: view.id, + view_id: view.id, space_origin: &view.space_origin, per_visualizer_data_results, timeline: *ctx.rec_cfg.time_ctrl.read().timeline(), @@ -90,13 +90,13 @@ pub fn execute_systems_for_space_view<'a>( }; let mut context_systems = ctx - .space_view_class_registry + .view_class_registry .new_context_collection(view.class_identifier()); let mut view_systems = ctx - .space_view_class_registry + .view_class_registry .new_visualizer_collection(view.class_identifier()); - let draw_data = run_space_view_systems( + let draw_data = run_view_systems( ctx, view, &query, @@ -117,10 +117,10 @@ pub fn execute_systems_for_space_view<'a>( pub fn execute_systems_for_all_views<'a>( ctx: &'a ViewerContext<'a>, - tree: &egui_tiles::Tree, - views: &'a BTreeMap, + tree: &egui_tiles::Tree, + views: &'a BTreeMap, view_states: &mut ViewStates, -) -> HashMap, SystemExecutionOutput)> { +) -> HashMap, SystemExecutionOutput)> { let Some(time_int) = ctx.rec_cfg.time_ctrl.read().time_int() else { return Default::default(); }; @@ -129,7 +129,7 @@ pub fn execute_systems_for_all_views<'a>( // During system execution we only have read access to the view states, so we need to ensure they exist ahead of time. for (view_id, view) in views { - view_states.ensure_state_exists(*view_id, view.class(ctx.space_view_class_registry)); + view_states.ensure_state_exists(*view_id, view.class(ctx.view_class_registry)); } tree.active_tiles() @@ -142,7 +142,7 @@ pub fn execute_systems_for_all_views<'a>( return None; }; - let result = execute_systems_for_space_view(ctx, view, time_int, view_state); + let result = execute_systems_for_view(ctx, view, time_int, view_state); Some((*view_id, result)) }), egui_tiles::Tile::Container(_) => None, diff --git a/crates/viewer/re_viewport/src/space_view_highlights.rs b/crates/viewer/re_viewport/src/view_highlights.rs similarity index 82% rename from crates/viewer/re_viewport/src/space_view_highlights.rs rename to crates/viewer/re_viewport/src/view_highlights.rs index 173fed8ac72d..5ec5b733965a 100644 --- a/crates/viewer/re_viewport/src/space_view_highlights.rs +++ b/crates/viewer/re_viewport/src/view_highlights.rs @@ -5,23 +5,22 @@ use re_entity_db::InstancePath; use re_log_types::EntityPathHash; use re_renderer::OutlineMaskPreference; use re_viewer_context::{ - HoverHighlight, Item, SelectionHighlight, SpaceViewEntityHighlight, SpaceViewHighlights, - SpaceViewId, SpaceViewOutlineMasks, + HoverHighlight, Item, SelectionHighlight, ViewEntityHighlight, ViewHighlights, ViewId, + ViewOutlineMasks, }; -/// Computes which things in a space view should received highlighting. +/// Computes which things in a view should received highlighting. /// /// This method makes decisions which entities & instances should which kind of highlighting -/// based on the entities in a space view and the current selection/hover state. -pub fn highlights_for_space_view( +/// based on the entities in a view and the current selection/hover state. +pub fn highlights_for_view( ctx: &re_viewer_context::ViewerContext<'_>, - space_view_id: SpaceViewId, -) -> SpaceViewHighlights { + view_id: ViewId, +) -> ViewHighlights { re_tracing::profile_function!(); - let mut highlighted_entity_paths = - IntMap::::default(); - let mut outlines_masks = IntMap::::default(); + let mut highlighted_entity_paths = IntMap::::default(); + let mut outlines_masks = IntMap::::default(); let mut selection_mask_index: u8 = 0; let mut next_selection_mask = || { @@ -47,7 +46,7 @@ pub fn highlights_for_space_view( Item::AppId(_) | Item::DataSource(_) | Item::StoreId(_) - | Item::SpaceView(_) + | Item::View(_) | Item::Container(_) => {} Item::ComponentPath(component_path) => { @@ -63,9 +62,9 @@ pub fn highlights_for_space_view( add_highlight_and_mask(entity_hash, selected_instance.clone(), highlight); } - Item::DataResult(selected_space_view_context, selected_instance) => { + Item::DataResult(selected_view_context, selected_instance) => { let entity_hash = selected_instance.entity_path.hash(); - let highlight = if *selected_space_view_context == space_view_id { + let highlight = if *selected_view_context == view_id { SelectionHighlight::Selection } else { SelectionHighlight::SiblingSelection @@ -87,7 +86,7 @@ pub fn highlights_for_space_view( Item::AppId(_) | Item::DataSource(_) | Item::StoreId(_) - | Item::SpaceView(_) + | Item::View(_) | Item::Container(_) => {} Item::ComponentPath(component_path) => { @@ -118,7 +117,7 @@ pub fn highlights_for_space_view( }; } - SpaceViewHighlights { + ViewHighlights { highlighted_entity_paths, outlines_masks, } diff --git a/crates/viewer/re_viewport/src/viewport_ui.rs b/crates/viewer/re_viewport/src/viewport_ui.rs index ff03ad6cc05a..cecfb4978699 100644 --- a/crates/viewer/re_viewport/src/viewport_ui.rs +++ b/crates/viewer/re_viewport/src/viewport_ui.rs @@ -1,6 +1,6 @@ //! The viewport panel. //! -//! Contains all space views. +//! Contains all views. use ahash::HashMap; use egui_tiles::{Behavior as _, EditAction}; @@ -8,13 +8,12 @@ use egui_tiles::{Behavior as _, EditAction}; use re_context_menu::{context_menu_ui_for_item, SelectionUpdateBehavior}; use re_ui::{ContextExt as _, DesignTokens, Icon, UiExt as _}; use re_viewer_context::{ - blueprint_id_to_tile_id, icon_for_container_kind, Contents, Item, PublishedSpaceViewInfo, - SpaceViewClassRegistry, SpaceViewId, SystemExecutionOutput, ViewQuery, ViewStates, - ViewerContext, + blueprint_id_to_tile_id, icon_for_container_kind, Contents, Item, PublishedViewInfo, + SystemExecutionOutput, ViewClassRegistry, ViewId, ViewQuery, ViewStates, ViewerContext, }; use re_viewport_blueprint::{ViewportBlueprint, ViewportCommand}; -use crate::system_execution::{execute_systems_for_all_views, execute_systems_for_space_view}; +use crate::system_execution::{execute_systems_for_all_views, execute_systems_for_view}; fn tree_simplification_options() -> egui_tiles::SimplificationOptions { egui_tiles::SimplificationOptions { @@ -57,26 +56,26 @@ impl ViewportUi { let mut maximized = blueprint.maximized; - if let Some(space_view_id) = blueprint.maximized { - if !blueprint.space_views.contains_key(&space_view_id) { + if let Some(view_id) = blueprint.maximized { + if !blueprint.views.contains_key(&view_id) { maximized = None; - } else if let Some(tile_id) = blueprint.tree.tiles.find_pane(&space_view_id) { + } else if let Some(tile_id) = blueprint.tree.tiles.find_pane(&view_id) { if !blueprint.tree.tiles.is_visible(tile_id) { maximized = None; } } } - let mut tree = if let Some(space_view_id) = blueprint.maximized { + let mut tree = if let Some(view_id) = blueprint.maximized { let mut tiles = egui_tiles::Tiles::default(); - let root = tiles.insert_pane(space_view_id); + let root = tiles.insert_pane(view_id); egui_tiles::Tree::new("viewport_tree", root, tiles) } else { blueprint.tree.clone() }; - let executed_systems_per_space_view = - execute_systems_for_all_views(ctx, &tree, &blueprint.space_views, view_states); + let executed_systems_per_view = + execute_systems_for_all_views(ctx, &tree, &blueprint.views, view_states); let contents_per_tile_id = blueprint .contents_iter() @@ -93,7 +92,7 @@ impl ViewportUi { ctx, viewport_blueprint: blueprint, maximized: &mut maximized, - executed_systems_per_space_view, + executed_systems_per_view, contents_per_tile_id, edited: false, tile_dropped: false, @@ -169,14 +168,14 @@ impl ViewportUi { pub fn on_frame_start(&self, ctx: &ViewerContext<'_>) { re_tracing::profile_function!(); - self.blueprint.spawn_heuristic_space_views(ctx); + self.blueprint.spawn_heuristic_views(ctx); } /// Process any deferred [`ViewportCommand`] and then save to blueprint store (if needed). pub fn save_to_blueprint_store( self, ctx: &ViewerContext<'_>, - space_view_class_registry: &SpaceViewClassRegistry, + view_class_registry: &ViewClassRegistry, ) { re_tracing::profile_function!(); @@ -195,10 +194,8 @@ impl ViewportUi { } if run_auto_layout { - blueprint.tree = super::auto_layout::tree_from_space_views( - space_view_class_registry, - &blueprint.space_views, - ); + blueprint.tree = + super::auto_layout::tree_from_views(view_class_registry, &blueprint.views); } // Simplify before we save the tree. @@ -225,30 +222,32 @@ fn apply_viewport_command( bp.tree = new_tree; } - ViewportCommand::AddSpaceView { - space_view, + ViewportCommand::AddView { + view, parent_container, position_in_parent, } => { - let space_view_id = space_view.id; + let view_id = view.id; - space_view.save_to_blueprint_store(ctx); - bp.space_views.insert(space_view_id, space_view); + view.save_to_blueprint_store(ctx); + bp.views.insert(view_id, view); if bp.auto_layout() { // No need to add to the tree - we'll create a new tree from scratch instead. - re_log::trace!("Running auto-layout after adding a space-view because auto_layout is turned on"); + re_log::trace!( + "Running auto-layout after adding a view because auto_layout is turned on" + ); *run_auto_layout = true; } else { // Add the view to the tree: let parent_id = parent_container.unwrap_or(bp.root_container); - re_log::trace!("Adding space-view {space_view_id} to parent {parent_id}"); - let tile_id = bp.tree.tiles.insert_pane(space_view_id); + re_log::trace!("Adding view {view_id} to parent {parent_id}"); + let tile_id = bp.tree.tiles.insert_pane(view_id); let container_tile_id = blueprint_id_to_tile_id(&parent_id); if let Some(egui_tiles::Tile::Container(container)) = bp.tree.tiles.get_mut(container_tile_id) { - re_log::trace!("Inserting new space view into root container"); + re_log::trace!("Inserting new view into root container"); container.add_child(tile_id); if let Some(position_in_parent) = position_in_parent { bp.tree.move_tile_to_container( @@ -283,7 +282,7 @@ fn apply_viewport_command( if let Some(egui_tiles::Tile::Container(parent_container)) = bp.tree.tiles.get_mut(blueprint_id_to_tile_id(&parent_id)) { - re_log::trace!("Inserting new space view into container {parent_id:?}"); + re_log::trace!("Inserting new view into container {parent_id:?}"); parent_container.add_child(tile_id); } else { re_log::trace!("Parent or root was not a container - will re-run auto-layout"); @@ -304,12 +303,12 @@ fn apply_viewport_command( } } - ViewportCommand::FocusTab(space_view_id) => { + ViewportCommand::FocusTab(view_id) => { let found = bp.tree.make_active(|_, tile| match tile { - egui_tiles::Tile::Pane(this_space_view_id) => *this_space_view_id == space_view_id, + egui_tiles::Tile::Pane(this_view_id) => *this_view_id == view_id, egui_tiles::Tile::Container(_) => false, }); - re_log::trace!("Found tab to focus on for space view ID {space_view_id}: {found}"); + re_log::trace!("Found tab to focus on for view ID {view_id}: {found}"); } ViewportCommand::RemoveContents(contents) => { @@ -318,20 +317,20 @@ fn apply_viewport_command( for tile in bp.tree.remove_recursively(tile_id) { re_log::trace!("Removing tile {tile_id:?}"); match tile { - egui_tiles::Tile::Pane(space_view_id) => { - re_log::trace!("Removing space view {space_view_id}"); + egui_tiles::Tile::Pane(view_id) => { + re_log::trace!("Removing view {view_id}"); - // Remove the space view from the store - if let Some(space_view) = bp.space_views.get(&space_view_id) { - space_view.clear(ctx); + // Remove the view from the store + if let Some(view) = bp.views.get(&view_id) { + view.clear(ctx); } - // If the space-view was maximized, clean it up - if bp.maximized == Some(space_view_id) { + // If the view was maximized, clean it up + if bp.maximized == Some(view_id) { bp.set_maximized(None, ctx); } - bp.space_views.remove(&space_view_id); + bp.views.remove(&view_id); } egui_tiles::Tile::Container(_) => { // Empty containers (like this one) will be auto-removed by the tree simplification algorithm, @@ -425,16 +424,16 @@ fn apply_viewport_command( /// `egui_tiles` has _tiles_ which are either _containers_ or _panes_. /// -/// In our case, each pane is a space view, +/// In our case, each pane is a view, /// while containers are just groups of things. struct TilesDelegate<'a, 'b> { view_states: &'a mut ViewStates, ctx: &'a ViewerContext<'b>, viewport_blueprint: &'a ViewportBlueprint, - maximized: &'a mut Option, + maximized: &'a mut Option, - /// List of query & system execution results for each space view. - executed_systems_per_space_view: HashMap, SystemExecutionOutput)>, + /// List of query & system execution results for each view. + executed_systems_per_view: HashMap, SystemExecutionOutput)>, /// List of contents for each tile id contents_per_tile_id: HashMap, @@ -446,16 +445,16 @@ struct TilesDelegate<'a, 'b> { tile_dropped: bool, } -impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { +impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { fn pane_ui( &mut self, ui: &mut egui::Ui, _tile_id: egui_tiles::TileId, - view_id: &mut SpaceViewId, + view_id: &mut ViewId, ) -> egui_tiles::UiResponse { re_tracing::profile_function!(); - let Some(space_view_blueprint) = self.viewport_blueprint.view(view_id) else { + let Some(view_blueprint) = self.viewport_blueprint.view(view_id) else { return Default::default(); }; @@ -471,8 +470,8 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { return Default::default(); }; - let (query, system_output) = self.executed_systems_per_space_view.remove(view_id).unwrap_or_else(|| { - // The space view's systems haven't been executed. + let (query, system_output) = self.executed_systems_per_view.remove(view_id).unwrap_or_else(|| { + // The view's systems haven't been executed. // This may indicate that the egui_tiles tree is not in sync // with the blueprint tree. // This shouldn't happen, but better safe than sorry: @@ -480,13 +479,13 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { if cfg!(debug_assertions) { re_log::warn_once!( - "Visualizers for space view {:?} haven't been executed prior to display. This should never happen, please report a bug.", - space_view_blueprint.display_name_or_default() + "Visualizers for view {:?} haven't been executed prior to display. This should never happen, please report a bug.", + view_blueprint.display_name_or_default() ); } let ctx: &'a ViewerContext<'_> = self.ctx; - let view = space_view_blueprint; + let view = view_blueprint; re_tracing::profile_scope!("late-system-execute", view.class_identifier().as_str()); let query_result = ctx.lookup_query_result(view.id); @@ -507,11 +506,11 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { }); } - let class = space_view_blueprint.class(self.ctx.space_view_class_registry); - execute_systems_for_space_view(ctx, view, latest_at, self.view_states.get_mut_or_create(*view_id, class)) + let class = view_blueprint.class(self.ctx.view_class_registry); + execute_systems_for_view(ctx, view, latest_at, self.view_states.get_mut_or_create(*view_id, class)) }); - let class = space_view_blueprint.class(self.ctx.space_view_class_registry); + let class = view_blueprint.class(self.ctx.view_class_registry); let view_state = self.view_states.get_mut_or_create(*view_id, class); ui.scope(|ui| { @@ -519,22 +518,19 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { .ui(self.ctx, ui, view_state, &query, system_output) .unwrap_or_else(|err| { re_log::error!( - "Error in space view UI (class: {}, display name: {}): {err}", - space_view_blueprint.class_identifier(), + "Error in view UI (class: {}, display name: {}): {err}", + view_blueprint.class_identifier(), class.display_name(), ); }); ui.ctx().memory_mut(|mem| { mem.caches - .cache::() + .cache::() .set( *view_id, - PublishedSpaceViewInfo { - name: space_view_blueprint - .display_name_or_default() - .as_ref() - .to_owned(), + PublishedViewInfo { + name: view_blueprint.display_name_or_default().as_ref().to_owned(), rect: ui.min_rect(), }, ); @@ -544,13 +540,13 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { Default::default() } - fn tab_title_for_pane(&mut self, space_view_id: &SpaceViewId) -> egui::WidgetText { - if let Some(space_view) = self.viewport_blueprint.view(space_view_id) { - // Note: the formatting for unnamed space views is handled by `TabWidget::new()` - space_view.display_name_or_default().as_ref().into() + fn tab_title_for_pane(&mut self, view_id: &ViewId) -> egui::WidgetText { + if let Some(view) = self.viewport_blueprint.view(view_id) { + // Note: the formatting for unnamed views is handled by `TabWidget::new()` + view.display_name_or_default().as_ref().into() } else { - // All panes are space views, so this shouldn't happen unless we have a bug - re_log::warn_once!("SpaceViewId missing during egui_tiles"); + // All panes are views, so this shouldn't happen unless we have a bug + re_log::warn_once!("ViewId missing during egui_tiles"); self.ctx.egui_ctx.error_text("Internal error").into() } } @@ -558,7 +554,7 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { #[allow(clippy::fn_params_excessive_bools)] fn tab_ui( &mut self, - tiles: &mut egui_tiles::Tiles, + tiles: &mut egui_tiles::Tiles, ui: &mut egui::Ui, id: egui::Id, tile_id: egui_tiles::TileId, @@ -576,7 +572,7 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { } let item = tiles.get(tile_id).and_then(|tile| match tile { - egui_tiles::Tile::Pane(space_view_id) => Some(Item::SpaceView(*space_view_id)), + egui_tiles::Tile::Pane(view_id) => Some(Item::View(*view_id)), egui_tiles::Tile::Container(_) => { if let Some(Contents::Container(container_id)) = @@ -605,7 +601,7 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { fn drag_ui( &mut self, - tiles: &egui_tiles::Tiles, + tiles: &egui_tiles::Tiles, ui: &mut egui::Ui, tile_id: egui_tiles::TileId, ) { @@ -636,15 +632,13 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { }); } - fn retain_pane(&mut self, space_view_id: &SpaceViewId) -> bool { - self.viewport_blueprint - .space_views - .contains_key(space_view_id) + fn retain_pane(&mut self, view_id: &ViewId) -> bool { + self.viewport_blueprint.views.contains_key(view_id) } fn top_bar_right_ui( &mut self, - tiles: &egui_tiles::Tiles, + tiles: &egui_tiles::Tiles, ui: &mut egui::Ui, _tile_id: egui_tiles::TileId, tabs: &egui_tiles::Tabs, @@ -653,19 +647,19 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { let Some(active) = tabs.active.and_then(|active| tiles.get(active)) else { return; }; - let egui_tiles::Tile::Pane(space_view_id) = active else { + let egui_tiles::Tile::Pane(view_id) = active else { return; }; - let space_view_id = *space_view_id; + let view_id = *view_id; - let Some(space_view_blueprint) = self.viewport_blueprint.view(&space_view_id) else { + let Some(view_blueprint) = self.viewport_blueprint.view(&view_id) else { return; }; - let num_space_views = tiles.tiles().filter(|tile| tile.is_pane()).count(); + let num_views = tiles.tiles().filter(|tile| tile.is_pane()).count(); ui.add_space(8.0); // margin within the frame - if *self.maximized == Some(space_view_id) { + if *self.maximized == Some(view_id) { // Show minimize-button: if ui .small_icon_button(&re_ui::icons::MINIMIZE) @@ -674,41 +668,39 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { { *self.maximized = None; } - } else if num_space_views > 1 { + } else if num_views > 1 { // Show maximize-button: if ui .small_icon_button(&re_ui::icons::MAXIMIZE) - .on_hover_text("Maximize space view") + .on_hover_text("Maximize view") .clicked() { - *self.maximized = Some(space_view_id); + *self.maximized = Some(view_id); // Just maximize - don't select. See https://github.com/rerun-io/rerun/issues/2861 } } - let space_view_class = space_view_blueprint.class(self.ctx.space_view_class_registry); + let view_class = view_blueprint.class(self.ctx.view_class_registry); // give the view a chance to display some extra UI in the top bar. - let view_state = self - .view_states - .get_mut_or_create(space_view_id, space_view_class); - space_view_class + let view_state = self.view_states.get_mut_or_create(view_id, view_class); + view_class .extra_title_bar_ui( self.ctx, ui, view_state, - &space_view_blueprint.space_origin, - space_view_id, + &view_blueprint.space_origin, + view_id, ) .unwrap_or_else(|err| { re_log::error!( "Error in view title bar UI (class: {}, display name: {}): {err}", - space_view_blueprint.class_identifier(), - space_view_class.display_name(), + view_blueprint.class_identifier(), + view_class.display_name(), ); }); - let help_markdown = space_view_class.help_markdown(self.ctx.egui_ctx); + let help_markdown = view_class.help_markdown(self.ctx.egui_ctx); ui.help_hover_button().on_hover_ui(|ui| { ui.markdown_ui(&help_markdown); }); @@ -770,7 +762,7 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { /// A tab button for a tab in the viewport. /// /// The tab can contain any `egui_tiles::Tile`, -/// which is either a Pane with a Space View, or a container, +/// which is either a Pane with a View, or a container, /// e.g. a grid of tiles. struct TabWidget { galley: std::sync::Arc, @@ -788,7 +780,7 @@ impl TabWidget { fn new<'a>( tab_viewer: &'a mut TilesDelegate<'_, '_>, ui: &'a mut egui::Ui, - tiles: &'a egui_tiles::Tiles, + tiles: &'a egui_tiles::Tiles, tile_id: egui_tiles::TileId, tab_state: &egui_tiles::TabState, gamma: f32, @@ -801,26 +793,20 @@ impl TabWidget { } let tab_desc = match tiles.get(tile_id) { - Some(egui_tiles::Tile::Pane(space_view_id)) => { - if let Some(space_view) = tab_viewer.viewport_blueprint.view(space_view_id) { + Some(egui_tiles::Tile::Pane(view_id)) => { + if let Some(view) = tab_viewer.viewport_blueprint.view(view_id) { TabDesc { - label: tab_viewer.tab_title_for_pane(space_view_id), - user_named: space_view.display_name.is_some(), - icon: space_view - .class(tab_viewer.ctx.space_view_class_registry) - .icon(), - item: Some(Item::SpaceView(*space_view_id)), + label: tab_viewer.tab_title_for_pane(view_id), + user_named: view.display_name.is_some(), + icon: view.class(tab_viewer.ctx.view_class_registry).icon(), + item: Some(Item::View(*view_id)), } } else { - re_log::warn_once!("Space view {space_view_id} not found"); + re_log::warn_once!("View {view_id} not found"); TabDesc { - label: tab_viewer - .ctx - .egui_ctx - .error_text("Unknown space view") - .into(), - icon: &re_ui::icons::SPACE_VIEW_GENERIC, + label: tab_viewer.ctx.egui_ctx.error_text("Unknown view").into(), + icon: &re_ui::icons::VIEW_GENERIC, user_named: false, item: None, } @@ -872,7 +858,7 @@ impl TabWidget { .egui_ctx .error_text("Unknown container") .into(), - icon: &re_ui::icons::SPACE_VIEW_GENERIC, + icon: &re_ui::icons::VIEW_GENERIC, user_named: false, item: None, } @@ -883,7 +869,7 @@ impl TabWidget { TabDesc { label: tab_viewer.ctx.egui_ctx.error_text("Internal error").into(), - icon: &re_ui::icons::SPACE_VIEW_UNKNOWN, + icon: &re_ui::icons::VIEW_UNKNOWN, user_named: false, item: None, } diff --git a/crates/viewer/re_viewport_blueprint/README.md b/crates/viewer/re_viewport_blueprint/README.md index 8280a9e5d34b..ee8c229a13c8 100644 --- a/crates/viewer/re_viewport_blueprint/README.md +++ b/crates/viewer/re_viewport_blueprint/README.md @@ -2,8 +2,8 @@ Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. -[![Latest version](https://img.shields.io/crates/v/re_viewport_blueprint.svg)](https://crates.io/crates/re_viewport_blueprint) -[![Documentation](https://docs.rs/re_viewport_blueprint/badge.svg)](https://docs.rs/re_viewport_blueprint) +[![Latest version](https://img.shields.io/crates/v/re_viewport_blueprint.svg)](https://crates.io/crates/re_viewport_blueprint?speculative-link) +[![Documentation](https://docs.rs/re_viewport_blueprint/badge.svg)](https://docs.rs/re_viewport_blueprint?speculative-link) ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) ![Apache](https://img.shields.io/badge/license-Apache-blue.svg) diff --git a/crates/viewer/re_viewport_blueprint/src/container.rs b/crates/viewer/re_viewport_blueprint/src/container.rs index f2eb4cc83c88..85cc1d7ee065 100644 --- a/crates/viewer/re_viewport_blueprint/src/container.rs +++ b/crates/viewer/re_viewport_blueprint/src/container.rs @@ -8,13 +8,13 @@ use re_types::components::Name; use re_types::{blueprint::components::Visible, Archetype as _}; use re_types_blueprint::blueprint::archetypes as blueprint_archetypes; use re_types_blueprint::blueprint::components::{ContainerKind, GridColumns}; -use re_viewer_context::{ContainerId, Contents, ContentsName, SpaceViewId, ViewerContext}; +use re_viewer_context::{ContainerId, Contents, ContentsName, ViewId, ViewerContext}; /// The native version of a [`re_types_blueprint::blueprint::archetypes::ContainerBlueprint`]. /// /// This represents a single container in the blueprint. On each frame, it is /// used to populate an [`egui_tiles::Container`]. Each child in `contents` can -/// be either a [`SpaceViewId`] or another [`ContainerId`]. +/// be either a [`ViewId`] or another [`ContainerId`]. /// /// The main reason this exists is to handle type conversions that aren't yet /// well handled by the code-generated archetypes. @@ -301,7 +301,7 @@ impl ContainerBlueprint { } } - /// Placeholder name displayed in the UI if the user hasn't explicitly named the space view. + /// Placeholder name displayed in the UI if the user hasn't explicitly named the view. #[inline] pub fn missing_name_placeholder(&self) -> String { format!("{:?}", self.container_kind) @@ -365,7 +365,7 @@ impl ContainerBlueprint { ); } - pub fn to_tile(&self) -> egui_tiles::Tile { + pub fn to_tile(&self) -> egui_tiles::Tile { let children = self .contents .iter() diff --git a/crates/viewer/re_viewport_blueprint/src/lib.rs b/crates/viewer/re_viewport_blueprint/src/lib.rs index 8a5b6154de07..3ec02beb7356 100644 --- a/crates/viewer/re_viewport_blueprint/src/lib.rs +++ b/crates/viewer/re_viewport_blueprint/src/lib.rs @@ -3,17 +3,17 @@ //! This crate provides blueprint (i.e. description) for how to render the viewport. mod container; -mod space_view; -mod space_view_contents; pub mod ui; +mod view; +mod view_contents; mod view_properties; mod viewport_blueprint; mod viewport_command; pub use container::ContainerBlueprint; use re_viewer_context::ViewerContext; -pub use space_view::SpaceViewBlueprint; -pub use space_view_contents::SpaceViewContents; +pub use view::ViewBlueprint; +pub use view_contents::ViewContents; pub use view_properties::{entity_path_for_view_property, ViewProperty, ViewPropertyQueryError}; pub use viewport_blueprint::ViewportBlueprint; pub use viewport_command::ViewportCommand; @@ -55,21 +55,21 @@ pub fn container_kind_from_egui( } } -/// List out all space views we generate by default for the available data. +/// List out all views we generate by default for the available data. /// -/// TODO(andreas): This is transitional. We want to pass on the space view spawn heuristics +/// TODO(andreas): This is transitional. We want to pass on the view spawn heuristics /// directly and make more high level decisions with it. -pub fn default_created_space_views(ctx: &ViewerContext<'_>) -> Vec { +pub fn default_created_views(ctx: &ViewerContext<'_>) -> Vec { re_tracing::profile_function!(); - ctx.space_view_class_registry + ctx.view_class_registry .iter_registry() .flat_map(|entry| { let spawn_heuristics = entry.class.spawn_heuristics(ctx); spawn_heuristics .into_vec() .into_iter() - .map(|recommendation| SpaceViewBlueprint::new(entry.identifier, recommendation)) + .map(|recommendation| ViewBlueprint::new(entry.identifier, recommendation)) }) .collect() } diff --git a/crates/viewer/re_viewport_blueprint/src/ui/add_space_view_or_container_modal.rs b/crates/viewer/re_viewport_blueprint/src/ui/add_view_or_container_modal.rs similarity index 89% rename from crates/viewer/re_viewport_blueprint/src/ui/add_space_view_or_container_modal.rs rename to crates/viewer/re_viewport_blueprint/src/ui/add_view_or_container_modal.rs index 34e7b631116b..4a38ee15a48f 100644 --- a/crates/viewer/re_viewport_blueprint/src/ui/add_space_view_or_container_modal.rs +++ b/crates/viewer/re_viewport_blueprint/src/ui/add_view_or_container_modal.rs @@ -1,19 +1,18 @@ -//! Modal for adding a new space view of container to an existing target container. +//! Modal for adding a new view of container to an existing target container. -use crate::{SpaceViewBlueprint, ViewportBlueprint}; +use crate::{ViewBlueprint, ViewportBlueprint}; use re_ui::UiExt as _; use re_viewer_context::{ - blueprint_id_to_tile_id, icon_for_container_kind, ContainerId, RecommendedSpaceView, - ViewerContext, + blueprint_id_to_tile_id, icon_for_container_kind, ContainerId, RecommendedView, ViewerContext, }; #[derive(Default)] -pub struct AddSpaceViewOrContainerModal { +pub struct AddViewOrContainerModal { target_container: Option, modal_handler: re_ui::modal::ModalHandler, } -impl AddSpaceViewOrContainerModal { +impl AddViewOrContainerModal { pub(crate) fn open(&mut self, target_container: ContainerId) { self.target_container = Some(target_container); self.modal_handler.open(); @@ -28,7 +27,7 @@ impl AddSpaceViewOrContainerModal { self.modal_handler.ui( egui_ctx, || { - re_ui::modal::ModalWrapper::new("Add space view or container") + re_ui::modal::ModalWrapper::new("Add view or container") .min_width(500.0) .full_span_content(true) }, @@ -104,20 +103,18 @@ fn modal_ui( ui.full_span_separator(); - // space view of any kind - for space_view in ctx - .space_view_class_registry + // view of any kind + for view in ctx + .view_class_registry .iter_registry() - .map(|entry| SpaceViewBlueprint::new(entry.identifier, RecommendedSpaceView::root())) + .map(|entry| ViewBlueprint::new(entry.identifier, RecommendedView::root())) { - let icon = space_view.class(ctx.space_view_class_registry).icon(); - let title = space_view - .class(ctx.space_view_class_registry) - .display_name(); - let subtitle = format!("Create a new space view to display {title} content."); + let icon = view.class(ctx.view_class_registry).icon(); + let title = view.class(ctx.view_class_registry).display_name(); + let subtitle = format!("Create a new view to display {title} content."); if row_ui(ui, icon, title, &subtitle).clicked() { - viewport.add_space_views(std::iter::once(space_view), target_container, None); + viewport.add_views(std::iter::once(view), target_container, None); viewport.mark_user_interaction(ctx); *keep_open = false; } diff --git a/crates/viewer/re_viewport_blueprint/src/ui/mod.rs b/crates/viewer/re_viewport_blueprint/src/ui/mod.rs index f29403825e03..c3bd2aca611b 100644 --- a/crates/viewer/re_viewport_blueprint/src/ui/mod.rs +++ b/crates/viewer/re_viewport_blueprint/src/ui/mod.rs @@ -1,33 +1,30 @@ //! UI utilities related to the viewport blueprint. //! -//! Current this is mainly the add space view or container modal. +//! Current this is mainly the add view or container modal. use parking_lot::Mutex; use re_viewer_context::{ContainerId, ViewerContext}; use crate::ViewportBlueprint; -mod add_space_view_or_container_modal; +mod add_view_or_container_modal; -use add_space_view_or_container_modal::AddSpaceViewOrContainerModal; +use add_view_or_container_modal::AddViewOrContainerModal; -static ADD_SPACE_VIEW_OR_CONTAINER_MODAL: once_cell::sync::Lazy< - Mutex, -> = once_cell::sync::Lazy::new(|| Mutex::new(AddSpaceViewOrContainerModal::default())); +static ADD_VIEW_OR_CONTAINER_MODAL: once_cell::sync::Lazy> = + once_cell::sync::Lazy::new(|| Mutex::new(AddViewOrContainerModal::default())); -pub fn add_space_view_or_container_modal_ui( +pub fn add_view_or_container_modal_ui( ctx: &ViewerContext<'_>, viewport: &ViewportBlueprint, ui: &egui::Ui, ) { // give a chance to the modal to be drawn - ADD_SPACE_VIEW_OR_CONTAINER_MODAL + ADD_VIEW_OR_CONTAINER_MODAL .lock() .ui(ui.ctx(), ctx, viewport); } -pub fn show_add_space_view_or_container_modal(target_container: ContainerId) { - ADD_SPACE_VIEW_OR_CONTAINER_MODAL - .lock() - .open(target_container); +pub fn show_add_view_or_container_modal(target_container: ContainerId) { + ADD_VIEW_OR_CONTAINER_MODAL.lock().open(target_container); } diff --git a/crates/viewer/re_viewport_blueprint/src/space_view.rs b/crates/viewer/re_viewport_blueprint/src/view.rs similarity index 82% rename from crates/viewer/re_viewport_blueprint/src/space_view.rs rename to crates/viewer/re_viewport_blueprint/src/view.rs index 505a8eb02eaf..be3648446e80 100644 --- a/crates/viewer/re_viewport_blueprint/src/space_view.rs +++ b/crates/viewer/re_viewport_blueprint/src/view.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use ahash::HashMap; use itertools::{FoldWhile, Itertools}; use parking_lot::Mutex; -use re_types::{ComponentDescriptor, SpaceViewClassIdentifier}; +use re_types::{ComponentDescriptor, ViewClassIdentifier}; use re_chunk::{Chunk, RowId}; use re_chunk_store::LatestAtQuery; @@ -12,81 +12,78 @@ use re_log_types::{EntityPathSubs, Timeline}; use re_types::{ blueprint::{ archetypes::{self as blueprint_archetypes}, - components::{self as blueprint_components, SpaceViewOrigin, Visible}, + components::{self as blueprint_components, ViewOrigin, Visible}, }, components::Name, }; use re_types_core::Archetype as _; use re_viewer_context::{ - ContentsName, QueryRange, RecommendedSpaceView, SpaceViewClass, SpaceViewClassRegistry, - SpaceViewId, SpaceViewState, StoreContext, SystemCommand, SystemCommandSender as _, - ViewContext, ViewStates, ViewerContext, VisualizerCollection, + ContentsName, QueryRange, RecommendedView, StoreContext, SystemCommand, + SystemCommandSender as _, ViewClass, ViewClassRegistry, ViewContext, ViewId, ViewState, + ViewStates, ViewerContext, VisualizerCollection, }; -use crate::{SpaceViewContents, ViewProperty}; +use crate::{ViewContents, ViewProperty}; /// A view of a space. /// -/// Note: [`SpaceViewBlueprint`] doesn't implement Clone because it stores an internal +/// Note: [`ViewBlueprint`] doesn't implement Clone because it stores an internal /// uuid used for identifying the path of its data in the blueprint store. It's ambiguous /// whether the intent is for a clone to write to the same place. /// -/// If you want a new space view otherwise identical to an existing one, use -/// `re_viewport::ViewportBlueprint::duplicate_space_view`. +/// If you want a new view otherwise identical to an existing one, use +/// `re_viewport::ViewportBlueprint::duplicate_view`. #[derive(Clone, Debug)] -pub struct SpaceViewBlueprint { - pub id: SpaceViewId, +pub struct ViewBlueprint { + pub id: ViewId, pub display_name: Option, - class_identifier: SpaceViewClassIdentifier, + class_identifier: ViewClassIdentifier, - /// The "anchor point" of this space view. - /// The transform at this path forms the reference point for all scene->world transforms in this space view. - /// I.e. the position of this entity path in space forms the origin of the coordinate system in this space view. - /// Furthermore, this is the primary indicator for heuristics on what entities we show in this space view. + /// The "anchor point" of this view. + /// The transform at this path forms the reference point for all scene->world transforms in this view. + /// I.e. the position of this entity path in space forms the origin of the coordinate system in this view. + /// Furthermore, this is the primary indicator for heuristics on what entities we show in this view. pub space_origin: EntityPath, - /// The content of this space view as defined by its queries. - pub contents: SpaceViewContents, + /// The content of this view as defined by its queries. + pub contents: ViewContents, - /// True if this space view is visible in the UI. + /// True if this view is visible in the UI. pub visible: bool, - /// Path where these space views defaults can be found. + /// Path where these views defaults can be found. pub defaults_path: EntityPath, /// Pending blueprint writes for nested components from duplicate. pending_writes: Vec, } -impl SpaceViewBlueprint { +impl ViewBlueprint { /// Path at which a view writes defaults for components. - pub fn defaults_path(view_id: SpaceViewId) -> EntityPath { + pub fn defaults_path(view_id: ViewId) -> EntityPath { view_id.as_entity_path().join(&"defaults".into()) } - /// Creates a new [`SpaceViewBlueprint`] with a single [`SpaceViewContents`]. + /// Creates a new [`ViewBlueprint`] with a single [`ViewContents`]. /// - /// This [`SpaceViewBlueprint`] is ephemeral. If you want to make it permanent you + /// This [`ViewBlueprint`] is ephemeral. If you want to make it permanent you /// must call [`Self::save_to_blueprint_store`]. - pub fn new( - space_view_class: SpaceViewClassIdentifier, - recommended: RecommendedSpaceView, - ) -> Self { - let id = SpaceViewId::random(); + pub fn new(view_class: ViewClassIdentifier, recommended: RecommendedView) -> Self { + let id = ViewId::random(); Self { display_name: None, - class_identifier: space_view_class, + class_identifier: view_class, id, space_origin: recommended.origin, - contents: SpaceViewContents::new(id, space_view_class, recommended.query_filter), + contents: ViewContents::new(id, view_class, recommended.query_filter), visible: true, defaults_path: Self::defaults_path(id), pending_writes: Default::default(), } } - /// Placeholder name displayed in the UI if the user hasn't explicitly named the space view. + /// Placeholder name displayed in the UI if the user hasn't explicitly named the view. pub fn missing_name_placeholder(&self) -> String { let entity_path = self .space_origin @@ -113,7 +110,7 @@ impl SpaceViewBlueprint { } } - /// Returns this space view's display name + /// Returns this view's display name /// /// When returning [`ContentsName::Placeholder`], the UI should display the resulting name using /// `re_ui::LabelStyle::Unnamed`. @@ -124,51 +121,41 @@ impl SpaceViewBlueprint { ) } - /// Attempt to load a [`SpaceViewBlueprint`] from the blueprint store. - pub fn try_from_db( - id: SpaceViewId, - blueprint_db: &EntityDb, - query: &LatestAtQuery, - ) -> Option { + /// Attempt to load a [`ViewBlueprint`] from the blueprint store. + pub fn try_from_db(id: ViewId, blueprint_db: &EntityDb, query: &LatestAtQuery) -> Option { re_tracing::profile_function!(); let results = blueprint_db.storage_engine().cache().latest_at( query, &id.as_entity_path(), - blueprint_archetypes::SpaceViewBlueprint::all_components().iter(), + blueprint_archetypes::ViewBlueprint::all_components().iter(), ); - // This is a required component. Note that when loading space-views we crawl the subtree and so - // cleared empty space-views paths may exist transiently. The fact that they have an empty class_identifier + // This is a required component. Note that when loading views we crawl the subtree and so + // cleared empty views paths may exist transiently. The fact that they have an empty class_identifier // is the marker that the have been cleared and not an error. - let class_identifier = - results.component_instance::(0)?; + let class_identifier = results.component_instance::(0)?; - let blueprint_archetypes::SpaceViewBlueprint { + let blueprint_archetypes::ViewBlueprint { class_identifier, display_name, space_origin, visible, - } = blueprint_archetypes::SpaceViewBlueprint { + } = blueprint_archetypes::ViewBlueprint { class_identifier, display_name: results.component_instance::(0), - space_origin: results.component_instance::(0), + space_origin: results.component_instance::(0), visible: results.component_instance::(0), }; let space_origin = space_origin.map_or_else(EntityPath::root, |origin| origin.0.into()); - let class_identifier: SpaceViewClassIdentifier = class_identifier.0.as_str().into(); + let class_identifier: ViewClassIdentifier = class_identifier.0.as_str().into(); let display_name = display_name.map(|v| v.0.to_string()); let space_env = EntityPathSubs::new_with_origin(&space_origin); - let content = SpaceViewContents::from_db_or_default( - id, - blueprint_db, - query, - class_identifier, - &space_env, - ); + let content = + ViewContents::from_db_or_default(id, blueprint_db, query, class_identifier, &space_env); let visible = visible.map_or(true, |v| *v.0); let defaults_path = id.as_entity_path().join(&"defaults".into()); @@ -184,9 +171,9 @@ impl SpaceViewBlueprint { }) } - /// Persist the entire [`SpaceViewBlueprint`] to the blueprint store. + /// Persist the entire [`ViewBlueprint`] to the blueprint store. /// - /// This only needs to be called if the [`SpaceViewBlueprint`] was created with [`Self::new`]. + /// This only needs to be called if the [`ViewBlueprint`] was created with [`Self::new`]. /// /// Otherwise, incremental calls to `set_` functions will write just the necessary component /// update directly to the store. @@ -204,7 +191,7 @@ impl SpaceViewBlueprint { pending_writes, } = self; - let mut arch = blueprint_archetypes::SpaceViewBlueprint::new(class_identifier.as_str()) + let mut arch = blueprint_archetypes::ViewBlueprint::new(class_identifier.as_str()) .with_space_origin(space_origin) .with_visible(*visible); @@ -212,7 +199,7 @@ impl SpaceViewBlueprint { arch = arch.with_display_name(display_name.clone()); } - // Start with the pending writes, which explicitly filtered out the `SpaceViewBlueprint` + // Start with the pending writes, which explicitly filtered out the `ViewBlueprint` // components from the top level. let mut deltas = pending_writes.clone(); @@ -233,16 +220,16 @@ impl SpaceViewBlueprint { )); } - /// Creates a new [`SpaceViewBlueprint`] with the same contents, but a different [`SpaceViewId`] + /// Creates a new [`ViewBlueprint`] with the same contents, but a different [`ViewId`] /// - /// Also duplicates all the queries in the space view. + /// Also duplicates all the queries in the view. pub fn duplicate(&self, store_context: &StoreContext<'_>, query: &LatestAtQuery) -> Self { let mut pending_writes = Vec::new(); let blueprint = store_context.blueprint; let blueprint_engine = blueprint.storage_engine(); let current_path = self.entity_path(); - let new_id = SpaceViewId::random(); + let new_id = ViewId::random(); let new_path = new_id.as_entity_path(); // Create pending write operations to duplicate the entire subtree @@ -264,11 +251,11 @@ impl SpaceViewBlueprint { .all_components_on_timeline(&query.timeline(), path) .into_iter() .flat_map(|v| v.into_iter()) - // It's important that we don't include the SpaceViewBlueprint's components + // It's important that we don't include the ViewBlueprint's components // since those will be updated separately and may contain different data. .filter(|component_name| { *path != current_path - || !blueprint_archetypes::SpaceViewBlueprint::all_components() + || !blueprint_archetypes::ViewBlueprint::all_components() .iter() .any(|descr| descr.component_name == *component_name) }) @@ -288,9 +275,9 @@ impl SpaceViewBlueprint { }); } - // SpaceViewContents is saved as an archetype in the space view's entity hierarchy. - // This means, that the above already copied the space view contents! - let contents = SpaceViewContents::new( + // ViewContents is saved as an archetype in the view's entity hierarchy. + // This means, that the above already copied the view contents! + let contents = ViewContents::new( new_id, self.class_identifier, self.contents.entity_path_filter.clone(), @@ -335,7 +322,7 @@ impl SpaceViewBlueprint { #[inline] pub fn set_origin(&self, ctx: &ViewerContext<'_>, origin: &EntityPath) { if origin != &self.space_origin { - let component = SpaceViewOrigin(origin.into()); + let component = ViewOrigin(origin.into()); ctx.save_blueprint_component(&self.entity_path(), &component); } } @@ -348,15 +335,15 @@ impl SpaceViewBlueprint { } } - pub fn class_identifier(&self) -> SpaceViewClassIdentifier { + pub fn class_identifier(&self) -> ViewClassIdentifier { self.class_identifier } pub fn class<'a>( &self, - space_view_class_registry: &'a re_viewer_context::SpaceViewClassRegistry, - ) -> &'a dyn SpaceViewClass { - space_view_class_registry.get_class_or_log_error(self.class_identifier) + view_class_registry: &'a re_viewer_context::ViewClassRegistry, + ) -> &'a dyn ViewClass { + view_class_registry.get_class_or_log_error(self.class_identifier) } #[inline] @@ -369,8 +356,8 @@ impl SpaceViewBlueprint { blueprint: &EntityDb, blueprint_query: &LatestAtQuery, active_timeline: &Timeline, - space_view_class_registry: &SpaceViewClassRegistry, - view_state: &dyn SpaceViewState, + view_class_registry: &ViewClassRegistry, + view_state: &dyn ViewState, ) -> QueryRange { // Visual time range works with regular overrides for the most part but it's a bit special: // * we need it for all entities unconditionally @@ -392,9 +379,8 @@ impl SpaceViewBlueprint { }); time_range.map_or_else( || { - let space_view_class = - space_view_class_registry.get_class_or_log_error(self.class_identifier); - space_view_class.default_query_range(view_state) + let view_class = view_class_registry.get_class_or_log_error(self.class_identifier); + view_class.default_query_range(view_state) }, |time_range| QueryRange::TimeRange(time_range.clone()), ) @@ -406,7 +392,7 @@ impl SpaceViewBlueprint { view_states: &'a mut ViewStates, ) -> ViewContext<'a> { let class = ctx - .space_view_class_registry + .view_class_registry .get_class_or_log_error(self.class_identifier()); let view_state = view_states.get_mut_or_create(self.id, class); @@ -422,7 +408,7 @@ impl SpaceViewBlueprint { pub fn bundle_context_with_state<'a>( &'a self, ctx: &'a ViewerContext<'a>, - view_state: &'a dyn SpaceViewState, + view_state: &'a dyn ViewState, ) -> ViewContext<'a> { ViewContext { viewer_ctx: ctx, @@ -435,7 +421,7 @@ impl SpaceViewBlueprint { fn visualizer_collection(&self, ctx: &ViewerContext<'_>) -> Arc { static VISUALIZER_FOR_CONTEXT: once_cell::sync::Lazy< - Mutex>>, + Mutex>>, > = once_cell::sync::Lazy::new(Default::default); VISUALIZER_FOR_CONTEXT @@ -443,7 +429,7 @@ impl SpaceViewBlueprint { .entry(self.class_identifier()) .or_insert_with(|| { Arc::new( - ctx.space_view_class_registry + ctx.view_class_registry .new_visualizer_collection(self.class_identifier()), ) }) @@ -467,7 +453,7 @@ mod tests { PerVisualizer, StoreContext, VisualizableEntities, }; - use crate::space_view_contents::DataQueryPropertyResolver; + use crate::view_contents::DataQueryPropertyResolver; use super::*; @@ -514,22 +500,22 @@ mod tests { .collect(), ); - // Basic blueprint - a single space view that queries everything. - let space_view = SpaceViewBlueprint::new("3D".into(), RecommendedSpaceView::root()); - let individual_override_root = space_view + // Basic blueprint - a single view that queries everything. + let view = ViewBlueprint::new("3D".into(), RecommendedView::root()); + let individual_override_root = view .contents .blueprint_entity_path .join(&DataResult::INDIVIDUAL_OVERRIDES_PREFIX.into()); - let recursive_override_root = space_view + let recursive_override_root = view .contents .blueprint_entity_path .join(&DataResult::RECURSIVE_OVERRIDES_PREFIX.into()); // Things needed to resolve properties: let indicated_entities_per_visualizer = PerVisualizer::::default(); // Don't care about indicated entities. - let resolver = space_view.contents.build_resolver( - &test_ctx.space_view_class_registry, - &space_view, + let resolver = view.contents.build_resolver( + &test_ctx.view_class_registry, + &view, &applicable_entities, &visualizable_entities, &indicated_entities_per_visualizer, @@ -728,12 +714,8 @@ mod tests { } // Set up a store query and update the overrides. - let query_result = update_overrides( - &test_ctx, - &space_view.contents, - &visualizable_entities, - &resolver, - ); + let query_result = + update_overrides(&test_ctx, &view.contents, &visualizable_entities, &resolver); // Extract component overrides for testing. let mut visited: HashMap> = @@ -763,7 +745,7 @@ mod tests { fn update_overrides( test_ctx: &TestContext, - contents: &SpaceViewContents, + contents: &ViewContents, visualizable_entities: &PerVisualizer, resolver: &DataQueryPropertyResolver<'_>, ) -> re_viewer_context::DataQueryResult { @@ -785,7 +767,7 @@ mod tests { ctx.blueprint_db(), ctx.blueprint_query, ctx.rec_cfg.time_ctrl.read().timeline(), - ctx.space_view_class_registry, + ctx.view_class_registry, &mut query_result, &mut view_states, ); diff --git a/crates/viewer/re_viewport_blueprint/src/space_view_contents.rs b/crates/viewer/re_viewport_blueprint/src/view_contents.rs similarity index 90% rename from crates/viewer/re_viewport_blueprint/src/space_view_contents.rs rename to crates/viewer/re_viewport_blueprint/src/view_contents.rs index f4a68a3279cd..720be6c9ccec 100644 --- a/crates/viewer/re_viewport_blueprint/src/space_view_contents.rs +++ b/crates/viewer/re_viewport_blueprint/src/view_contents.rs @@ -11,38 +11,38 @@ use re_types::{ archetypes as blueprint_archetypes, components as blueprint_components, components::QueryExpression, }, - Archetype as _, SpaceViewClassIdentifier, + Archetype as _, ViewClassIdentifier, }; use re_types_blueprint::blueprint::components::VisualizerOverrides; use re_types_core::ComponentName; use re_viewer_context::{ ApplicableEntities, DataQueryResult, DataResult, DataResultHandle, DataResultNode, DataResultTree, IndicatedEntities, OverridePath, PerVisualizer, PropertyOverrides, QueryRange, - SpaceViewClassRegistry, SpaceViewId, ViewStates, ViewerContext, VisualizableEntities, + ViewClassRegistry, ViewId, ViewStates, ViewerContext, VisualizableEntities, }; -use crate::{SpaceViewBlueprint, ViewProperty}; +use crate::{ViewBlueprint, ViewProperty}; -/// Data to be added to a space view, built from a [`blueprint_archetypes::SpaceViewContents`]. +/// Data to be added to a view, built from a [`blueprint_archetypes::ViewContents`]. /// /// During execution, it will walk an [`EntityTree`] and return a [`DataResultTree`] /// containing any entities that match a [`EntityPathFilter`]. /// -/// Note: [`SpaceViewContents`] doesn't implement Clone because it depends on its parent's [`SpaceViewId`] +/// Note: [`ViewContents`] doesn't implement Clone because it depends on its parent's [`ViewId`] /// used for identifying the path of its data in the blueprint store. It's ambiguous /// whether the intent is for a clone to write to the same place. /// -/// If you want a new space view otherwise identical to an existing one, use -/// [`SpaceViewBlueprint::duplicate`]. +/// If you want a new view otherwise identical to an existing one, use +/// [`ViewBlueprint::duplicate`]. #[derive(Clone, Debug)] -pub struct SpaceViewContents { +pub struct ViewContents { pub blueprint_entity_path: EntityPath, - pub view_class_identifier: SpaceViewClassIdentifier, + pub view_class_identifier: ViewClassIdentifier, pub entity_path_filter: EntityPathFilter, } -impl SpaceViewContents { +impl ViewContents { pub fn is_equivalent(&self, other: &Self) -> bool { self.view_class_identifier.eq(&other.view_class_identifier) && self.entity_path_filter.eq(&other.entity_path_filter) @@ -57,7 +57,7 @@ impl SpaceViewContents { /// query does in fact cover the other query. However, it should never return `true` /// in a case where the other query would not be fully covered. pub fn entity_path_filter_is_superset_of(&self, other: &Self) -> bool { - // A query can't fully contain another if their space-view classes don't match + // A query can't fully contain another if their view classes don't match if self.view_class_identifier != other.view_class_identifier { return false; } @@ -68,20 +68,20 @@ impl SpaceViewContents { } } -impl SpaceViewContents { - /// Creates a new [`SpaceViewContents`]. +impl ViewContents { + /// Creates a new [`ViewContents`]. /// - /// This [`SpaceViewContents`] is ephemeral. It must be saved by calling - /// `save_to_blueprint_store` on the enclosing `SpaceViewBlueprint`. + /// This [`ViewContents`] is ephemeral. It must be saved by calling + /// `save_to_blueprint_store` on the enclosing `ViewBlueprint`. pub fn new( - id: SpaceViewId, - view_class_identifier: SpaceViewClassIdentifier, + id: ViewId, + view_class_identifier: ViewClassIdentifier, entity_path_filter: EntityPathFilter, ) -> Self { - // Don't use `entity_path_for_space_view_sub_archetype` here because this will do a search in the future, + // Don't use `entity_path_for_view_sub_archetype` here because this will do a search in the future, // thus needing the entity tree. let blueprint_entity_path = id.as_entity_path().join(&EntityPath::from_single_string( - blueprint_archetypes::SpaceViewContents::name().short_name(), + blueprint_archetypes::ViewContents::name().short_name(), )); Self { @@ -91,15 +91,15 @@ impl SpaceViewContents { } } - /// Attempt to load a [`SpaceViewContents`] from the blueprint store. + /// Attempt to load a [`ViewContents`] from the blueprint store. pub fn from_db_or_default( - view_id: SpaceViewId, + view_id: ViewId, blueprint_db: &EntityDb, query: &LatestAtQuery, - view_class_identifier: SpaceViewClassIdentifier, + view_class_identifier: ViewClassIdentifier, space_env: &EntityPathSubs, ) -> Self { - let property = ViewProperty::from_archetype::( + let property = ViewProperty::from_archetype::( blueprint_db, query, view_id, @@ -109,7 +109,7 @@ impl SpaceViewContents { Err(err) => { re_log::warn_once!( - "Failed to load SpaceViewContents for {:?} from blueprint store at {:?}: {}", + "Failed to load ViewContents for {:?} from blueprint store at {:?}: {}", view_id, property.blueprint_store_path, err @@ -129,18 +129,16 @@ impl SpaceViewContents { } } - /// Persist the entire [`SpaceViewContents`] to the blueprint store. + /// Persist the entire [`ViewContents`] to the blueprint store. /// - /// This only needs to be called if the [`SpaceViewContents`] was created with [`Self::new`]. + /// This only needs to be called if the [`ViewContents`] was created with [`Self::new`]. /// /// Otherwise, incremental calls to `set_` functions will write just the necessary component /// update directly to the store. pub fn save_to_blueprint_store(&self, ctx: &ViewerContext<'_>) { ctx.save_blueprint_archetype( &self.blueprint_entity_path, - &blueprint_archetypes::SpaceViewContents::new( - self.entity_path_filter.iter_expressions(), - ), + &blueprint_archetypes::ViewContents::new(self.entity_path_filter.iter_expressions()), ); } @@ -164,8 +162,8 @@ impl SpaceViewContents { pub fn build_resolver<'a>( &self, - space_view_class_registry: &'a re_viewer_context::SpaceViewClassRegistry, - space_view: &'a SpaceViewBlueprint, + view_class_registry: &'a re_viewer_context::ViewClassRegistry, + view: &'a ViewBlueprint, applicable_entities_per_visualizer: &'a PerVisualizer, visualizable_entities_per_visualizer: &'a PerVisualizer, indicated_entities_per_visualizer: &'a PerVisualizer, @@ -176,8 +174,8 @@ impl SpaceViewContents { let recursive_override_root = base_override_root.join(&DataResult::RECURSIVE_OVERRIDES_PREFIX.into()); DataQueryPropertyResolver { - space_view_class_registry, - space_view, + view_class_registry, + view, individual_override_root, recursive_override_root, applicable_entities_per_visualizer, @@ -226,7 +224,7 @@ impl SpaceViewContents { self.set_entity_path_filter(ctx, &new_entity_path_filter); } - /// Build up the initial [`DataQueryResult`] for this [`SpaceViewContents`] + /// Build up the initial [`DataQueryResult`] for this [`ViewContents`] /// /// Note that this result will not have any resolved [`PropertyOverrides`]. Those can /// be added by separately calling `DataQueryPropertyResolver::update_overrides` on @@ -271,7 +269,7 @@ impl SpaceViewContents { } } -/// Helper struct for executing the query from [`SpaceViewContents`] +/// Helper struct for executing the query from [`ViewContents`] /// /// This restructures the [`QueryExpression`] into several sets that are /// used to efficiently determine if we should continue the walk or switch @@ -307,7 +305,7 @@ impl QueryExpressionEvaluator<'_> { *num_matching_entities += matches_filter as usize; // This list will be updated below during `update_overrides_recursive` by calling `choose_default_visualizers` - // on the space view. + // on the view. let visualizers: SmallVec<[_; 4]> = if matches_filter { self.visualizable_entities_for_visualizer_systems .iter() @@ -357,8 +355,8 @@ impl QueryExpressionEvaluator<'_> { } pub struct DataQueryPropertyResolver<'a> { - space_view_class_registry: &'a re_viewer_context::SpaceViewClassRegistry, - space_view: &'a SpaceViewBlueprint, + view_class_registry: &'a re_viewer_context::ViewClassRegistry, + view: &'a ViewBlueprint, individual_override_root: EntityPath, recursive_override_root: EntityPath, applicable_entities_per_visualizer: &'a PerVisualizer, @@ -408,10 +406,10 @@ impl DataQueryPropertyResolver<'_> { node.data_result.visualizers = viz_override.0.iter().map(Into::into).collect(); } else { - // Otherwise ask the `SpaceViewClass` to choose. + // Otherwise ask the `ViewClass` to choose. node.data_result.visualizers = self - .space_view - .class(self.space_view_class_registry) + .view + .class(self.view_class_registry) .choose_default_visualizers( &node.data_result.entity_path, self.applicable_entities_per_visualizer, @@ -522,7 +520,7 @@ impl DataQueryPropertyResolver<'_> { blueprint: &EntityDb, blueprint_query: &LatestAtQuery, active_timeline: &Timeline, - space_view_class_registry: &SpaceViewClassRegistry, + view_class_registry: &ViewClassRegistry, query_result: &mut DataQueryResult, view_states: &mut ViewStates, ) { @@ -531,14 +529,14 @@ impl DataQueryPropertyResolver<'_> { if let Some(root) = query_result.tree.root_handle() { let recursive_property_overrides = Default::default(); - let class = self.space_view.class(space_view_class_registry); - let view_state = view_states.get_mut_or_create(self.space_view.id, class); + let class = self.view.class(view_class_registry); + let view_state = view_states.get_mut_or_create(self.view.id, class); - let default_query_range = self.space_view.query_range( + let default_query_range = self.view.query_range( blueprint, blueprint_query, active_timeline, - space_view_class_registry, + view_class_registry, view_state, ); @@ -700,8 +698,8 @@ mod tests { ]; for (i, Scenario { filter, outputs }) in scenarios.into_iter().enumerate() { - let contents = SpaceViewContents::new( - SpaceViewId::random(), + let contents = ViewContents::new( + ViewId::random(), "3D".into(), EntityPathFilter::parse_forgiving(filter, &space_env), ); diff --git a/crates/viewer/re_viewport_blueprint/src/view_properties.rs b/crates/viewer/re_viewport_blueprint/src/view_properties.rs index 119bd049ab6e..4df9945f0a93 100644 --- a/crates/viewer/re_viewport_blueprint/src/view_properties.rs +++ b/crates/viewer/re_viewport_blueprint/src/view_properties.rs @@ -6,7 +6,7 @@ use re_types::{ }; use re_viewer_context::{ external::re_entity_db::EntityTree, ComponentFallbackError, ComponentFallbackProvider, - QueryContext, SpaceViewId, SpaceViewSystemExecutionError, ViewerContext, + QueryContext, ViewId, ViewSystemExecutionError, ViewerContext, }; #[derive(thiserror::Error, Debug)] @@ -18,7 +18,7 @@ pub enum ViewPropertyQueryError { ComponentFallbackError(#[from] ComponentFallbackError), } -impl From for SpaceViewSystemExecutionError { +impl From for ViewSystemExecutionError { fn from(val: ViewPropertyQueryError) -> Self { match val { ViewPropertyQueryError::SerializationError(err) => err.into(), @@ -51,7 +51,7 @@ impl ViewProperty { pub fn from_archetype( blueprint_db: &EntityDb, blueprint_query: &LatestAtQuery, - view_id: SpaceViewId, + view_id: ViewId, ) -> Self { Self::from_archetype_impl( blueprint_db, @@ -68,12 +68,12 @@ impl ViewProperty { fn from_archetype_impl( blueprint_db: &EntityDb, blueprint_query: LatestAtQuery, - space_view_id: SpaceViewId, + view_id: ViewId, archetype_name: ArchetypeName, component_names: Vec, ) -> Self { let blueprint_store_path = - entity_path_for_view_property(space_view_id, blueprint_db.tree(), archetype_name); + entity_path_for_view_property(view_id, blueprint_db.tree(), archetype_name); let query_results = blueprint_db.latest_at( &blueprint_query, @@ -97,7 +97,7 @@ impl ViewProperty { &self, ctx: &ViewerContext<'_>, fallback_provider: &dyn ComponentFallbackProvider, - view_state: &dyn re_viewer_context::SpaceViewState, + view_state: &dyn re_viewer_context::ViewState, ) -> Result { self.component_array_or_fallback::(ctx, fallback_provider, view_state)? .into_iter() @@ -110,7 +110,7 @@ impl ViewProperty { &self, ctx: &ViewerContext<'_>, fallback_provider: &dyn ComponentFallbackProvider, - view_state: &dyn re_viewer_context::SpaceViewState, + view_state: &dyn re_viewer_context::ViewState, ) -> Result, ViewPropertyQueryError> { let component_name = C::name(); C::from_arrow2( @@ -167,7 +167,7 @@ impl ViewProperty { ctx: &ViewerContext<'_>, component_name: ComponentName, fallback_provider: &dyn ComponentFallbackProvider, - view_state: &dyn re_viewer_context::SpaceViewState, + view_state: &dyn re_viewer_context::ViewState, ) -> Box { if let Some(value) = self.component_raw(component_name) { if value.len() > 0 { @@ -223,7 +223,7 @@ impl ViewProperty { pub fn query_context<'a>( &'a self, viewer_ctx: &'a ViewerContext<'_>, - view_state: &'a dyn re_viewer_context::SpaceViewState, + view_state: &'a dyn re_viewer_context::ViewState, ) -> QueryContext<'a> { QueryContext { viewer_ctx, @@ -239,7 +239,7 @@ impl ViewProperty { /// Entity path in the blueprint store where all components of the given view property archetype are /// stored. pub fn entity_path_for_view_property( - space_view_id: SpaceViewId, + view_id: ViewId, _blueprint_entity_tree: &EntityTree, archetype_name: ArchetypeName, ) -> EntityPath { @@ -248,8 +248,8 @@ pub fn entity_path_for_view_property( // Only if none is found we make up a new (standardized) path. // There's some nuances to figure out what happens when we find the archetype several times. // Also, we need to specify what it means to "find" the archetype (likely just matching the indicator?). - let space_view_blueprint_path = space_view_id.as_entity_path(); + let view_blueprint_path = view_id.as_entity_path(); // Use short_name instead of full_name since full_name has dots and looks too much like an indicator component. - space_view_blueprint_path.join(&EntityPath::from_single_string(archetype_name.short_name())) + view_blueprint_path.join(&EntityPath::from_single_string(archetype_name.short_name())) } diff --git a/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs b/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs index c8453466ef1f..7e235c0508c7 100644 --- a/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs +++ b/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs @@ -15,17 +15,17 @@ use smallvec::SmallVec; use re_chunk_store::LatestAtQuery; use re_entity_db::EntityPath; use re_types::{ - blueprint::components::ViewerRecommendationHash, Archetype as _, SpaceViewClassIdentifier, + blueprint::components::ViewerRecommendationHash, Archetype as _, ViewClassIdentifier, }; use re_types_blueprint::blueprint::{ archetypes as blueprint_archetypes, - components::{AutoLayout, AutoSpaceViews, RootContainer, SpaceViewMaximized}, + components::{AutoLayout, AutoViews, RootContainer, ViewMaximized}, }; use re_viewer_context::{ - blueprint_id_to_tile_id, ContainerId, Contents, Item, SpaceViewId, ViewerContext, + blueprint_id_to_tile_id, ContainerId, Contents, Item, ViewId, ViewerContext, }; -use crate::{container::ContainerBlueprint, SpaceViewBlueprint, ViewportCommand, VIEWPORT_PATH}; +use crate::{container::ContainerBlueprint, ViewBlueprint, ViewportCommand, VIEWPORT_PATH}; // ---------------------------------------------------------------------------- @@ -38,10 +38,10 @@ use crate::{container::ContainerBlueprint, SpaceViewBlueprint, ViewportCommand, /// Any change is queued up into [`Self::deferred_commands`] and applied at the end of the frame, /// right before saving to the blueprint store. pub struct ViewportBlueprint { - /// Where the space views are stored. + /// Where the views are stored. /// - /// Not a hashmap in order to preserve the order of the space views. - pub space_views: BTreeMap, + /// Not a hashmap in order to preserve the order of the views. + pub views: BTreeMap, /// All the containers found in the viewport. pub containers: BTreeMap, @@ -49,30 +49,30 @@ pub struct ViewportBlueprint { /// The root container. pub root_container: ContainerId, - /// The layouts of all the space views. + /// The layouts of all the views. /// /// If [`Self::maximized`] is set, this tree is ignored. - pub tree: egui_tiles::Tree, + pub tree: egui_tiles::Tree, - /// Show only one space-view as maximized? + /// Show only one view as maximized? /// /// If set, [`Self::tree`] is ignored. - pub maximized: Option, + pub maximized: Option, /// Whether the viewport layout is determined automatically. /// - /// If `true`, we auto-layout all space-views whenever a new space-view is added. + /// If `true`, we auto-layout all views whenever a new view is added. /// /// Set to `false` the first time the user messes around with the viewport blueprint. /// Note: we use an atomic here because writes needs to be effective immediately during the frame. auto_layout: AtomicBool, - /// Whether space views should be created automatically for entities that are not already in a space. + /// Whether views should be created automatically for entities that are not already in a space. /// /// Note: we use an atomic here because writes needs to be effective immediately during the frame. - auto_space_views: AtomicBool, + auto_views: AtomicBool, - /// Hashes of all recommended space views the viewer has already added and that should not be added again. + /// Hashes of all recommended views the viewer has already added and that should not be added again. past_viewer_recommendations: IntSet, /// Blueprint mutation events that will be processed at the end of the frame. @@ -80,7 +80,7 @@ pub struct ViewportBlueprint { } impl ViewportBlueprint { - /// Attempt to load a [`SpaceViewBlueprint`] from the blueprint store. + /// Attempt to load a [`ViewBlueprint`] from the blueprint store. pub fn try_from_db(blueprint_db: &re_entity_db::EntityDb, query: &LatestAtQuery) -> Self { re_tracing::profile_function!(); @@ -96,13 +96,13 @@ impl ViewportBlueprint { root_container, maximized, auto_layout, - auto_space_views, + auto_views, past_viewer_recommendations, } = blueprint_archetypes::ViewportBlueprint { root_container: results.component_instance(0), maximized: results.component_instance(0), auto_layout: results.component_instance(0), - auto_space_views: results.component_instance(0), + auto_views: results.component_instance(0), past_viewer_recommendations: results.component_batch(), }; @@ -110,7 +110,7 @@ impl ViewportBlueprint { re_log::trace_once!("Loaded root_container: {root_container:?}"); let mut containers: BTreeMap = Default::default(); - let mut all_space_view_ids: Vec = Default::default(); + let mut all_view_ids: Vec = Default::default(); if let Some(root_container) = root_container { re_tracing::profile_scope!("visit_all_containers"); @@ -121,8 +121,8 @@ impl ViewportBlueprint { for &content in &container.contents { match content { Contents::Container(id) => container_ids_to_visit.push(id), - Contents::SpaceView(id) => { - all_space_view_ids.push(id); + Contents::View(id) => { + all_view_ids.push(id); } } } @@ -133,23 +133,21 @@ impl ViewportBlueprint { } } - let space_views: BTreeMap = all_space_view_ids + let views: BTreeMap = all_view_ids .into_iter() - .filter_map(|space_view: SpaceViewId| { - SpaceViewBlueprint::try_from_db(space_view, blueprint_db, query) - }) + .filter_map(|view: ViewId| ViewBlueprint::try_from_db(view, blueprint_db, query)) .map(|sv| (sv.id, sv)) .collect(); - // Auto layouting and auto space view are only enabled if no blueprint has been provided by the user. - // Only enable auto-space-views if this is the app-default blueprint + // Auto layouting and auto view are only enabled if no blueprint has been provided by the user. + // Only enable auto-views if this is the app-default blueprint let is_app_default_blueprint = blueprint_db .store_info() .map_or(false, |ri| ri.is_app_default_blueprint()); let auto_layout = AtomicBool::new(auto_layout.map_or(is_app_default_blueprint, |auto| *auto.0)); - let auto_space_views = - AtomicBool::new(auto_space_views.map_or(is_app_default_blueprint, |auto| *auto.0)); + let auto_views = + AtomicBool::new(auto_views.map_or(is_app_default_blueprint, |auto| *auto.0)); let root_container = root_container.unwrap_or_else(|| { let new_root_id = ContainerId::hashed_from_str("placeholder_root_container"); @@ -157,8 +155,8 @@ impl ViewportBlueprint { new_root_id }); - let tree = build_tree_from_space_views_and_containers( - space_views.values(), + let tree = build_tree_from_views_and_containers( + views.values(), containers.values(), root_container, ); @@ -172,13 +170,13 @@ impl ViewportBlueprint { .collect(); Self { - space_views, + views, containers, root_container, tree, maximized: maximized.map(|id| id.0.into()), auto_layout, - auto_space_views, + auto_views, past_viewer_recommendations, deferred_commands: Default::default(), } @@ -194,15 +192,15 @@ impl ViewportBlueprint { /// take the conservative stance that if any view is still usable we will still /// treat the blueprint as valid and show it. pub fn is_invalid(&self) -> bool { - !self.space_views.is_empty() + !self.views.is_empty() && self - .space_views + .views .values() - .all(|sv| sv.class_identifier() == SpaceViewClassIdentifier::invalid()) + .all(|sv| sv.class_identifier() == ViewClassIdentifier::invalid()) } - pub fn space_view_ids(&self) -> impl Iterator + '_ { - self.space_views.keys() + pub fn view_ids(&self) -> impl Iterator + '_ { + self.views.keys() } /// Find the parent container of a given contents. @@ -216,37 +214,32 @@ impl ViewportBlueprint { }) } - pub fn view(&self, space_view: &SpaceViewId) -> Option<&SpaceViewBlueprint> { - self.space_views.get(space_view) + pub fn view(&self, view: &ViewId) -> Option<&ViewBlueprint> { + self.views.get(view) } pub fn container(&self, container_id: &ContainerId) -> Option<&ContainerBlueprint> { self.containers.get(container_id) } - /// Duplicates a space view and its entity property overrides. - pub fn duplicate_space_view( - &self, - space_view_id: &SpaceViewId, - ctx: &ViewerContext<'_>, - ) -> Option { - let space_view = self.view(space_view_id)?; + /// Duplicates a view and its entity property overrides. + pub fn duplicate_view(&self, view_id: &ViewId, ctx: &ViewerContext<'_>) -> Option { + let view = self.view(view_id)?; - let new_space_view = space_view.duplicate(ctx.store_context, ctx.blueprint_query); - let new_space_view_id = new_space_view.id; + let new_view = view.duplicate(ctx.store_context, ctx.blueprint_query); + let new_view_id = new_view.id; - let parent_and_pos = - self.find_parent_and_position_index(&Contents::SpaceView(*space_view_id)); + let parent_and_pos = self.find_parent_and_position_index(&Contents::View(*view_id)); - self.add_space_views( - std::iter::once(new_space_view), + self.add_views( + std::iter::once(new_view), parent_and_pos.map(|(parent, _)| parent), parent_and_pos.map(|(_, pos)| pos), ); self.mark_user_interaction(ctx); - Some(new_space_view_id) + Some(new_view_id) } /// If `false`, the item is referring to data that is not present in this blueprint. @@ -270,17 +263,17 @@ impl ViewportBlueprint { | Item::ComponentPath(_) | Item::InstancePath(_) => true, - Item::SpaceView(space_view_id) => self.view(space_view_id).is_some(), + Item::View(view_id) => self.view(view_id).is_some(), - Item::DataResult(space_view_id, instance_path) => { - self.view(space_view_id).map_or(false, |space_view| { + Item::DataResult(view_id, instance_path) => { + self.view(view_id).map_or(false, |view| { let entity_path = &instance_path.entity_path; // TODO(#5742): including any path that is—or descend from—the space origin is // necessary because such items may actually be displayed in the blueprint tree. - entity_path == &space_view.space_origin - || entity_path.is_descendant_of(&space_view.space_origin) - || space_view + entity_path == &view.space_origin + || entity_path.is_descendant_of(&view.space_origin) + || view .contents .entity_path_filter .matches(&instance_path.entity_path) @@ -301,32 +294,32 @@ impl ViewportBlueprint { } self.set_auto_layout(false, ctx); - self.set_auto_space_views(false, ctx); + self.set_auto_views(false, ctx); } - /// Spawns new space views if enabled. - pub fn spawn_heuristic_space_views(&self, ctx: &ViewerContext<'_>) { - if !self.auto_space_views() { + /// Spawns new views if enabled. + pub fn spawn_heuristic_views(&self, ctx: &ViewerContext<'_>) { + if !self.auto_views() { return; } re_tracing::profile_function!(); - for entry in ctx.space_view_class_registry.iter_registry() { + for entry in ctx.view_class_registry.iter_registry() { let class_id = entry.identifier; - let mut recommended_space_views = entry.class.spawn_heuristics(ctx).into_vec(); + let mut recommended_views = entry.class.spawn_heuristics(ctx).into_vec(); re_tracing::profile_scope!("filter_recommendations_for", class_id); - // Remove all space views that we already spawned via heuristic before. - recommended_space_views.retain(|recommended_view| { + // Remove all views that we already spawned via heuristic before. + recommended_views.retain(|recommended_view| { !self .past_viewer_recommendations .contains(&recommended_view.recommendation_hash(class_id)) }); // Each of the remaining recommendations would individually be a candidate for spawning if there were - // no other space views in the viewport. + // no other views in the viewport. // In the following steps we further filter this list depending on what's on screen already, // as well as redundancy within the recommendation itself BUT this is an important checkpoint: // All the other views may change due to user interaction, but this does *not* mean @@ -337,15 +330,15 @@ impl ViewportBlueprint { // Example: // Recommendation contains `/**` and `/camera/**`. // We filter out `/camera/**` because that would be redundant to `/**`. - // If now the user edits the space view at `/**` to be `/points/**`, that does *not* + // If now the user edits the view at `/**` to be `/points/**`, that does *not* // mean we should suddenly add `/camera/**` to the viewport. - if !recommended_space_views.is_empty() { + if !recommended_views.is_empty() { let new_viewer_recommendation_hashes: Vec = self .past_viewer_recommendations .iter() .cloned() .chain( - recommended_space_views + recommended_views .iter() .map(|recommendation| recommendation.recommendation_hash(class_id)), ) @@ -357,71 +350,67 @@ impl ViewportBlueprint { ); } - // Remove all space views that have all the entities we already have on screen. + // Remove all views that have all the entities we already have on screen. let existing_path_filters = self - .space_views + .views .values() - .filter(|space_view| space_view.class_identifier() == class_id) - .map(|space_view| &space_view.contents.entity_path_filter) + .filter(|view| view.class_identifier() == class_id) + .map(|view| &view.contents.entity_path_filter) .collect::>(); - recommended_space_views.retain(|recommended_view| { + recommended_views.retain(|recommended_view| { existing_path_filters.iter().all(|existing_filter| { !existing_filter.is_superset_of(&recommended_view.query_filter) }) }); - // Remove all space views that are redundant within the remaining recommendation. - // This n^2 loop should only run ever for frames that add new space views. - let final_recommendations = recommended_space_views + // Remove all views that are redundant within the remaining recommendation. + // This n^2 loop should only run ever for frames that add new views. + let final_recommendations = recommended_views .iter() .enumerate() .filter(|(j, candidate)| { - recommended_space_views - .iter() - .enumerate() - .all(|(i, other)| { - i == *j || !other.query_filter.is_superset_of(&candidate.query_filter) - }) + recommended_views.iter().enumerate().all(|(i, other)| { + i == *j || !other.query_filter.is_superset_of(&candidate.query_filter) + }) }) .map(|(_, recommendation)| recommendation); - self.add_space_views( - final_recommendations.map(|recommendation| { - SpaceViewBlueprint::new(class_id, recommendation.clone()) - }), + self.add_views( + final_recommendations + .map(|recommendation| ViewBlueprint::new(class_id, recommendation.clone())), None, None, ); } } - /// Add a set of space views to the viewport. + /// Add a set of views to the viewport. /// - /// The space view is added to the root container, or, if provided, to a given parent container. - /// The list of created space view IDs is returned. + /// The view is added to the root container, or, if provided, to a given parent container. + /// The list of created view IDs is returned. /// /// Note that this doesn't focus the corresponding tab. Use [`Self::focus_tab`] with the returned ID /// if needed. - pub fn add_space_views( + pub fn add_views( &self, - space_views: impl Iterator, + views: impl Iterator, parent_container: Option, position_in_parent: Option, ) { - for space_view in space_views { - self.enqueue_command(ViewportCommand::AddSpaceView { - space_view, + for view in views { + self.enqueue_command(ViewportCommand::AddView { + view, parent_container, position_in_parent, }); } } - /// Returns an iterator over all the contents (space views and containers) in the viewport. + /// Returns an iterator over all the contents (views and containers) in the viewport. pub fn contents_iter(&self) -> impl Iterator + '_ { - self.space_views + self.views .keys() - .map(|space_view_id| Contents::SpaceView(*space_view_id)) + .map(|view_id| Contents::View(*view_id)) .chain( self.containers .keys() @@ -467,7 +456,7 @@ impl ViewportBlueprint { Contents::Container(container_id) => { self.visit_contents_in_container_impl(container_id, hierarchy, visitor); } - Contents::SpaceView(_) => {} + Contents::View(_) => {} } } hierarchy.pop(); @@ -505,7 +494,7 @@ impl ViewportBlueprint { return res; } } - Contents::SpaceView(_) => {} + Contents::View(_) => {} } } @@ -522,7 +511,7 @@ impl ViewportBlueprint { .is_some() } - /// Given a container or a space view, find its enclosing container and its position within it. + /// Given a container or a view, find its enclosing container and its position within it. pub fn find_parent_and_position_index( &self, contents: &Contents, @@ -554,7 +543,7 @@ impl ViewportBlueprint { return res; } } - Contents::SpaceView(_) => {} + Contents::View(_) => {} } } @@ -575,12 +564,12 @@ impl ViewportBlueprint { }); } - /// Recursively remove a container or a space view. + /// Recursively remove a container or a view. pub fn remove_contents(&self, contents: Contents) { self.enqueue_command(ViewportCommand::RemoveContents(contents)); } - /// Move the `contents` container or space view to the specified target container and position. + /// Move the `contents` container or view to the specified target container and position. pub fn move_contents( &self, contents: Contents, @@ -610,9 +599,9 @@ impl ViewportBlueprint { }); } - /// Make sure the tab corresponding to this space view is focused. - pub fn focus_tab(&self, space_view_id: SpaceViewId) { - self.enqueue_command(ViewportCommand::FocusTab(space_view_id)); + /// Make sure the tab corresponding to this view is focused. + pub fn focus_tab(&self, view_id: ViewId) { + self.enqueue_command(ViewportCommand::FocusTab(view_id)); } /// Set the kind of the provided container. @@ -660,12 +649,12 @@ impl ViewportBlueprint { false } } - Contents::SpaceView(space_view_id) => { - if let Some(space_view) = self.view(space_view_id) { - space_view.visible + Contents::View(view_id) => { + if let Some(view) = self.view(view_id) { + view.visible } else { re_log::warn_once!( - "Visibility check failed due to unknown space view id {space_view_id:?}" + "Visibility check failed due to unknown view id {view_id:?}" ); false @@ -702,21 +691,19 @@ impl ViewportBlueprint { ); } } - Contents::SpaceView(space_view_id) => { - if let Some(space_view) = self.view(space_view_id) { - if visible != space_view.visible { + Contents::View(view_id) => { + if let Some(view) = self.view(view_id) { + if visible != view.visible { if self.auto_layout() { - re_log::trace!( - "Space-view visibility changed - will no longer auto-layout" - ); + re_log::trace!("view visibility changed - will no longer auto-layout"); } self.set_auto_layout(false, ctx); - space_view.set_visible(ctx, visible); + view.set_visible(ctx, visible); } } else { re_log::warn_once!( - "Visibility change failed due to unknown space view id {space_view_id:?}" + "Visibility change failed due to unknown view id {view_id:?}" ); } } @@ -724,17 +711,17 @@ impl ViewportBlueprint { } #[allow(clippy::unused_self)] - pub fn space_views_containing_entity_path( + pub fn views_containing_entity_path( &self, ctx: &ViewerContext<'_>, path: &EntityPath, - ) -> Vec { - self.space_views + ) -> Vec { + self.views .iter() - .filter_map(|(space_view_id, space_view)| { - let query_result = ctx.lookup_query_result(space_view.id); + .filter_map(|(view_id, view)| { + let query_result = ctx.lookup_query_result(view.id); if query_result.tree.lookup_result_by_path(path).is_some() { - Some(*space_view_id) + Some(*view_id) } else { None } @@ -744,7 +731,7 @@ impl ViewportBlueprint { /// Whether the viewport layout is determined automatically. /// - /// If `true`, we auto-layout all space-views whenever a new space-view is added. + /// If `true`, we auto-layout all views whenever a new view is added. /// /// Set to `false` the first time the user messes around with the viewport blueprint. #[inline] @@ -754,7 +741,7 @@ impl ViewportBlueprint { /// Whether the viewport layout is determined automatically. /// - /// If `true`, we auto-layout all space-views whenever a new space-view is added. + /// If `true`, we auto-layout all views whenever a new view is added. /// /// Set to `false` the first time the user messes around with the viewport blueprint. #[inline] @@ -767,28 +754,28 @@ impl ViewportBlueprint { } } - /// Whether space views should be created automatically for entities that are not already in a space. + /// Whether views should be created automatically for entities that are not already in a space. #[inline] - pub fn auto_space_views(&self) -> bool { - self.auto_space_views.load(Ordering::SeqCst) + pub fn auto_views(&self) -> bool { + self.auto_views.load(Ordering::SeqCst) } - /// Whether space views should be created automatically for entities that are not already in a space. + /// Whether views should be created automatically for entities that are not already in a space. #[inline] - pub fn set_auto_space_views(&self, value: bool, ctx: &ViewerContext<'_>) { - let old_value = self.auto_space_views.swap(value, Ordering::SeqCst); + pub fn set_auto_views(&self, value: bool, ctx: &ViewerContext<'_>) { + let old_value = self.auto_views.swap(value, Ordering::SeqCst); if old_value != value { - let auto_space_views = AutoSpaceViews::from(value); - ctx.save_blueprint_component(&VIEWPORT_PATH.into(), &auto_space_views); + let auto_views = AutoViews::from(value); + ctx.save_blueprint_component(&VIEWPORT_PATH.into(), &auto_views); } } #[inline] - pub fn set_maximized(&self, space_view_id: Option, ctx: &ViewerContext<'_>) { - if self.maximized != space_view_id { - let space_view_maximized = space_view_id.map(|id| SpaceViewMaximized(id.into())); - ctx.save_blueprint_component(&VIEWPORT_PATH.into(), &space_view_maximized); + pub fn set_maximized(&self, view_id: Option, ctx: &ViewerContext<'_>) { + if self.maximized != view_id { + let view_maximized = view_id.map(|id| ViewMaximized(id.into())); + ctx.save_blueprint_component(&VIEWPORT_PATH.into(), &view_maximized); } } @@ -816,10 +803,10 @@ impl ViewportBlueprint { continue; } match tile { - egui_tiles::Tile::Pane(space_view_id) => { - // If a container has a pointer to a space-view - // we want it to point at the space-view in the blueprint. - contents_from_tile_id.insert(*tile_id, Contents::SpaceView(*space_view_id)); + egui_tiles::Tile::Pane(view_id) => { + // If a container has a pointer to a view + // we want it to point at the view in the blueprint. + contents_from_tile_id.insert(*tile_id, Contents::View(*view_id)); } egui_tiles::Tile::Container(container) => { if self.tree.root != Some(*tile_id) @@ -827,17 +814,16 @@ impl ViewportBlueprint { && container.num_children() == 1 { // If this is a tab-container with a single child, then it might be a - // "Trivial Tab", which egui_tiles adds to all space-views during simplification + // "Trivial Tab", which egui_tiles adds to all views during simplification // but doesn't need to be persisted back to the store. - if let Some(egui_tiles::Tile::Pane(space_view_id)) = container + if let Some(egui_tiles::Tile::Pane(view_id)) = container .children() .next() .and_then(|child| self.tree.tiles.get(*child)) { // This is a trivial tab -- this tile can point directly to - // the SpaceView and not to a Container. - contents_from_tile_id - .insert(*tile_id, Contents::SpaceView(*space_view_id)); + // the View and not to a Container. + contents_from_tile_id.insert(*tile_id, Contents::View(*view_id)); continue; } } @@ -896,20 +882,20 @@ impl ViewportBlueprint { } } -fn build_tree_from_space_views_and_containers<'a>( - space_views: impl Iterator, +fn build_tree_from_views_and_containers<'a>( + views: impl Iterator, containers: impl Iterator, root_container: ContainerId, -) -> egui_tiles::Tree { +) -> egui_tiles::Tree { re_tracing::profile_function!(); let mut tree = egui_tiles::Tree::empty("viewport_tree"); - // First add all the space_views - for space_view in space_views { - let tile_id = blueprint_id_to_tile_id(&space_view.id); - let pane = egui_tiles::Tile::Pane(space_view.id); + // First add all the views + for view in views { + let tile_id = blueprint_id_to_tile_id(&view.id); + let pane = egui_tiles::Tile::Pane(view.id); tree.tiles.insert(tile_id, pane); - tree.set_visible(tile_id, space_view.visible); + tree.set_visible(tile_id, view.visible); } // Now add all the containers diff --git a/crates/viewer/re_viewport_blueprint/src/viewport_command.rs b/crates/viewer/re_viewport_blueprint/src/viewport_command.rs index e4056b51f8a2..75faddedd3bf 100644 --- a/crates/viewer/re_viewport_blueprint/src/viewport_command.rs +++ b/crates/viewer/re_viewport_blueprint/src/viewport_command.rs @@ -1,6 +1,6 @@ -use re_viewer_context::{ContainerId, Contents, SpaceViewId}; +use re_viewer_context::{ContainerId, Contents, ViewId}; -use crate::SpaceViewBlueprint; +use crate::ViewBlueprint; /// Mutation actions to perform on the viewport tree at the end of the frame. /// @@ -8,11 +8,11 @@ use crate::SpaceViewBlueprint; #[derive(Clone, Debug)] pub enum ViewportCommand { /// Set the whole viewport tree. - SetTree(egui_tiles::Tree), + SetTree(egui_tiles::Tree), - /// Add a new space view to the provided container (or the root if `None`). - AddSpaceView { - space_view: SpaceViewBlueprint, + /// Add a new view to the provided container (or the root if `None`). + AddView { + view: ViewBlueprint, parent_container: Option, position_in_parent: Option, }, @@ -26,10 +26,10 @@ pub enum ViewportCommand { /// Change the kind of a container. SetContainerKind(ContainerId, egui_tiles::ContainerKind), - /// Ensure the tab for the provided space view is focused (see [`egui_tiles::Tree::make_active`]). - FocusTab(SpaceViewId), + /// Ensure the tab for the provided view is focused (see [`egui_tiles::Tree::make_active`]). + FocusTab(ViewId), - /// Remove a container (recursively) or a space view + /// Remove a container (recursively) or a view RemoveContents(Contents), /// Simplify the container with the provided options diff --git a/design/blueprint_store.md b/design/blueprint_store.md index 863c3b69a62e..d2c60859ab08 100644 --- a/design/blueprint_store.md +++ b/design/blueprint_store.md @@ -21,9 +21,9 @@ give users explicit control over the details of how data is displayed in the vie ### UI state includes: - Is the selection panel open? how wide? -- How are my space views organized? -- What data is shown in each space view -- Additional configuration / overrides for the data within each space view +- How are my views organized? +- What data is shown in each view +- Additional configuration / overrides for the data within each view ## Proposal @@ -111,8 +111,8 @@ The assorted objects used in blueprint construction are: - `View2D` - `View3D` - `ViewTimeSeries` - - … additional space-views - - `Data`: A query that builds archetypes to draw in the space view + - … additional views + - `Data`: A query that builds archetypes to draw in the view - `Auto`: A query to automatically build archetypes from an entity path - `Points2D`: A query to build a Points2D archetype - `Points3D`: A query to build a Points3D archetype @@ -245,7 +245,7 @@ The UI components are quite specific for the type of blueprint. Here are a few e * `children` * `type`: "horizontal", "vertical", "auto", … * `sizes`: individual sizes of the children -* Space view +* View * `children` (data blueprints) * `category` ("3D", "text", …) * Data group diff --git a/design/space_views.md b/design/space_views.md index 10c5f648a1eb..a5f2ea85bedd 100644 --- a/design/space_views.md +++ b/design/space_views.md @@ -1,14 +1,14 @@ -# Space views +# Views Status: Mostly implemented. -## What are space views -Space Views visualize a Data Blueprint, i.e. a set of entities with given properties. +## What are views +Views visualize a Data Blueprint, i.e. a set of entities with given properties. They are represented as freely arrangeable tiles in the Viewport. -Most Space Views are interactive, allowing their data to be explored freely. +Most Views are interactive, allowing their data to be explored freely. -## Properties of a space view +## Properties of a view All properties are saved as part of the blueprint. Changing discards Space View State: @@ -27,22 +27,22 @@ Freely mutable: * available at various stages of UI drawing & system execution build-up (see below) -## Space view state -In addition to blueprint stored data, a space view has a class specific `SpaceViewState` +## View state +In addition to blueprint stored data, a view has a class specific `SpaceViewState` which stored ephemeral state that is not persisted as part of the blueprint. This is typically used for animation/transition state. ⚠️ As of writing, we're using this also for state that *should* be persisted and needs to be moved to blueprint components. -## Space view class +## View class Each Space View refers to an immutable Space View Class, implemented by `SpaceViewClass`. It defines: * which data it can display and how it is displayed * how it is interacted with * what properties are read from the blueprint store and how they are exposed in the UI -### What space view classes are there? +### What view classes are there? Space View differ only in class when they are **fundamentally different** in the way they display data. Naturally, this means that there are only ever very few distinct Space View classes. @@ -54,9 +54,9 @@ As of writing we have: * Text Document * Time Series -#### Future space view class distinction +#### Future view class distinction -The fundamental difference between different space views lies in the kinds of axes a view has. +The fundamental difference between different views lies in the kinds of axes a view has. - Data Table (currently text views) have rows and columns with text - Text Log have rows with logs sorted in time (not 100% sure this is fundamentally different than Data Table) - Spatial 2D has two orthogonal axes with defined spatial relationships @@ -65,15 +65,15 @@ The fundamental difference between different space views lies in the kinds of ax - Rich Text is a rich text document (linear in top to bottom with wraparound in horizontal) ##### On merging bar chart with spatial 2D -It might take some time to get the Archetype Queries + defaults expressive and easy to use enough that it makes sense to merge bar chart with spatial 2D. Right now we have the state that the bar chart space view takes a single 1-D tensor and draws a bar chart with x-axis = tensor indices and y-axis = tensor values. It draws boxes with width 1, centered on integers in x, y-min = 0 and y-max = tensor value. +It might take some time to get the Archetype Queries + defaults expressive and easy to use enough that it makes sense to merge bar chart with spatial 2D. Right now we have the state that the bar chart view takes a single 1-D tensor and draws a bar chart with x-axis = tensor indices and y-axis = tensor values. It draws boxes with width 1, centered on integers in x, y-min = 0 and y-max = tensor value. With the right set of primitives a user should be able to manually build a bar chart in a spatial 2D view. For example they might want a stacked bar chart. Talking about bringing in 3D into a bar chart doesn't likely make sense since there probably doesn't exist a camera projection that maps between 3D and the tensor indices axis (x). One could imagine that we would have heuristics that generate a Data Blueprint for boxes that creates a bar chart from 1-D tensors. -##### On why 2D and 3D space views shouldn't be the same -In the early prototype 2D and 3D Space Views were separate since they would use different -renderers - 3D Space Views were driven by `three-d`, 2D Space Views by egui directly. +##### On why 2D and 3D views shouldn't be the same +In the early prototype 2D and 3D Views were separate since they would use different +renderers - 3D Views were driven by `three-d`, 2D Views by egui directly. With the advent or `re_renderer`, this distinction was no longer necessary and indeed a hindrance. Like most modern renderer, `re_renderer` does not distinguish 2D and 3D rendering at a fundamental level (albeit we might add some limited awareness in the future) since shader, hardware acceleration and @@ -120,7 +120,7 @@ in a generic fashion. Example: The `Points2DPart` queries the `Points2D` archetype upon execution and produces as a result `re_renderer::PointCloudDrawData`. -Since points can have UI labels, it also stores `UiLabel` in its own state which the space view class of `ui` +Since points can have UI labels, it also stores `UiLabel` in its own state which the view class of `ui` can read out via `Points2DPart::data()` to draw UI labels. Note on naming: @@ -132,8 +132,8 @@ i.e. an object or function that queries a set of components (an Archetype) and e ### Registration Registration is done via `SpaceViewSystemRegistry` which `SpaceViewClassRegistry` stores for each class. -Space view classes can register their built-in systems upon their own registration via their `on_register` method. -As with space view classes themselves, new systems may be added at runtime. +View classes can register their built-in systems upon their own registration via their `on_register` method. +As with view classes themselves, new systems may be added at runtime. ### Frame lifecycle * `SpaceViewClass::prepare_ui` @@ -147,23 +147,23 @@ As with space view classes themselves, new systems may be added at runtime. * this typically requires iterating over all `ViewPartSystem` and extract some data either in a generic fashion via `ViewPartSystem::data` or with knowledge of the concrete `ViewPartSystem` types * currently, we also pass in all `re_renderer` data since the build up of the `re_renderer` view via `ViewBuilder` is not (yet?) unified -### Space view class registry -Despite being few in numbers, Space Views Classes are registered on startup. +### View class registry +Despite being few in numbers, Views Classes are registered on startup. This is desirable since: * forces decoupling from other aspects of the Viewer (Viewer should be composable) -* allows for user defined space views +* allows for user defined views ![Overview diagram of how the basic traits related to each other](https://github.com/rerun-io/rerun/assets/1220815/ffdb1cdf-7efe-47a0-ac38-30262d770e69) -#### User defined space view classes +#### User defined view classes Rust developers can use the Class Registry to register their own Space View types. We do *not* expect this to be a common workflow, but more of a last resort / highest level extensibility hooks. -These user defined Space Views have no limitations over built-in Space Views and are able -to completely reimplement existing Space Views if desired. +These user defined Views have no limitations over built-in Views and are able +to completely reimplement existing Views if desired. In the future A more common extension point will be to add custom systems to an existing Space View emitting re_renderer drawables. diff --git a/design/spatial_transforms.md b/design/spatial_transforms.md index fdbddd88f044..fe0f1ec0459d 100644 --- a/design/spatial_transforms.md +++ b/design/spatial_transforms.md @@ -1,6 +1,6 @@ # Spatial transforms -Spatial transforms are transforms that apply the spatial 2D & 3D space views. +Spatial transforms are transforms that apply the spatial 2D & 3D views. This includes affine 2D/3D transforms as well as camera projections. Any transform component that is logged a path `parent/entity` it describes the @@ -15,7 +15,7 @@ the entity path of that camera is in 2D space. The spatial topology is used to determine which (spatial) visualizers can be used in which contents. A 2D visualizer can only ever be applied to an entity when there is a valid transformation -along the path of the entity to the space view's origin. +along the path of the entity to the view's origin. Examples for invalid transformation paths are: * mismatched start space diff --git a/docs/content/concepts/apps-and-recordings.md b/docs/content/concepts/apps-and-recordings.md index 790d88285af9..81a62be52501 100644 --- a/docs/content/concepts/apps-and-recordings.md +++ b/docs/content/concepts/apps-and-recordings.md @@ -30,7 +30,7 @@ snippet: tutorials/custom-application-id The Rerun viewer will store your blueprint based on this _Application ID_. -This means that you can run your app and set up the viewer to your liking, and then when you run the app again the Rerun viewer will remember how you set up your Space Views etc. +This means that you can run your app and set up the viewer to your liking, and then when you run the app again the Rerun viewer will remember how you set up your Views etc. Different recordings (i.e. different _Recording IDs_) will share the same blueprint as long as they share the same _Application ID_. Check out the API to learn more about SDK initialization: diff --git a/docs/content/concepts/blueprint.md b/docs/content/concepts/blueprint.md index 2fd25bf99d25..8e6193dce404 100644 --- a/docs/content/concepts/blueprint.md +++ b/docs/content/concepts/blueprint.md @@ -82,8 +82,8 @@ Viewer to be a deterministic function of the blueprint and the recording. Every frame, the Viewer starts with a minimal context of an "active" blueprint, and an "active" recording. The Viewer then uses the current revision on the -blueprint timeline to query the container and space-view archetypes from the -blueprint store. The space-view archetypes, in turn, specify the paths types +blueprint timeline to query the container and view archetypes from the +blueprint store. The view archetypes, in turn, specify the paths types that need to be queried from the recording store in order to render the views. Any user interactions that modify the blueprint are queued and written back to diff --git a/docs/content/concepts/entity-component.md b/docs/content/concepts/entity-component.md index 13f8df89cb80..1b295103e22f 100644 --- a/docs/content/concepts/entity-component.md +++ b/docs/content/concepts/entity-component.md @@ -33,7 +33,7 @@ This statement uses the [`rr.Points2D`](https://ref.rerun.io/docs/python/stable/ Internally, this archetype builds a set of, in this case, two components: [`Position2D`](../reference/types/components/position2d.md) and [`Color`](../reference/types/components/color.md). Then, the `rr.log()` function records these two components and associate them with the `"my_point"` entity. -Later, the Space View for spatial types queries the data store for all the entities that have a `Position2D` component. +Later, the View for spatial types queries the data store for all the entities that have a `Position2D` component. In this case it would find the "my_point" entity. This query additionally returns the `Color` component because that component is associated with the same entity. These two components are recognized as corresponding to the `Points2D` archetype, which informs the Viewer on how to display the corresponding entity. @@ -42,13 +42,13 @@ See the [Types](../reference/types.md) reference for a list of [archetypes](../r ### Adding custom data -Although both the SDKs' archetype objects and the space view are based on the same archetype definition (and are actually implemented using code that is automatically generated based on that definition), they both operate on arbitrary collection +Although both the SDKs' archetype objects and the view are based on the same archetype definition (and are actually implemented using code that is automatically generated based on that definition), they both operate on arbitrary collection of components. Neither the SDKs nor the Viewer enforce or require that an entity should contain a *specific* set of component. -The Rerun Viewer will display any data in a generic form, but its space views will only work on sets of components it can +The Rerun Viewer will display any data in a generic form, but its views will only work on sets of components it can make sense of. Your entity could have any number of additional components as well. This isn't a problem. Any components that -aren't relevant to the scene that the space view is drawing are safely ignored. Also, Rerun even allows you to log your +aren't relevant to the scene that the view is drawing are safely ignored. Also, Rerun even allows you to log your own set of components, bypassing archetypes altogether. In Python, the [rr.AnyValues](https://ref.rerun.io/docs/python/stable/common/custom_data/#rerun.AnyValues) helper object can be used to add custom component(s) to an archetype: @@ -72,4 +72,4 @@ of one or more components associated with that entity. ## ECS systems There is a third concept we haven't touched on: *systems* are processes which operate on the entities based on the components they possess. -Rerun is still settling on the exact form of formalized systems and outside of Rust Viewer code it is not yet possible to write your own systems. However, space views work under the hood using a variety of systems. For more information see the [Extend the Viewer in Rust](../howto/extend/extend-ui.md) section. +Rerun is still settling on the exact form of formalized systems and outside of Rust Viewer code it is not yet possible to write your own systems. However, views work under the hood using a variety of systems. For more information see the [Extend the Viewer in Rust](../howto/extend/extend-ui.md) section. diff --git a/docs/content/concepts/spaces-and-transforms.md b/docs/content/concepts/spaces-and-transforms.md index ed49fd9f6606..ada84a26f699 100644 --- a/docs/content/concepts/spaces-and-transforms.md +++ b/docs/content/concepts/spaces-and-transforms.md @@ -6,7 +6,7 @@ order: 300 ## The definition of a space Every entity in Rerun exists in some _space_. This is at the core of how Rerun organizes the visualizations of the data -that you have logged. In the [Rerun Viewer](../reference/viewer.md) you view data by configuring a _space view_, which is a view +that you have logged. In the [Rerun Viewer](../reference/viewer.md) you view data by configuring a _view_, which is a view of a set of entities _as seen from a particular origin._ The origin of a space is, very loosely, a generalization of the idea of a "coordinate system" (sometimes known as a "coordinate frame") to arbitrary data. If a collection of @@ -18,7 +18,7 @@ For example: - For scalar plots it means they share the same plot axes. - For text logs, it means they share the same conceptual stream. -As explained below, a space view _may_ display data belonging to multiple spaces, but there must be a well-defined +As explained below, a view _may_ display data belonging to multiple spaces, but there must be a well-defined means of transforming the data from one space to another. Which entities belong to which spaces is a function of the transform system, which uses the following rules to define @@ -59,7 +59,7 @@ space we have the entities `world/robot` and `world/robot/observed_features`. Practically speaking, this means that the position values of the points from `world/mapped_keypoints` and the points from `world/robot/observed_features` are not directly comparable. If you were to directly draw these points in a single coordinate system the results would be meaningless. As noted above, Rerun can still display these entities in the same -space view because it is able to automatically transform data between different spaces. +view because it is able to automatically transform data between different spaces. ## Space transformations diff --git a/docs/content/getting-started/configure-the-viewer/interactively.md b/docs/content/getting-started/configure-the-viewer/interactively.md index 782e4266a6b5..d02c13d7b738 100644 --- a/docs/content/getting-started/configure-the-viewer/interactively.md +++ b/docs/content/getting-started/configure-the-viewer/interactively.md @@ -147,7 +147,7 @@ The query editor allows visually adding and removing entities and entity trees f ### Adding entities to a new view with context menu -Like with viewport hierarchy, most operations on view data are available from the context menu. In particular, a new view can be created with custom content by selecting one or more entities (either in existing views in the blueprint panel, or in the time panel's streams), and clicking "Add to new space view" in the context menu: +Like with viewport hierarchy, most operations on view data are available from the context menu. In particular, a new view can be created with custom content by selecting one or more entities (either in existing views in the blueprint panel, or in the time panel's streams), and clicking "Add to new view" in the context menu: diff --git a/docs/content/getting-started/navigating-the-viewer.md b/docs/content/getting-started/navigating-the-viewer.md index 41798a21f8d3..9943bca62ef6 100644 --- a/docs/content/getting-started/navigating-the-viewer.md +++ b/docs/content/getting-started/navigating-the-viewer.md @@ -78,9 +78,9 @@ Depending on your display size, the panels may have a different arrangements. Fu This window has five main sections: -- [Viewport](../reference/viewer/viewport.md) (center): Displays the rendered space views for your session. +- [Viewport](../reference/viewer/viewport.md) (center): Displays the rendered views for your session. - [Recordings panel](../concepts/apps-and-recordings.md) (top left): Lists loaded recordings and their applications, and allows navigation back to the welcome screen. -- [Blueprint panel](../reference/viewer/blueprint.md) (below Recordings): Controls the different space views. +- [Blueprint panel](../reference/viewer/blueprint.md) (below Recordings): Controls the different views. - [Selection panel](../reference/viewer/selection.md) (right): Shows detailed information and configuration for selected items. - [Timeline panel](../reference/viewer/timeline.md) (bottom): Controls the current point in time being viewed. @@ -207,7 +207,7 @@ That brings us to the end of this walkthrough. To recap, you have learned how to - Run the Rerun Viewer using the `rerun` command. - Open the examples integrated in the viewer. - Work with the [Blueprint](../reference/viewer/blueprint.md), [Selection](../reference/viewer/selection.md) and [Timeline](../reference/viewer/timeline.md) panels. -- Rearrange space view layouts. +- Rearrange view layouts. - Explore data through hover and selection. - Change the time selection. - Switch between different timelines. diff --git a/docs/content/howto/visualization/configure-viewer-through-code.md b/docs/content/howto/visualization/configure-viewer-through-code.md index 75126bae68d8..09e76a62663f 100644 --- a/docs/content/howto/visualization/configure-viewer-through-code.md +++ b/docs/content/howto/visualization/configure-viewer-through-code.md @@ -22,12 +22,12 @@ encounter: - `Blueprint`: The root object that represents the entire Viewer layout. - `Container`: A layout object that contains other containers or views. -- `SpaceView`: A view object that represents a single view of the data. +- `View`: A view object that represents a single view of the data. -Both containers and spaceviews should be used via typed subclasses instead.: +Both containers and views should be used via typed subclasses instead.: - `Container` has subclasses: `Horizontal`, `Vertical`, `Grid`, and `Tabs`. -- `SpaceView` has subclasses: `BarChartView`, `Spatial2DView`, `Spatial3DView`, `TensorView`, +- `View` has subclasses: `BarChartView`, `Spatial2DView`, `Spatial3DView`, `TensorView`, `TextDocumentView`, `TextLogView`, and `TimeSeriesView`. These paths can be combined hierarchically to create a complex Viewer layout. @@ -106,9 +106,9 @@ rr.send_blueprint(my_blueprint, make_active=True) ``` -## Customizing space views +## Customizing views -Any of the space views (`BarChartView`, `Spatial2DView`, `Spatial3DView`, `TensorView`, +Any of the views (`BarChartView`, `Spatial2DView`, `Spatial3DView`, `TensorView`, `TextDocumentView`, `TextLogView`, or `TimeSeriesView`) can be instantiated with no arguments. By default these views try to include all compatible entities. @@ -121,7 +121,7 @@ rrb.Blueprint( ) ``` -Beyond instantiating the space views, there are 3 parameters you may want to specify: `name`, `origin`, and `contents`. +Beyond instantiating the views, there are 3 parameters you may want to specify: `name`, `origin`, and `contents`. `name` is simply the name of the view used as a label in the viewer. @@ -129,13 +129,13 @@ However, both `origin` and `contents` play an important role in determining what ### `origin` -The `origin` of a space-view is a generalized "frame of reference" for the view. We think of showing all data -in the space view as relative to the `origin`. +The `origin` of a view is a generalized "frame of reference" for the view. We think of showing all data +in the view as relative to the `origin`. By default, only data that is under the `origin` will be included in the view. As such this is one of the most -convenient ways of restricting a space-view to a particular subtree. +convenient ways of restricting a view to a particular subtree. -Because the data in the space-view is relative to the `origin`, the `origin` will be the first entity displayed +Because the data in the view is relative to the `origin`, the `origin` will be the first entity displayed in the blueprint tree, with all entities under the origin shown using relative paths. For Spatial views such as `Spatial2DView` and `Spatial3DView`, the `origin` plays an additional role with respect @@ -154,7 +154,7 @@ rrb.Blueprint( ### `contents` -If you need to further modify the contents of a space view, you can use the `contents` parameter. This parameter is +If you need to further modify the contents of a view, you can use the `contents` parameter. This parameter is a list of [entity query expressions](../../reference/) that are either included or excluded from the view. @@ -162,7 +162,7 @@ Each entity expressions starts with "+" for inclusion or "-" for an exclusion. T When combining multiple expressions, the "most specific" rule wins. -Additionally, these expressions can reference `$origin` to refer to the origin of the space view. +Additionally, these expressions can reference `$origin` to refer to the origin of the view. For example: @@ -189,8 +189,8 @@ rrb.Blueprint( ## Implicit conversion For convenience all of the blueprint APIs take a `BlueprintLike` rather than requiring a `Blueprint` object. -Both `SpaceView`s and `Containers` are considered `BlueprintLike`. Similarly, the `Blueprint` object can -take a `SpaceView` or `Container` as an argument. +Both `View`s and `Containers` are considered `BlueprintLike`. Similarly, the `Blueprint` object can +take a `View` or `Container` as an argument. All of the following are equivalent: @@ -253,10 +253,10 @@ rrb.Blueprint( The blueprint has two additional parameters that influence the behavior of the viewer: -- `auto_space_views` controls whether the Viewer will automatically create space views for entities that are not explicitly included in the blueprint. -- `auto_layout` controls whether the Viewer should automatically layout the containers when introducing new space-views. +- `auto_views` controls whether the Viewer will automatically create views for entities that are not explicitly included in the blueprint. +- `auto_layout` controls whether the Viewer should automatically layout the containers when introducing new views. -If you pass in your own `SpaceView` or `Container` objects, these will both default to `False` so that the Blueprint +If you pass in your own `View` or `Container` objects, these will both default to `False` so that the Blueprint you get is exactly what you specify. Otherwise they will default to `True` so that you will still get content (this matches the default behavior of the Viewer if no blueprint is provided). @@ -270,7 +270,7 @@ and ```python rrb.Blueprint( - auto_space_views=True, + auto_views=True, auto_layout=True ) ``` @@ -281,7 +281,7 @@ If you truly want to create an empty blueprint, you must set both values to `Fal ```python rrb.Blueprint( - auto_space_views=False, + auto_views=False, auto_layout=False ), ``` diff --git a/docs/content/howto/visualization/extend-ui.md b/docs/content/howto/visualization/extend-ui.md index bdd5ce0f334d..4da0fc6da8c8 100644 --- a/docs/content/howto/visualization/extend-ui.md +++ b/docs/content/howto/visualization/extend-ui.md @@ -17,23 +17,23 @@ The Rerun Viewer is defined by the crate [`re_viewer`](https://github.com/rerun- The best way to get started is by reading [the source code of the `extend_viewer_ui` example](https://github.com/rerun-io/rerun/tree/main/examples/rust/extend_viewer_ui). -## Custom space views classes +## Custom views classes - The Rerun Viewer, extended with a custom Space View that is shown three times, each time showing points on a colored plane + The Rerun Viewer, extended with a custom View that is shown three times, each time showing points on a colored plane -Above screenshot shows the [`custom_space_view`](https://github.com/rerun-io/rerun/tree/main/examples/rust/custom_space_view) example. -This example demonstrates how to add a fully custom Space View class to Rerun on startup. -Space Views that are added this way have access to the exact same interfaces as all other Space Views, -meaning that any of the built-in Space Views serves can serve as an additional example on how to implement Space Views. +Above screenshot shows the [`custom_view`](https://github.com/rerun-io/rerun/tree/main/examples/rust/custom_view) example. +This example demonstrates how to add a fully custom View class to Rerun on startup. +Views that are added this way have access to the exact same interfaces as all other Views, +meaning that any of the built-in Views serves can serve as an additional example on how to implement Views. -**⚠️ Note that the interface for adding Space Views are very far from stable.** Expect code implementing custom Space Views to break with every release of Rerun. +**⚠️ Note that the interface for adding Views are very far from stable.** Expect code implementing custom Views to break with every release of Rerun. # Future work -We plan to also support embedding your own GUI widgets inside existing space views. +We plan to also support embedding your own GUI widgets inside existing views. diff --git a/docs/content/reference/entity-queries.md b/docs/content/reference/entity-queries.md index dfaf0f0f0c1c..4eff38f3eae9 100644 --- a/docs/content/reference/entity-queries.md +++ b/docs/content/reference/entity-queries.md @@ -3,7 +3,7 @@ title: Entity Queries order: 100 --- -Many space views are made up of visualizations that include more than one +Many views are made up of visualizations that include more than one entity. Rather that requiring you to specify each entity individually, Rerun supports @@ -48,7 +48,7 @@ Consider the following example: In the viewer, an entity query is typically displayed as a multi-line edit box, with each query expression shown on its own line. You can find the -query editor in the right-hand selection panel when selecting a space view. +query editor in the right-hand selection panel when selecting a view. @@ -76,7 +76,7 @@ rrb.Spatial3DView( ## `origin` substitution Query expressions also allow you to use the variable `$origin` to refer to the -origin of the space-view that the query belongs to. +origin of the view that the query belongs to. For example, the above query could be rewritten as: diff --git a/docs/content/reference/migration/migration-0-21.md b/docs/content/reference/migration/migration-0-21.md index e0b0a5d693a7..84533be9690d 100644 --- a/docs/content/reference/migration/migration-0-21.md +++ b/docs/content/reference/migration/migration-0-21.md @@ -25,3 +25,30 @@ rr.send_blueprint( ) ``` + +### Types and fields got renamed from `.*space_view.*`/`.*SpaceView.*` to `.*view.*`/`.*View.*` + +Various types and fields got changed to refer to "views" rather than "space views". +This exclusively affects the Python blueprint sdk: + +#### Field/argument changes: +* `ViewportBlueprint(...auto_views=...)` -> `ViewportBlueprint(...auto_views=...)` +* `Blueprint(...auto_views=...)` -> `Blueprint(...auto_views=...)` + +#### Type changes + +##### Utilities + +* `SpaceView` -> `View` + +##### Archetypes + +* `SpaceViewBlueprint` -> `ViewBlueprint` +* `SpaceViewContents` -> `ViewContents` + +##### Components + +* `AutoSpaceViews` -> `AutoViews` +* `SpaceViewClass` -> `ViewClass` +* `SpaceViewOrigin` -> `ViewOrigin` +* `SpaceViewMaximized` -> `ViewMaximized` diff --git a/docs/content/reference/types/archetypes/disconnected_space.md b/docs/content/reference/types/archetypes/disconnected_space.md index e6e81e02bab6..752465188940 100644 --- a/docs/content/reference/types/archetypes/disconnected_space.md +++ b/docs/content/reference/types/archetypes/disconnected_space.md @@ -7,7 +7,7 @@ Spatially disconnect this entity from its parent. Specifies that the entity path at which this is logged is spatially disconnected from its parent, making it impossible to transform the entity path into its parent's space and vice versa. -It *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views. +It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. This is useful for specifying that a subgraph is independent of the rest of the scene. ## Components diff --git a/docs/content/reference/types/components/disconnected_space.md b/docs/content/reference/types/components/disconnected_space.md index 1c3dce66f820..fd9447abb871 100644 --- a/docs/content/reference/types/components/disconnected_space.md +++ b/docs/content/reference/types/components/disconnected_space.md @@ -7,7 +7,7 @@ Spatially disconnect this entity from its parent. Specifies that the entity path at which this is logged is spatially disconnected from its parent, making it impossible to transform the entity path into its parent's space and vice versa. -It *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views. +It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. This is useful for specifying that a subgraph is independent of the rest of the scene. ## Rerun datatype diff --git a/docs/content/reference/viewer/blueprint.md b/docs/content/reference/viewer/blueprint.md index c29582f872df..ac5db01e9bd2 100644 --- a/docs/content/reference/viewer/blueprint.md +++ b/docs/content/reference/viewer/blueprint.md @@ -5,11 +5,11 @@ order: 1 The blueprint is how you configure what is displayed in the Rerun viewer. It is saved between sessions and is unique to a given [application id](../../concepts/apps-and-recordings.md). -The blueprint includes all space view configurations, entity groupings and entity settings, also known as _data blueprints_. +The blueprint includes all view configurations, entity groupings and entity settings, also known as _data blueprints_. This view shows the blueprint for the active recording. Everything visible in the [Viewport](viewport.md) has a representation here, -making it an easy way to select a Space View and the [Entities](../../concepts/entity-component.md) it shows. +making it an easy way to select a View and the [Entities](../../concepts/entity-component.md) it shows. @@ -21,10 +21,10 @@ Controls -------- ### Reset The reset button resets the entire blueprint back to its heuristic-chosen default. -This includes all settings for entities, Groups and Space Views. +This includes all settings for entities, Groups and Views. -### Add space view -With this control you can add new Space Views for arbitrary [Spaces](../../concepts/spaces-and-transforms.md). +### Add view +With this control you can add new Views for arbitrary [Spaces](../../concepts/spaces-and-transforms.md). Contents -------- @@ -33,19 +33,19 @@ Upon hovering any line in the Blueprint panel, you'll find shorthands for removi ### Data blueprints All entities shown in the blueprint panel refer in fact to their Data Blueprints. I.e. the entity plus the associated blueprint settings. -As such, all changes made here are only relevant for the Space View in which they reside. +As such, all changes made here are only relevant for the View in which they reside. ### Groups -Whenever entities are added to a space view (either manually or automatically), groupings +Whenever entities are added to a view (either manually or automatically), groupings are automatically created. Groups, despite being derived from the [Entity Path](../../concepts/entity-path.md) are independent of logged data. -They are meant to improve the handling of large space views and allow for hierarchical manipulation +They are meant to improve the handling of large views and allow for hierarchical manipulation of blueprints. Adding Entities ----------------------------- -To (re-)add an entity to a space view, you need first need to select the respective space view. +To (re-)add an entity to a view, you need first need to select the respective view. You then can open a dedicated menu through a button in the [Selection view](selection.md). This allows you to add any entity with a matching [category](viewport.md#view-classes) and a valid [transform](../../concepts/spaces-and-transforms.md) to your -space view's path. +view's path. diff --git a/docs/content/reference/viewer/overview.md b/docs/content/reference/viewer/overview.md index 492c131f4d5c..cb2316aa3538 100644 --- a/docs/content/reference/viewer/overview.md +++ b/docs/content/reference/viewer/overview.md @@ -22,7 +22,7 @@ The timeline panel gives you controls over what point in time you're looking at Additionally, it gives you an overview of all events on a given timeline. ### [Viewport](viewport.md) -The viewport is where your visualizations live. It is composed of one or more Space Views that you can arrange freely. +The viewport is where your visualizations live. It is composed of one or more Views that you can arrange freely. ### Top bar & menu The top bar contains operating system controls and generic information. diff --git a/docs/content/reference/viewer/selection.md b/docs/content/reference/viewer/selection.md index 26ae67f14065..31f8075bf131 100644 --- a/docs/content/reference/viewer/selection.md +++ b/docs/content/reference/viewer/selection.md @@ -31,17 +31,17 @@ but is also important for what the following sections are showing. ### Data & blueprint sections The data section always shows static, raw user logged data for the currently selected time. -Some objects, e.g. Space Views, may not have a data section and expose only Blueprint options. +Some objects, e.g. Views, may not have a data section and expose only Blueprint options. In contrast, the Blueprint section is timeline independent and exposes the -[Blueprint settings](blueprint.md) of an entity in the context of a given Space View. +[Blueprint settings](blueprint.md) of an entity in the context of a given View. To learn more about the various settings check the on-hover tooltips. Click-through selections ------------------------ Making selections can be context sensitive to the current selection. The most common case for this is selecting instances of an entity (see also [Batch Data](../../concepts/batches.md)): -E.g. in order to select a point of a point cloud in a Space View, +E.g. in order to select a point of a point cloud in a View, first select the entire entity (the cloud) by clicking on one of the points. Once the cloud is selected, you can further refine that selection by clicking on an individual point. diff --git a/docs/snippets/all/archetypes/transform3d_hierarchy.cpp b/docs/snippets/all/archetypes/transform3d_hierarchy.cpp index 9fc7badf2189..4ad0f794f22e 100644 --- a/docs/snippets/all/archetypes/transform3d_hierarchy.cpp +++ b/docs/snippets/all/archetypes/transform3d_hierarchy.cpp @@ -8,7 +8,7 @@ int main() { const auto rec = rerun::RecordingStream("rerun_example_transform3d_hierarchy"); rec.spawn().exit_on_failure(); - // TODO(#5521): log two space views as in the python example + // TODO(#5521): log two views as in the python example rec.set_time_seconds("sim_time", 0.0); diff --git a/docs/snippets/all/archetypes/transform3d_hierarchy.rs b/docs/snippets/all/archetypes/transform3d_hierarchy.rs index 901235b7b992..cd3cda58582a 100644 --- a/docs/snippets/all/archetypes/transform3d_hierarchy.rs +++ b/docs/snippets/all/archetypes/transform3d_hierarchy.rs @@ -3,7 +3,7 @@ fn main() -> Result<(), Box> { let rec = rerun::RecordingStreamBuilder::new("rerun_example_transform3d_hierarchy").spawn()?; - // TODO(#5521): log two space views as in the python example + // TODO(#5521): log two views as in the python example rec.set_time_seconds("sim_time", 0.0); diff --git a/examples/cpp/stereo_vision_slam/README.md b/examples/cpp/stereo_vision_slam/README.md index 70a978187c3c..ec814ef1c6c0 100644 --- a/examples/cpp/stereo_vision_slam/README.md +++ b/examples/cpp/stereo_vision_slam/README.md @@ -122,7 +122,7 @@ rec.log(entity_name, ## Pinhole camera -The camera frames shown in the space view is generated by the following code: +The camera frames shown in the view is generated by the following code: ```cpp rec.log(entity_name, diff --git a/examples/manifest.toml b/examples/manifest.toml index 66774263a558..915fc0509dcf 100644 --- a/examples/manifest.toml +++ b/examples/manifest.toml @@ -163,7 +163,7 @@ examples = [ "all_examples", "custom_collection_adapter", "custom_data_loader", - "custom_space_view", + "custom_view", "custom_store_subscriber", "dataframe_query", "drone_lidar", diff --git a/examples/python/blueprint/blueprint.py b/examples/python/blueprint/blueprint.py index d13f4f3f80dc..4aa25b30747e 100755 --- a/examples/python/blueprint/blueprint.py +++ b/examples/python/blueprint/blueprint.py @@ -14,7 +14,7 @@ def main() -> None: parser = argparse.ArgumentParser(description="Different options for how we might use blueprint") parser.add_argument("--skip-blueprint", action="store_true", help="Don't send the blueprint") - parser.add_argument("--auto-space-views", action="store_true", help="Automatically add space views") + parser.add_argument("--auto-views", action="store_true", help="Automatically add views") args = parser.parse_args() @@ -24,8 +24,8 @@ def main() -> None: # Create a blueprint which includes 2 additional views each only showing 1 of the two # rectangles. # - # If auto_space_views is True, the blueprint will automatically add one of the heuristic - # space views, which will include the image and both rectangles. + # If auto_views is True, the blueprint will automatically add one of the heuristic + # views, which will include the image and both rectangles. blueprint = rrb.Blueprint( rrb.Grid( rrb.Spatial2DView(name="Rect 0", origin="/", contents=["image", "rect/0"]), @@ -40,7 +40,7 @@ def main() -> None: rrb.BlueprintPanel(state="collapsed"), rrb.SelectionPanel(state="collapsed"), rrb.TimePanel(state="collapsed"), - auto_space_views=args.auto_space_views, + auto_views=args.auto_views, ) rr.init("rerun_example_blueprint", spawn=True, default_blueprint=blueprint) diff --git a/examples/python/blueprint_stocks/blueprint_stocks.py b/examples/python/blueprint_stocks/blueprint_stocks.py index f3d31d0c81e4..3432228baaf1 100755 --- a/examples/python/blueprint_stocks/blueprint_stocks.py +++ b/examples/python/blueprint_stocks/blueprint_stocks.py @@ -23,8 +23,8 @@ def auto_blueprint() -> rrb.BlueprintLike: - """A blueprint enabling auto space views, which matches the application default.""" - return rrb.Blueprint(auto_space_views=True, auto_layout=True) + """A blueprint enabling auto views, which matches the application default.""" + return rrb.Blueprint(auto_views=True, auto_layout=True) def one_stock(symbol: str) -> rrb.ContainerLike: diff --git a/examples/python/notebook/cube.ipynb b/examples/python/notebook/cube.ipynb index 258e7aaec8e9..ca32c3b4eb42 100644 --- a/examples/python/notebook/cube.ipynb +++ b/examples/python/notebook/cube.ipynb @@ -1,410 +1,410 @@ { - "cells": [ - { - "cell_type": "markdown", - "id": "b31c0a84", - "metadata": {}, - "source": [ - "## Rerun imports and initialization" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1076c3a0", - "metadata": {}, - "outputs": [], - "source": [ - "from __future__ import annotations\n", - "\n", - "import math\n", - "from collections import namedtuple\n", - "from math import cos, sin\n", - "\n", - "import numpy as np\n", - "import rerun as rr # pip install rerun-sdk\n", - "import rerun.blueprint as rrb\n" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "id": "bf894a1f", - "metadata": {}, - "source": [ - "## Helper to create the colored cube\n", - "\n", - "This code exists in the `rerun.utilities` package, but is included here for context." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f709925e", - "metadata": { - "jupyter": { - "source_hidden": true - } - }, - "outputs": [], - "source": [ - "ColorGrid = namedtuple(\"ColorGrid\", [\"positions\", \"colors\"])\n", - "\n", - "\n", - "def build_color_grid(x_count=10, y_count=10, z_count=10, twist=0):\n", - " \"\"\"\n", - " Create a cube of points with colors.\n", - "\n", - " The total point cloud will have x_count * y_count * z_count points.\n", - "\n", - " Parameters\n", - " ----------\n", - " x_count, y_count, z_count:\n", - " Number of points in each dimension.\n", - " twist:\n", - " Angle to twist from bottom to top of the cube\n", - "\n", - " \"\"\"\n", - "\n", - " grid = np.mgrid[\n", - " slice(-x_count, x_count, x_count * 1j),\n", - " slice(-y_count, y_count, y_count * 1j),\n", - " slice(-z_count, z_count, z_count * 1j),\n", - " ]\n", - "\n", - " angle = np.linspace(-float(twist) / 2, float(twist) / 2, z_count)\n", - " for z in range(z_count):\n", - " xv, yv, zv = grid[:, :, :, z]\n", - " rot_xv = xv * cos(angle[z]) - yv * sin(angle[z])\n", - " rot_yv = xv * sin(angle[z]) + yv * cos(angle[z])\n", - " grid[:, :, :, z] = [rot_xv, rot_yv, zv]\n", - "\n", - " positions = np.vstack([xyz.ravel() for xyz in grid])\n", - "\n", - " colors = np.vstack(\n", - " [\n", - " xyz.ravel()\n", - " for xyz in np.mgrid[\n", - " slice(0, 255, x_count * 1j),\n", - " slice(0, 255, y_count * 1j),\n", - " slice(0, 255, z_count * 1j),\n", - " ]\n", - " ]\n", - " )\n", - "\n", - " return ColorGrid(positions.T, colors.T.astype(np.uint8))\n" - ] - }, - { - "cell_type": "markdown", - "id": "04c095ef", - "metadata": {}, - "source": [ - "## Logging some data\n", - "\n", - "Now we can log some data and add it to the recording, and display it using `notebook_show`.\n", - "\n", - "Note that displaying a recording will consume the data, so it will not be available for use in a subsequent cell." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "92871ea1", - "metadata": {}, - "outputs": [], - "source": [ - "rr.init(\"rerun_example_cube\")\n", - "\n", - "STEPS = 100\n", - "twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4\n", - "for t in range(STEPS):\n", - " rr.set_time_sequence(\"step\", t)\n", - " cube = build_color_grid(10, 10, 10, twist=twists[t])\n", - " rr.log(\"cube\", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))\n", - "\n", - "rr.notebook_show()" - ] - }, - { - "cell_type": "markdown", - "id": "187430e1", - "metadata": {}, - "source": [ - "## Logging live data\n", - "\n", - "Using `rr.notebook_show` like above buffers the data in the recording stream, but doesn't process it until the call to `rr.notebook_show`.\n", - "\n", - "However, `rr.notebook_show` can be called at any time during your cell's execution to immediately display the Rerun viewer. You can then incrementally stream to it. Here we add a sleep to simulate a cell that does a lot more processing. By calling `notebook_show` first, we can see the output of our code live while it's still running." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "246c8eb8", - "metadata": {}, - "outputs": [], - "source": [ - "from time import sleep\n", - "\n", - "rr.init(\"rerun_example_cube\")\n", - "\n", - "rr.notebook_show()\n", - "\n", - "STEPS = 100\n", - "twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4\n", - "for t in range(STEPS):\n", - " sleep(0.05)\n", - " rr.set_time_sequence(\"step\", t)\n", - " cube = build_color_grid(10, 10, 10, twist=twists[t])\n", - " rr.log(\"cube\", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))" - ] - }, - { - "cell_type": "markdown", - "id": "649b8e80-e69d-4b6b-be51-50cbf4c20495", - "metadata": {}, - "source": [ - "## Incremental logging\n", - "\n", - "Note that until we either reset the recording stream (by calling `rr.init()`), or create a new output widget (by calling `rr.notebook_show()` The currently active stream in the kernel will continue to send events to the existing widget.\n", - "\n", - "The following will add a rotation to the above recording." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7e4a9831-ac6c-4503-bcd7-b1212d0d542b", - "metadata": {}, - "outputs": [], - "source": [ - "for t in range(STEPS):\n", - " sleep(0.01)\n", - " rr.set_time_sequence(\"step\", t)\n", - " rr.log(\"cube\", rr.Transform3D(rotation=rr.RotationAxisAngle(axis=[1,0,0], degrees=t)))" - ] - }, - { - "cell_type": "markdown", - "id": "36f9f61b", - "metadata": {}, - "source": [ - "## Starting a new recording\n", - "\n", - "You can always start another recording by calling `rr.init(...)` again to reset the global stream, or alternatively creating a separate recording stream using `rr.new_recording` (discussed more below)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c4cc33fd", - "metadata": {}, - "outputs": [], - "source": [ - "rr.init(\"rerun_example_cube\")\n", - "\n", - "STEPS = 100\n", - "twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4\n", - "for t in range(STEPS):\n", - " rr.set_time_sequence(\"step\", t)\n", - " h_grid = build_color_grid(10, 3, 3, twist=twists[t])\n", - " rr.log(\"h_grid\", rr.Points3D(h_grid.positions, colors=h_grid.colors, radii=0.5))\n", - " v_grid = build_color_grid(3, 3, 10, twist=twists[t])\n", - " rr.log(\"v_grid\", rr.Points3D(v_grid.positions, colors=v_grid.colors, radii=0.5))\n", - "\n", - "rr.notebook_show()\n" - ] - }, - { - "cell_type": "markdown", - "id": "31d392a8", - "metadata": {}, - "source": [ - "## Adjusting the view\n", - "\n", - "The `notebook_show` method also lets you adjust properties such as width and height." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1a1b0f66-4287-4705-8be5-ae837ffe3f90", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "rr.init(\"rerun_example_cube\")\n", - "\n", - "small_cube = build_color_grid(3, 3, 3, twist=0)\n", - "rr.log(\"small_cube\", rr.Points3D(small_cube.positions, colors=small_cube.colors, radii=0.5))\n", - "\n", - "rr.notebook_show(width=400, height=400)\n" - ] - }, - { - "cell_type": "markdown", - "id": "ff84c840", - "metadata": {}, - "source": [ - "To update the default width and height, you can use the `rerun.notebook.set_default_size` function.\n", - "\n", - "Note that you do not need to initialize a recording to use this function." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "81157021", - "metadata": {}, - "outputs": [], - "source": [ - "from rerun.notebook import set_default_size\n", - "\n", - "set_default_size(width=400, height=400)\n", - "\n", - "rr.init(\"rerun_example_cube\")\n", - "\n", - "small_cube = build_color_grid(3, 3, 3, twist=0)\n", - "rr.log(\"small_cube\", rr.Points3D(small_cube.positions, colors=small_cube.colors, radii=0.5))\n", - "\n", - "rr.notebook_show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "755957e0", - "metadata": {}, - "outputs": [], - "source": [ - "set_default_size(width=640, height=480)" - ] - }, - { - "cell_type": "markdown", - "id": "a9812634-067f-4e07-95fb-cb9a506c42d3", - "metadata": {}, - "source": [ - "## Using blueprints\n", - "\n", - "Rerun blueprints can be used with `rr.notebook_show()`\n", - "\n", - "For example, we can split the two grids into their own respective space-views." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "eb8f7701", - "metadata": {}, - "outputs": [], - "source": [ - "rr.init(\"rerun_example_cube\")\n", - "\n", - "blueprint = rrb.Blueprint(\n", - " rrb.Horizontal(\n", - " rrb.Spatial3DView(name=\"Horizontal grid\", origin=\"h_grid\"),\n", - " rrb.Spatial3DView(name=\"Vertical grid\", origin=\"v_grid\"),\n", - " column_shares=[2,1]),\n", - " collapse_panels=True\n", - ")\n", - "\n", - "rr.notebook_show(blueprint=blueprint)\n", - "\n", - "STEPS = 100\n", - "twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4\n", - "for t in range(STEPS):\n", - " rr.set_time_sequence(\"step\", t)\n", - " h_grid = build_color_grid(10, 3, 3, twist=twists[t])\n", - " rr.log(\"h_grid\", rr.Points3D(h_grid.positions, colors=h_grid.colors, radii=0.5))\n", - " v_grid = build_color_grid(3, 3, 10, twist=twists[t])\n", - " rr.log(\"v_grid\", rr.Points3D(v_grid.positions, colors=v_grid.colors, radii=0.5))" - ] - }, - { - "cell_type": "markdown", - "id": "a63b30d7", - "metadata": {}, - "source": [ - "## Extra convenience\n", - "\n", - "Rerun blueprints types also implement `_ipython_display_()` directly, so if a blueprint is the last element in your cell the right thing will happen.\n", - "\n", - "Note that this mechanism only works when you are using the global recording stream." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6d1bf2ab", - "metadata": {}, - "outputs": [], - "source": [ - "rr.init(\"rerun_example_cube\")\n", - "\n", - "STEPS = 100\n", - "twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4\n", - "for t in range(STEPS):\n", - " rr.set_time_sequence(\"step\", t)\n", - " h_grid = build_color_grid(10, 3, 3, twist=twists[t])\n", - " rr.log(\"h_grid\", rr.Points3D(h_grid.positions, colors=h_grid.colors, radii=0.5))\n", - " v_grid = build_color_grid(3, 3, 10, twist=twists[t])\n", - " rr.log(\"v_grid\", rr.Points3D(v_grid.positions, colors=v_grid.colors, radii=0.5))\n", - "\n", - "rrb.Spatial3DView(name=\"Horizontal grid\", origin=\"h_grid\")" - ] - }, - { - "cell_type": "markdown", - "id": "ef9087de-d090-4c90-ab3e-18c20c92bff6", - "metadata": {}, - "source": [ - "## Working with non-global streams\n", - "\n", - "Sometimes it can be more explicit to work with specific (non-global recording) streams via the `new_recording` method.\n", - "\n", - "In this case, remember to call `notebook_show` directly on the recording stream. As noted above, there is no way to use a bare Blueprint object in conjunction with a non-global recording." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ed86cc19-45cf-4c21-9a94-c4ce2ade7f65", - "metadata": {}, - "outputs": [], - "source": [ - "rec = rr.new_recording(\"rerun_example_cube_flat\")\n", - "\n", - "bp = rrb.Blueprint(collapse_panels=True)\n", - "\n", - "rec.notebook_show(blueprint=bp)\n", - "\n", - "flat_grid = build_color_grid(20, 20, 1, twist=0)\n", - "rec.log(\"flat_grid\", rr.Points3D(flat_grid.positions, colors=flat_grid.colors, radii=0.5))" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.9" - } - }, - "nbformat": 4, - "nbformat_minor": 5 + "cells": [ + { + "cell_type": "markdown", + "id": "b31c0a84", + "metadata": {}, + "source": [ + "## Rerun imports and initialization" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1076c3a0", + "metadata": {}, + "outputs": [], + "source": [ + "from __future__ import annotations\n", + "\n", + "import math\n", + "from collections import namedtuple\n", + "from math import cos, sin\n", + "\n", + "import numpy as np\n", + "import rerun as rr # pip install rerun-sdk\n", + "import rerun.blueprint as rrb\n" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "id": "bf894a1f", + "metadata": {}, + "source": [ + "## Helper to create the colored cube\n", + "\n", + "This code exists in the `rerun.utilities` package, but is included here for context." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f709925e", + "metadata": { + "jupyter": { + "source_hidden": true + } + }, + "outputs": [], + "source": [ + "ColorGrid = namedtuple(\"ColorGrid\", [\"positions\", \"colors\"])\n", + "\n", + "\n", + "def build_color_grid(x_count=10, y_count=10, z_count=10, twist=0):\n", + " \"\"\"\n", + " Create a cube of points with colors.\n", + "\n", + " The total point cloud will have x_count * y_count * z_count points.\n", + "\n", + " Parameters\n", + " ----------\n", + " x_count, y_count, z_count:\n", + " Number of points in each dimension.\n", + " twist:\n", + " Angle to twist from bottom to top of the cube\n", + "\n", + " \"\"\"\n", + "\n", + " grid = np.mgrid[\n", + " slice(-x_count, x_count, x_count * 1j),\n", + " slice(-y_count, y_count, y_count * 1j),\n", + " slice(-z_count, z_count, z_count * 1j),\n", + " ]\n", + "\n", + " angle = np.linspace(-float(twist) / 2, float(twist) / 2, z_count)\n", + " for z in range(z_count):\n", + " xv, yv, zv = grid[:, :, :, z]\n", + " rot_xv = xv * cos(angle[z]) - yv * sin(angle[z])\n", + " rot_yv = xv * sin(angle[z]) + yv * cos(angle[z])\n", + " grid[:, :, :, z] = [rot_xv, rot_yv, zv]\n", + "\n", + " positions = np.vstack([xyz.ravel() for xyz in grid])\n", + "\n", + " colors = np.vstack(\n", + " [\n", + " xyz.ravel()\n", + " for xyz in np.mgrid[\n", + " slice(0, 255, x_count * 1j),\n", + " slice(0, 255, y_count * 1j),\n", + " slice(0, 255, z_count * 1j),\n", + " ]\n", + " ]\n", + " )\n", + "\n", + " return ColorGrid(positions.T, colors.T.astype(np.uint8))\n" + ] + }, + { + "cell_type": "markdown", + "id": "04c095ef", + "metadata": {}, + "source": [ + "## Logging some data\n", + "\n", + "Now we can log some data and add it to the recording, and display it using `notebook_show`.\n", + "\n", + "Note that displaying a recording will consume the data, so it will not be available for use in a subsequent cell." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "92871ea1", + "metadata": {}, + "outputs": [], + "source": [ + "rr.init(\"rerun_example_cube\")\n", + "\n", + "STEPS = 100\n", + "twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4\n", + "for t in range(STEPS):\n", + " rr.set_time_sequence(\"step\", t)\n", + " cube = build_color_grid(10, 10, 10, twist=twists[t])\n", + " rr.log(\"cube\", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))\n", + "\n", + "rr.notebook_show()" + ] + }, + { + "cell_type": "markdown", + "id": "187430e1", + "metadata": {}, + "source": [ + "## Logging live data\n", + "\n", + "Using `rr.notebook_show` like above buffers the data in the recording stream, but doesn't process it until the call to `rr.notebook_show`.\n", + "\n", + "However, `rr.notebook_show` can be called at any time during your cell's execution to immediately display the Rerun viewer. You can then incrementally stream to it. Here we add a sleep to simulate a cell that does a lot more processing. By calling `notebook_show` first, we can see the output of our code live while it's still running." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "246c8eb8", + "metadata": {}, + "outputs": [], + "source": [ + "from time import sleep\n", + "\n", + "rr.init(\"rerun_example_cube\")\n", + "\n", + "rr.notebook_show()\n", + "\n", + "STEPS = 100\n", + "twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4\n", + "for t in range(STEPS):\n", + " sleep(0.05)\n", + " rr.set_time_sequence(\"step\", t)\n", + " cube = build_color_grid(10, 10, 10, twist=twists[t])\n", + " rr.log(\"cube\", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))" + ] + }, + { + "cell_type": "markdown", + "id": "649b8e80-e69d-4b6b-be51-50cbf4c20495", + "metadata": {}, + "source": [ + "## Incremental logging\n", + "\n", + "Note that until we either reset the recording stream (by calling `rr.init()`), or create a new output widget (by calling `rr.notebook_show()` The currently active stream in the kernel will continue to send events to the existing widget.\n", + "\n", + "The following will add a rotation to the above recording." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7e4a9831-ac6c-4503-bcd7-b1212d0d542b", + "metadata": {}, + "outputs": [], + "source": [ + "for t in range(STEPS):\n", + " sleep(0.01)\n", + " rr.set_time_sequence(\"step\", t)\n", + " rr.log(\"cube\", rr.Transform3D(rotation=rr.RotationAxisAngle(axis=[1,0,0], degrees=t)))" + ] + }, + { + "cell_type": "markdown", + "id": "36f9f61b", + "metadata": {}, + "source": [ + "## Starting a new recording\n", + "\n", + "You can always start another recording by calling `rr.init(...)` again to reset the global stream, or alternatively creating a separate recording stream using `rr.new_recording` (discussed more below)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c4cc33fd", + "metadata": {}, + "outputs": [], + "source": [ + "rr.init(\"rerun_example_cube\")\n", + "\n", + "STEPS = 100\n", + "twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4\n", + "for t in range(STEPS):\n", + " rr.set_time_sequence(\"step\", t)\n", + " h_grid = build_color_grid(10, 3, 3, twist=twists[t])\n", + " rr.log(\"h_grid\", rr.Points3D(h_grid.positions, colors=h_grid.colors, radii=0.5))\n", + " v_grid = build_color_grid(3, 3, 10, twist=twists[t])\n", + " rr.log(\"v_grid\", rr.Points3D(v_grid.positions, colors=v_grid.colors, radii=0.5))\n", + "\n", + "rr.notebook_show()\n" + ] + }, + { + "cell_type": "markdown", + "id": "31d392a8", + "metadata": {}, + "source": [ + "## Adjusting the view\n", + "\n", + "The `notebook_show` method also lets you adjust properties such as width and height." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1a1b0f66-4287-4705-8be5-ae837ffe3f90", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "rr.init(\"rerun_example_cube\")\n", + "\n", + "small_cube = build_color_grid(3, 3, 3, twist=0)\n", + "rr.log(\"small_cube\", rr.Points3D(small_cube.positions, colors=small_cube.colors, radii=0.5))\n", + "\n", + "rr.notebook_show(width=400, height=400)\n" + ] + }, + { + "cell_type": "markdown", + "id": "ff84c840", + "metadata": {}, + "source": [ + "To update the default width and height, you can use the `rerun.notebook.set_default_size` function.\n", + "\n", + "Note that you do not need to initialize a recording to use this function." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "81157021", + "metadata": {}, + "outputs": [], + "source": [ + "from rerun.notebook import set_default_size\n", + "\n", + "set_default_size(width=400, height=400)\n", + "\n", + "rr.init(\"rerun_example_cube\")\n", + "\n", + "small_cube = build_color_grid(3, 3, 3, twist=0)\n", + "rr.log(\"small_cube\", rr.Points3D(small_cube.positions, colors=small_cube.colors, radii=0.5))\n", + "\n", + "rr.notebook_show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "755957e0", + "metadata": {}, + "outputs": [], + "source": [ + "set_default_size(width=640, height=480)" + ] + }, + { + "cell_type": "markdown", + "id": "a9812634-067f-4e07-95fb-cb9a506c42d3", + "metadata": {}, + "source": [ + "## Using blueprints\n", + "\n", + "Rerun blueprints can be used with `rr.notebook_show()`\n", + "\n", + "For example, we can split the two grids into their own respective views." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eb8f7701", + "metadata": {}, + "outputs": [], + "source": [ + "rr.init(\"rerun_example_cube\")\n", + "\n", + "blueprint = rrb.Blueprint(\n", + " rrb.Horizontal(\n", + " rrb.Spatial3DView(name=\"Horizontal grid\", origin=\"h_grid\"),\n", + " rrb.Spatial3DView(name=\"Vertical grid\", origin=\"v_grid\"),\n", + " column_shares=[2,1]),\n", + " collapse_panels=True\n", + ")\n", + "\n", + "rr.notebook_show(blueprint=blueprint)\n", + "\n", + "STEPS = 100\n", + "twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4\n", + "for t in range(STEPS):\n", + " rr.set_time_sequence(\"step\", t)\n", + " h_grid = build_color_grid(10, 3, 3, twist=twists[t])\n", + " rr.log(\"h_grid\", rr.Points3D(h_grid.positions, colors=h_grid.colors, radii=0.5))\n", + " v_grid = build_color_grid(3, 3, 10, twist=twists[t])\n", + " rr.log(\"v_grid\", rr.Points3D(v_grid.positions, colors=v_grid.colors, radii=0.5))" + ] + }, + { + "cell_type": "markdown", + "id": "a63b30d7", + "metadata": {}, + "source": [ + "## Extra convenience\n", + "\n", + "Rerun blueprints types also implement `_ipython_display_()` directly, so if a blueprint is the last element in your cell the right thing will happen.\n", + "\n", + "Note that this mechanism only works when you are using the global recording stream." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d1bf2ab", + "metadata": {}, + "outputs": [], + "source": [ + "rr.init(\"rerun_example_cube\")\n", + "\n", + "STEPS = 100\n", + "twists = math.pi * np.sin(np.linspace(0, math.tau, STEPS)) / 4\n", + "for t in range(STEPS):\n", + " rr.set_time_sequence(\"step\", t)\n", + " h_grid = build_color_grid(10, 3, 3, twist=twists[t])\n", + " rr.log(\"h_grid\", rr.Points3D(h_grid.positions, colors=h_grid.colors, radii=0.5))\n", + " v_grid = build_color_grid(3, 3, 10, twist=twists[t])\n", + " rr.log(\"v_grid\", rr.Points3D(v_grid.positions, colors=v_grid.colors, radii=0.5))\n", + "\n", + "rrb.Spatial3DView(name=\"Horizontal grid\", origin=\"h_grid\")" + ] + }, + { + "cell_type": "markdown", + "id": "ef9087de-d090-4c90-ab3e-18c20c92bff6", + "metadata": {}, + "source": [ + "## Working with non-global streams\n", + "\n", + "Sometimes it can be more explicit to work with specific (non-global recording) streams via the `new_recording` method.\n", + "\n", + "In this case, remember to call `notebook_show` directly on the recording stream. As noted above, there is no way to use a bare Blueprint object in conjunction with a non-global recording." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ed86cc19-45cf-4c21-9a94-c4ce2ade7f65", + "metadata": {}, + "outputs": [], + "source": [ + "rec = rr.new_recording(\"rerun_example_cube_flat\")\n", + "\n", + "bp = rrb.Blueprint(collapse_panels=True)\n", + "\n", + "rec.notebook_show(blueprint=bp)\n", + "\n", + "flat_grid = build_color_grid(20, 20, 1, twist=0)\n", + "rec.log(\"flat_grid\", rr.Points3D(flat_grid.positions, colors=flat_grid.colors, radii=0.5))" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 } diff --git a/examples/python/nuscenes_dataset/README.md b/examples/python/nuscenes_dataset/README.md index 930b05c7aef4..e122dc8a9830 100644 --- a/examples/python/nuscenes_dataset/README.md +++ b/examples/python/nuscenes_dataset/README.md @@ -136,7 +136,7 @@ GPS coordinates are added to the annotations similarly to the vehicle. The default blueprint for this example is created by the following code: ```python -sensor_space_views = [ +sensor_views = [ rrb.Spatial2DView( name=sensor_name, origin=f"world/ego_vehicle/{sensor_name}", @@ -162,7 +162,7 @@ blueprint = rrb.Vertical( ), column_shares=[3, 1], ), - rrb.Grid(*sensor_space_views), + rrb.Grid(*sensor_views), row_shares=[4, 2], ) ``` diff --git a/examples/python/nuscenes_dataset/nuscenes_dataset/__main__.py b/examples/python/nuscenes_dataset/nuscenes_dataset/__main__.py index a4e2a02306f6..8f4e7f446efd 100755 --- a/examples/python/nuscenes_dataset/nuscenes_dataset/__main__.py +++ b/examples/python/nuscenes_dataset/nuscenes_dataset/__main__.py @@ -310,7 +310,7 @@ def main() -> None: nusc = nuscenes.NuScenes(version=args.dataset_version, dataroot=args.root_dir, verbose=True) # Set up the Rerun Blueprint (how the visualization is organized): - sensor_space_views = [ + sensor_views = [ rrb.Spatial2DView( name=sensor_name, origin=f"world/ego_vehicle/{sensor_name}", @@ -343,7 +343,7 @@ def main() -> None: ), column_shares=[3, 1], ), - rrb.Grid(*sensor_space_views), + rrb.Grid(*sensor_views), row_shares=[4, 2], ), rrb.TimePanel(state="collapsed"), diff --git a/examples/rust/chess_robby_fischer/README.md b/examples/rust/chess_robby_fischer/README.md index bdff31ceb8ac..a1309eae90fd 100644 --- a/examples/rust/chess_robby_fischer/README.md +++ b/examples/rust/chess_robby_fischer/README.md @@ -224,7 +224,7 @@ impl PieceModelInfo { ### Image -To see the image projection in the 3D space view we must log the cameras transformation and it's intrinsic parameters. +To see the image projection in the 3D view we must log the cameras transformation and it's intrinsic parameters. ```rust // Computes the transformation `camera_to_a8` that goes from camera coordinates to board coordinates using the fiducial markers located at the corners of the board. @@ -313,7 +313,7 @@ blueprint = rrb.Blueprint( ), column_shares=[2,2,3] ), - auto_space_views=False, + auto_views=False, collapse_panels=True, ) diff --git a/examples/rust/custom_space_view/Cargo.toml b/examples/rust/custom_view/Cargo.toml similarity index 96% rename from examples/rust/custom_space_view/Cargo.toml rename to examples/rust/custom_view/Cargo.toml index b8a6ca9fe0a5..31818d428102 100644 --- a/examples/rust/custom_space_view/Cargo.toml +++ b/examples/rust/custom_view/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "custom_space_view" +name = "custom_view" version = "0.21.0-alpha.1+dev" edition = "2021" rust-version = "1.80" diff --git a/examples/rust/custom_space_view/README.md b/examples/rust/custom_view/README.md similarity index 84% rename from examples/rust/custom_space_view/README.md rename to examples/rust/custom_view/README.md index 9c6d74bd59ce..f7f6a6e9b88c 100644 --- a/examples/rust/custom_space_view/README.md +++ b/examples/rust/custom_view/README.md @@ -1,5 +1,5 @@ @@ -10,10 +10,10 @@ thumbnail_dimensions = [480, 343] - Custom Space View UI example screenshot + Custom View UI example screenshot -Example showing how to add custom Space View classes to extend the Rerun Viewer. +Example showing how to add custom View classes to extend the Rerun Viewer. The example is really basic, but should be something you can build upon. @@ -25,6 +25,6 @@ you have to build the web viewer of the version yourself. This is currently not supported outside of the Rerun repository. ## Testing it -Start it with `cargo run -p custom_space_view`. +Start it with `cargo run -p custom_view`. Then put some data into it with: `cargo run -p minimal_options -- --connect` diff --git a/examples/rust/custom_space_view/src/color_coordinates_space_view.rs b/examples/rust/custom_view/src/color_coordinates_view.rs similarity index 80% rename from examples/rust/custom_space_view/src/color_coordinates_space_view.rs rename to examples/rust/custom_view/src/color_coordinates_view.rs index 9bcec0ca9ec1..f01a3ff02b32 100644 --- a/examples/rust/custom_space_view/src/color_coordinates_space_view.rs +++ b/examples/rust/custom_view/src/color_coordinates_view.rs @@ -3,20 +3,19 @@ use re_viewer::external::{ re_data_ui::{item_ui, DataUi}, re_entity_db::InstancePath, re_log_types::EntityPath, - re_types::SpaceViewClassIdentifier, + re_types::ViewClassIdentifier, re_ui, re_viewer_context::{ - HoverHighlight, IdentifiedViewSystem as _, Item, SelectionHighlight, SpaceViewClass, - SpaceViewClassLayoutPriority, SpaceViewClassRegistryError, SpaceViewId, - SpaceViewSpawnHeuristics, SpaceViewState, SpaceViewStateExt as _, - SpaceViewSystemExecutionError, SpaceViewSystemRegistrator, SystemExecutionOutput, UiLayout, - ViewQuery, ViewerContext, + HoverHighlight, IdentifiedViewSystem as _, Item, SelectionHighlight, SystemExecutionOutput, + UiLayout, ViewClass, ViewClassLayoutPriority, ViewClassRegistryError, ViewId, ViewQuery, + ViewSpawnHeuristics, ViewState, ViewStateExt as _, ViewSystemExecutionError, + ViewSystemRegistrator, ViewerContext, }, }; use crate::color_coordinates_visualizer_system::{ColorWithInstance, InstanceColorSystem}; -/// The different modes for displaying color coordinates in the custom space view. +/// The different modes for displaying color coordinates in the custom view. #[derive(Default, Debug, PartialEq, Clone, Copy)] enum ColorCoordinatesMode { #[default] @@ -43,17 +42,17 @@ impl std::fmt::Display for ColorCoordinatesMode { } } -/// Space view state for the custom space view. +/// View state for the custom view. /// /// This state is preserved between frames, but not across Viewer sessions. #[derive(Default)] -pub struct ColorCoordinatesSpaceViewState { +pub struct ColorCoordinatesViewState { // TODO(wumpf, jleibs): This should be part of the Blueprint so that it is serialized out. // but right now there is no way of doing that. mode: ColorCoordinatesMode, } -impl SpaceViewState for ColorCoordinatesSpaceViewState { +impl ViewState for ColorCoordinatesViewState { fn as_any(&self) -> &dyn std::any::Any { self } @@ -64,12 +63,12 @@ impl SpaceViewState for ColorCoordinatesSpaceViewState { } #[derive(Default)] -pub struct ColorCoordinatesSpaceView; +pub struct ColorCoordinatesView; -impl SpaceViewClass for ColorCoordinatesSpaceView { +impl ViewClass for ColorCoordinatesView { // State type as described above. - fn identifier() -> SpaceViewClassIdentifier { + fn identifier() -> ViewClassIdentifier { "ColorCoordinates".into() } @@ -78,59 +77,59 @@ impl SpaceViewClass for ColorCoordinatesSpaceView { } fn icon(&self) -> &'static re_ui::Icon { - &re_ui::icons::SPACE_VIEW_GENERIC + &re_ui::icons::VIEW_GENERIC } fn help_markdown(&self, _egui_ctx: &egui::Context) -> String { - "A demo space view that shows colors as coordinates on a 2D plane.".to_owned() + "A demo view that shows colors as coordinates on a 2D plane.".to_owned() } - /// Register all systems (contexts & parts) that the space view needs. + /// Register all systems (contexts & parts) that the view needs. fn on_register( &self, - system_registry: &mut SpaceViewSystemRegistrator<'_>, - ) -> Result<(), SpaceViewClassRegistryError> { + system_registry: &mut ViewSystemRegistrator<'_>, + ) -> Result<(), ViewClassRegistryError> { system_registry.register_visualizer::() } - fn new_state(&self) -> Box { - Box::::default() + fn new_state(&self) -> Box { + Box::::default() } - fn preferred_tile_aspect_ratio(&self, _state: &dyn SpaceViewState) -> Option { + fn preferred_tile_aspect_ratio(&self, _state: &dyn ViewState) -> Option { // Prefer a square tile if possible. Some(1.0) } - fn layout_priority(&self) -> SpaceViewClassLayoutPriority { + fn layout_priority(&self) -> ViewClassLayoutPriority { Default::default() } - fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics { + fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> ViewSpawnHeuristics { // By default spawn a single view at the root if there's anything the visualizer is applicable to. if ctx .applicable_entities_per_visualizer .get(&InstanceColorSystem::identifier()) .map_or(true, |entities| entities.is_empty()) { - SpaceViewSpawnHeuristics::default() + ViewSpawnHeuristics::default() } else { - SpaceViewSpawnHeuristics::root() + ViewSpawnHeuristics::root() } } - /// Additional UI displayed when the space view is selected. + /// Additional UI displayed when the view is selected. /// /// In this sample we show a combo box to select the color coordinates mode. fn selection_ui( &self, _ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, _space_origin: &EntityPath, - _space_view_id: SpaceViewId, - ) -> Result<(), SpaceViewSystemExecutionError> { - let state = state.downcast_mut::()?; + _view_id: ViewId, + ) -> Result<(), ViewSystemExecutionError> { + let state = state.downcast_mut::()?; ui.horizontal(|ui| { ui.label("Coordinates mode"); @@ -146,20 +145,20 @@ impl SpaceViewClass for ColorCoordinatesSpaceView { Ok(()) } - /// The contents of the Space View window and all interaction within it. + /// The contents of the View window and all interaction within it. /// /// This is called with freshly created & executed context & part systems. fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - state: &mut dyn SpaceViewState, + state: &mut dyn ViewState, query: &ViewQuery<'_>, system_output: SystemExecutionOutput, - ) -> Result<(), SpaceViewSystemExecutionError> { + ) -> Result<(), ViewSystemExecutionError> { let colors = system_output.view_systems.get::()?; - let state = state.downcast_mut::()?; + let state = state.downcast_mut::()?; egui::Frame::default().show(ui, |ui| { let color_at = match state.mode { @@ -268,7 +267,7 @@ fn color_space_ui( &ctx.current_query(), ctx.recording(), ui, - Some(query.space_view_id), + Some(query.view_id), &instance, ); instance.data_ui( @@ -279,7 +278,7 @@ fn color_space_ui( ctx.recording(), ); }); - ctx.select_hovered_on_click(&interact, Item::DataResult(query.space_view_id, instance)); + ctx.select_hovered_on_click(&interact, Item::DataResult(query.view_id, instance)); } } diff --git a/examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs b/examples/rust/custom_view/src/color_coordinates_visualizer_system.rs similarity index 86% rename from examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs rename to examples/rust/custom_view/src/color_coordinates_visualizer_system.rs index 695195c3c250..4f9f20bfe955 100644 --- a/examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs +++ b/examples/rust/custom_view/src/color_coordinates_visualizer_system.rs @@ -4,13 +4,12 @@ use re_viewer::external::{ re_renderer, re_types::{self, components::Color, Component as _, ComponentDescriptor}, re_viewer_context::{ - self, IdentifiedViewSystem, SpaceViewSystemExecutionError, ViewContext, - ViewContextCollection, ViewQuery, ViewSystemIdentifier, VisualizerQueryInfo, - VisualizerSystem, + self, IdentifiedViewSystem, ViewContext, ViewContextCollection, ViewQuery, + ViewSystemExecutionError, ViewSystemIdentifier, VisualizerQueryInfo, VisualizerSystem, }, }; -/// Our space view consist of single part which holds a list of egui colors for each entity path. +/// Our view consist of single part which holds a list of egui colors for each entity path. #[derive(Default)] pub struct InstanceColorSystem { pub colors: Vec<(EntityPath, Vec)>, @@ -56,8 +55,8 @@ impl VisualizerSystem for InstanceColorSystem { ctx: &ViewContext<'_>, query: &ViewQuery<'_>, _context_systems: &ViewContextCollection, - ) -> Result, SpaceViewSystemExecutionError> { - // For each entity in the space view that should be displayed with the `InstanceColorSystem`… + ) -> Result, ViewSystemExecutionError> { + // For each entity in the view that should be displayed with the `InstanceColorSystem`… for data_result in query.iter_visible_data_results(ctx, Self::identifier()) { // …gather all colors and their instance ids. diff --git a/examples/rust/custom_space_view/src/main.rs b/examples/rust/custom_view/src/main.rs similarity index 89% rename from examples/rust/custom_space_view/src/main.rs rename to examples/rust/custom_view/src/main.rs index db8dd7d6777d..58e98f3b9a85 100644 --- a/examples/rust/custom_space_view/src/main.rs +++ b/examples/rust/custom_view/src/main.rs @@ -1,8 +1,8 @@ -//! This example shows how to add custom Space Views to the Rerun Viewer. +//! This example shows how to add custom Views to the Rerun Viewer. use re_viewer::external::{re_log, re_memory}; -mod color_coordinates_space_view; +mod color_coordinates_view; mod color_coordinates_visualizer_system; // By using `re_memory::AccountingAllocator` Rerun can keep track of exactly how much memory it is using, @@ -49,8 +49,8 @@ fn main() -> Result<(), Box> { ); app.add_receiver(rx); - // Register the custom space view - app.add_space_view_class::() + // Register the custom view + app.add_view_class::() .unwrap(); Box::new(app) diff --git a/rerun_cpp/.gitattributes b/rerun_cpp/.gitattributes index bd6535a174df..e03da8a9025e 100644 --- a/rerun_cpp/.gitattributes +++ b/rerun_cpp/.gitattributes @@ -48,8 +48,8 @@ src/rerun/archetypes/transform3d.hpp linguist-generated=true src/rerun/archetypes/view_coordinates.cpp linguist-generated=true src/rerun/archetypes/view_coordinates.hpp linguist-generated=true src/rerun/archetypes.hpp linguist-generated=true -src/rerun/blueprint/auto_space_views.cpp linguist-generated=true -src/rerun/blueprint/auto_space_views.hpp linguist-generated=true +src/rerun/blueprint/auto_views.cpp linguist-generated=true +src/rerun/blueprint/auto_views.hpp linguist-generated=true src/rerun/blueprint/panel_view.cpp linguist-generated=true src/rerun/blueprint/panel_view.hpp linguist-generated=true src/rerun/blueprint/space_view_component.cpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp b/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp index 91bffa754c0b..298fe3c31c7f 100644 --- a/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp +++ b/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp @@ -18,7 +18,7 @@ namespace rerun::archetypes { /// /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, /// making it impossible to transform the entity path into its parent's space and vice versa. - /// It *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views. + /// It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. /// This is useful for specifying that a subgraph is independent of the rest of the scene. /// /// ## Example diff --git a/rerun_cpp/src/rerun/archetypes/transform3d.hpp b/rerun_cpp/src/rerun/archetypes/transform3d.hpp index 89c927287db8..7ced69fb7342 100644 --- a/rerun_cpp/src/rerun/archetypes/transform3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/transform3d.hpp @@ -82,7 +82,7 @@ namespace rerun::archetypes { /// const auto rec = rerun::RecordingStream("rerun_example_transform3d_hierarchy"); /// rec.spawn().exit_on_failure(); /// - /// // TODO(#5521): log two space views as in the python example + /// // TODO(#5521): log two views as in the python example /// /// rec.set_time_seconds("sim_time", 0.0); /// diff --git a/rerun_cpp/src/rerun/blueprint.hpp b/rerun_cpp/src/rerun/blueprint.hpp index c9296740f4fd..6bcce6fd744d 100644 --- a/rerun_cpp/src/rerun/blueprint.hpp +++ b/rerun_cpp/src/rerun/blueprint.hpp @@ -2,7 +2,7 @@ #pragma once -#include "blueprint/auto_space_views.hpp" +#include "blueprint/auto_views.hpp" #include "blueprint/entity_properties_component.hpp" #include "blueprint/panel_view.hpp" #include "blueprint/query_expressions.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/archetypes.hpp b/rerun_cpp/src/rerun/blueprint/archetypes.hpp index 75ec3053e31b..f29777108ae4 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes.hpp @@ -16,11 +16,11 @@ #include "blueprint/archetypes/panel_blueprint.hpp" #include "blueprint/archetypes/plot_legend.hpp" #include "blueprint/archetypes/scalar_axis.hpp" -#include "blueprint/archetypes/space_view_blueprint.hpp" -#include "blueprint/archetypes/space_view_contents.hpp" #include "blueprint/archetypes/tensor_scalar_mapping.hpp" #include "blueprint/archetypes/tensor_slice_selection.hpp" #include "blueprint/archetypes/tensor_view_fit.hpp" +#include "blueprint/archetypes/view_blueprint.hpp" +#include "blueprint/archetypes/view_contents.hpp" #include "blueprint/archetypes/viewport_blueprint.hpp" #include "blueprint/archetypes/visible_time_ranges.hpp" #include "blueprint/archetypes/visual_bounds2d.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes index e2e5fc6eb05e..4f4c826ff1bd 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes @@ -29,16 +29,16 @@ plot_legend.cpp linguist-generated=true plot_legend.hpp linguist-generated=true scalar_axis.cpp linguist-generated=true scalar_axis.hpp linguist-generated=true -space_view_blueprint.cpp linguist-generated=true -space_view_blueprint.hpp linguist-generated=true -space_view_contents.cpp linguist-generated=true -space_view_contents.hpp linguist-generated=true tensor_scalar_mapping.cpp linguist-generated=true tensor_scalar_mapping.hpp linguist-generated=true tensor_slice_selection.cpp linguist-generated=true tensor_slice_selection.hpp linguist-generated=true tensor_view_fit.cpp linguist-generated=true tensor_view_fit.hpp linguist-generated=true +view_blueprint.cpp linguist-generated=true +view_blueprint.hpp linguist-generated=true +view_contents.cpp linguist-generated=true +view_contents.hpp linguist-generated=true viewport_blueprint.cpp linguist-generated=true viewport_blueprint.hpp linguist-generated=true visible_time_ranges.cpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp index 19377b7ab6f7..caff22d94b70 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp @@ -31,7 +31,7 @@ namespace rerun::blueprint::archetypes { /// The name of the container. std::optional display_name; - /// `ContainerId`s or `SpaceViewId`s that are children of this container. + /// `ContainerId`s or `ViewId`s that are children of this container. std::optional> contents; /// The layout shares of each column in the container. @@ -86,7 +86,7 @@ namespace rerun::blueprint::archetypes { RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - /// `ContainerId`s or `SpaceViewId`s that are children of this container. + /// `ContainerId`s or `ViewId`s that are children of this container. ContainerBlueprint with_contents( Collection _contents ) && { diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_blueprint.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/view_blueprint.cpp similarity index 76% rename from rerun_cpp/src/rerun/blueprint/archetypes/space_view_blueprint.cpp rename to rerun_cpp/src/rerun/blueprint/archetypes/view_blueprint.cpp index ea6081310147..4ce5f6614fe7 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_blueprint.cpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/view_blueprint.cpp @@ -1,7 +1,7 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_blueprint.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/view_blueprint.fbs". -#include "space_view_blueprint.hpp" +#include "view_blueprint.hpp" #include "../../collection_adapter_builtins.hpp" @@ -10,8 +10,8 @@ namespace rerun::blueprint::archetypes {} namespace rerun { Result> - AsComponents::serialize( - const blueprint::archetypes::SpaceViewBlueprint& archetype + AsComponents::serialize( + const blueprint::archetypes::ViewBlueprint& archetype ) { using namespace blueprint::archetypes; std::vector cells; @@ -21,9 +21,9 @@ namespace rerun { auto result = ComponentBatch::from_loggable( archetype.class_identifier, ComponentDescriptor( - "rerun.blueprint.archetypes.SpaceViewBlueprint", + "rerun.blueprint.archetypes.ViewBlueprint", "class_identifier", - "rerun.blueprint.components.SpaceViewClass" + "rerun.blueprint.components.ViewClass" ) ); RR_RETURN_NOT_OK(result.error); @@ -33,7 +33,7 @@ namespace rerun { auto result = ComponentBatch::from_loggable( archetype.display_name.value(), ComponentDescriptor( - "rerun.blueprint.archetypes.SpaceViewBlueprint", + "rerun.blueprint.archetypes.ViewBlueprint", "display_name", "rerun.components.Name" ) @@ -45,9 +45,9 @@ namespace rerun { auto result = ComponentBatch::from_loggable( archetype.space_origin.value(), ComponentDescriptor( - "rerun.blueprint.archetypes.SpaceViewBlueprint", + "rerun.blueprint.archetypes.ViewBlueprint", "space_origin", - "rerun.blueprint.components.SpaceViewOrigin" + "rerun.blueprint.components.ViewOrigin" ) ); RR_RETURN_NOT_OK(result.error); @@ -57,7 +57,7 @@ namespace rerun { auto result = ComponentBatch::from_loggable( archetype.visible.value(), ComponentDescriptor( - "rerun.blueprint.archetypes.SpaceViewBlueprint", + "rerun.blueprint.archetypes.ViewBlueprint", "visible", "rerun.blueprint.components.Visible" ) @@ -66,7 +66,7 @@ namespace rerun { cells.push_back(std::move(result.value)); } { - auto indicator = SpaceViewBlueprint::IndicatorComponent(); + auto indicator = ViewBlueprint::IndicatorComponent(); auto result = ComponentBatch::from_loggable(indicator); RR_RETURN_NOT_OK(result.error); cells.emplace_back(std::move(result.value)); diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_blueprint.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/view_blueprint.hpp similarity index 63% rename from rerun_cpp/src/rerun/blueprint/archetypes/space_view_blueprint.hpp rename to rerun_cpp/src/rerun/blueprint/archetypes/view_blueprint.hpp index 99fbac7b07ab..b01bf69b239e 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_blueprint.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/view_blueprint.hpp @@ -1,10 +1,10 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_blueprint.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/view_blueprint.fbs". #pragma once -#include "../../blueprint/components/space_view_class.hpp" -#include "../../blueprint/components/space_view_origin.hpp" +#include "../../blueprint/components/view_class.hpp" +#include "../../blueprint/components/view_origin.hpp" #include "../../blueprint/components/visible.hpp" #include "../../collection.hpp" #include "../../compiler_utils.hpp" @@ -20,67 +20,65 @@ namespace rerun::blueprint::archetypes { /// **Archetype**: The description of a single view. - struct SpaceViewBlueprint { + struct ViewBlueprint { /// The class of the view. - rerun::blueprint::components::SpaceViewClass class_identifier; + rerun::blueprint::components::ViewClass class_identifier; /// The name of the view. std::optional display_name; - /// The "anchor point" of this space view. + /// The "anchor point" of this view. /// /// Defaults to the root path '/' if not specified. /// - /// The transform at this path forms the reference point for all scene->world transforms in this space view. - /// I.e. the position of this entity path in space forms the origin of the coordinate system in this space view. - /// Furthermore, this is the primary indicator for heuristics on what entities we show in this space view. - std::optional space_origin; + /// The transform at this path forms the reference point for all scene->world transforms in this view. + /// I.e. the position of this entity path in space forms the origin of the coordinate system in this view. + /// Furthermore, this is the primary indicator for heuristics on what entities we show in this view. + std::optional space_origin; - /// Whether this space view is visible. + /// Whether this view is visible. /// /// Defaults to true if not specified. std::optional visible; public: static constexpr const char IndicatorComponentName[] = - "rerun.blueprint.components.SpaceViewBlueprintIndicator"; + "rerun.blueprint.components.ViewBlueprintIndicator"; /// Indicator component, used to identify the archetype when converting to a list of components. using IndicatorComponent = rerun::components::IndicatorComponent; public: - SpaceViewBlueprint() = default; - SpaceViewBlueprint(SpaceViewBlueprint&& other) = default; + ViewBlueprint() = default; + ViewBlueprint(ViewBlueprint&& other) = default; - explicit SpaceViewBlueprint(rerun::blueprint::components::SpaceViewClass _class_identifier) + explicit ViewBlueprint(rerun::blueprint::components::ViewClass _class_identifier) : class_identifier(std::move(_class_identifier)) {} /// The name of the view. - SpaceViewBlueprint with_display_name(rerun::components::Name _display_name) && { + ViewBlueprint with_display_name(rerun::components::Name _display_name) && { display_name = std::move(_display_name); // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - /// The "anchor point" of this space view. + /// The "anchor point" of this view. /// /// Defaults to the root path '/' if not specified. /// - /// The transform at this path forms the reference point for all scene->world transforms in this space view. - /// I.e. the position of this entity path in space forms the origin of the coordinate system in this space view. - /// Furthermore, this is the primary indicator for heuristics on what entities we show in this space view. - SpaceViewBlueprint with_space_origin( - rerun::blueprint::components::SpaceViewOrigin _space_origin - ) && { + /// The transform at this path forms the reference point for all scene->world transforms in this view. + /// I.e. the position of this entity path in space forms the origin of the coordinate system in this view. + /// Furthermore, this is the primary indicator for heuristics on what entities we show in this view. + ViewBlueprint with_space_origin(rerun::blueprint::components::ViewOrigin _space_origin) && { space_origin = std::move(_space_origin); // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - /// Whether this space view is visible. + /// Whether this view is visible. /// /// Defaults to true if not specified. - SpaceViewBlueprint with_visible(rerun::blueprint::components::Visible _visible) && { + ViewBlueprint with_visible(rerun::blueprint::components::Visible _visible) && { visible = std::move(_visible); // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) @@ -96,10 +94,10 @@ namespace rerun { /// \private template <> - struct AsComponents { + struct AsComponents { /// Serialize all set component batches. static Result> serialize( - const blueprint::archetypes::SpaceViewBlueprint& archetype + const blueprint::archetypes::ViewBlueprint& archetype ); }; } // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_contents.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/view_contents.cpp similarity index 74% rename from rerun_cpp/src/rerun/blueprint/archetypes/space_view_contents.cpp rename to rerun_cpp/src/rerun/blueprint/archetypes/view_contents.cpp index 106519b35a7c..4a506dfae983 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_contents.cpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/view_contents.cpp @@ -1,7 +1,7 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_contents.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/view_contents.fbs". -#include "space_view_contents.hpp" +#include "view_contents.hpp" #include "../../collection_adapter_builtins.hpp" @@ -10,8 +10,8 @@ namespace rerun::blueprint::archetypes {} namespace rerun { Result> - AsComponents::serialize( - const blueprint::archetypes::SpaceViewContents& archetype + AsComponents::serialize( + const blueprint::archetypes::ViewContents& archetype ) { using namespace blueprint::archetypes; std::vector cells; @@ -21,7 +21,7 @@ namespace rerun { auto result = ComponentBatch::from_loggable( archetype.query, ComponentDescriptor( - "rerun.blueprint.archetypes.SpaceViewContents", + "rerun.blueprint.archetypes.ViewContents", "query", "rerun.blueprint.components.QueryExpression" ) @@ -30,7 +30,7 @@ namespace rerun { cells.push_back(std::move(result.value)); } { - auto indicator = SpaceViewContents::IndicatorComponent(); + auto indicator = ViewContents::IndicatorComponent(); auto result = ComponentBatch::from_loggable(indicator); RR_RETURN_NOT_OK(result.error); cells.emplace_back(std::move(result.value)); diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_contents.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/view_contents.hpp similarity index 82% rename from rerun_cpp/src/rerun/blueprint/archetypes/space_view_contents.hpp rename to rerun_cpp/src/rerun/blueprint/archetypes/view_contents.hpp index 600fc09e2699..82f4b01d36e3 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_contents.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/view_contents.hpp @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_contents.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/view_contents.fbs". #pragma once @@ -14,7 +14,7 @@ #include namespace rerun::blueprint::archetypes { - /// **Archetype**: The contents of a `SpaceView`. + /// **Archetype**: The contents of a `View`. /// /// The contents are found by combining a collection of `QueryExpression`s. /// @@ -52,24 +52,24 @@ namespace rerun::blueprint::archetypes { /// The last rule matching `/world/car/hood` is `- /world/car/**`, so it is excluded. /// The last rule matching `/world` is `- /world`, so it is excluded. /// The last rule matching `/world/house` is `+ /world/**`, so it is included. - struct SpaceViewContents { - /// The `QueryExpression` that populates the contents for the `SpaceView`. + struct ViewContents { + /// The `QueryExpression` that populates the contents for the view. /// - /// They determine which entities are part of the spaceview. + /// They determine which entities are part of the view. Collection query; public: static constexpr const char IndicatorComponentName[] = - "rerun.blueprint.components.SpaceViewContentsIndicator"; + "rerun.blueprint.components.ViewContentsIndicator"; /// Indicator component, used to identify the archetype when converting to a list of components. using IndicatorComponent = rerun::components::IndicatorComponent; public: - SpaceViewContents() = default; - SpaceViewContents(SpaceViewContents&& other) = default; + ViewContents() = default; + ViewContents(ViewContents&& other) = default; - explicit SpaceViewContents(Collection _query) + explicit ViewContents(Collection _query) : query(std::move(_query)) {} }; @@ -82,10 +82,10 @@ namespace rerun { /// \private template <> - struct AsComponents { + struct AsComponents { /// Serialize all set component batches. static Result> serialize( - const blueprint::archetypes::SpaceViewContents& archetype + const blueprint::archetypes::ViewContents& archetype ); }; } // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.cpp index 8d7dc36d615f..40accef09eb8 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.cpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.cpp @@ -35,7 +35,7 @@ namespace rerun { ComponentDescriptor( "rerun.blueprint.archetypes.ViewportBlueprint", "maximized", - "rerun.blueprint.components.SpaceViewMaximized" + "rerun.blueprint.components.ViewMaximized" ) ); RR_RETURN_NOT_OK(result.error); @@ -53,13 +53,13 @@ namespace rerun { RR_RETURN_NOT_OK(result.error); cells.push_back(std::move(result.value)); } - if (archetype.auto_space_views.has_value()) { + if (archetype.auto_views.has_value()) { auto result = ComponentBatch::from_loggable( - archetype.auto_space_views.value(), + archetype.auto_views.value(), ComponentDescriptor( "rerun.blueprint.archetypes.ViewportBlueprint", - "auto_space_views", - "rerun.blueprint.components.AutoSpaceViews" + "auto_views", + "rerun.blueprint.components.AutoViews" ) ); RR_RETURN_NOT_OK(result.error); diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.hpp index 6bc8245e6240..ab43837facf7 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.hpp @@ -4,9 +4,9 @@ #pragma once #include "../../blueprint/components/auto_layout.hpp" -#include "../../blueprint/components/auto_space_views.hpp" +#include "../../blueprint/components/auto_views.hpp" #include "../../blueprint/components/root_container.hpp" -#include "../../blueprint/components/space_view_maximized.hpp" +#include "../../blueprint/components/view_maximized.hpp" #include "../../blueprint/components/viewer_recommendation_hash.hpp" #include "../../collection.hpp" #include "../../compiler_utils.hpp" @@ -22,31 +22,31 @@ namespace rerun::blueprint::archetypes { /// **Archetype**: The top-level description of the viewport. struct ViewportBlueprint { - /// The layout of the space-views + /// The layout of the views std::optional root_container; /// Show one tab as maximized? - std::optional maximized; + std::optional maximized; /// Whether the viewport layout is determined automatically. /// - /// If `true`, the container layout will be reset whenever a new space view is added or removed. + /// If `true`, the container layout will be reset whenever a new view is added or removed. /// This defaults to `false` and is automatically set to `false` when there is user determined layout. std::optional auto_layout; - /// Whether or not space views should be created automatically. + /// Whether or not views should be created automatically. /// - /// If `true`, the viewer will only add space views that it hasn't considered previously (as identified by `past_viewer_recommendations`) - /// and which aren't deemed redundant to existing space views. - /// This defaults to `false` and is automatically set to `false` when the user adds space views manually in the viewer. - std::optional auto_space_views; + /// If `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`) + /// and which aren't deemed redundant to existing views. + /// This defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer. + std::optional auto_views; - /// Hashes of all recommended space views the viewer has already added and that should not be added again. + /// Hashes of all recommended views the viewer has already added and that should not be added again. /// /// This is an internal field and should not be set usually. - /// If you want the viewer from stopping to add space views, you should set `auto_space_views` to `false`. + /// If you want the viewer from stopping to add views, you should set `auto_views` to `false`. /// - /// The viewer uses this to determine whether it should keep adding space views. + /// The viewer uses this to determine whether it should keep adding views. std::optional> past_viewer_recommendations; @@ -61,7 +61,7 @@ namespace rerun::blueprint::archetypes { ViewportBlueprint() = default; ViewportBlueprint(ViewportBlueprint&& other) = default; - /// The layout of the space-views + /// The layout of the views ViewportBlueprint with_root_container( rerun::blueprint::components::RootContainer _root_container ) && { @@ -71,7 +71,7 @@ namespace rerun::blueprint::archetypes { } /// Show one tab as maximized? - ViewportBlueprint with_maximized(rerun::blueprint::components::SpaceViewMaximized _maximized + ViewportBlueprint with_maximized(rerun::blueprint::components::ViewMaximized _maximized ) && { maximized = std::move(_maximized); // See: https://github.com/rerun-io/rerun/issues/4027 @@ -80,7 +80,7 @@ namespace rerun::blueprint::archetypes { /// Whether the viewport layout is determined automatically. /// - /// If `true`, the container layout will be reset whenever a new space view is added or removed. + /// If `true`, the container layout will be reset whenever a new view is added or removed. /// This defaults to `false` and is automatically set to `false` when there is user determined layout. ViewportBlueprint with_auto_layout(rerun::blueprint::components::AutoLayout _auto_layout ) && { @@ -89,25 +89,23 @@ namespace rerun::blueprint::archetypes { RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - /// Whether or not space views should be created automatically. + /// Whether or not views should be created automatically. /// - /// If `true`, the viewer will only add space views that it hasn't considered previously (as identified by `past_viewer_recommendations`) - /// and which aren't deemed redundant to existing space views. - /// This defaults to `false` and is automatically set to `false` when the user adds space views manually in the viewer. - ViewportBlueprint with_auto_space_views( - rerun::blueprint::components::AutoSpaceViews _auto_space_views - ) && { - auto_space_views = std::move(_auto_space_views); + /// If `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`) + /// and which aren't deemed redundant to existing views. + /// This defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer. + ViewportBlueprint with_auto_views(rerun::blueprint::components::AutoViews _auto_views) && { + auto_views = std::move(_auto_views); // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - /// Hashes of all recommended space views the viewer has already added and that should not be added again. + /// Hashes of all recommended views the viewer has already added and that should not be added again. /// /// This is an internal field and should not be set usually. - /// If you want the viewer from stopping to add space views, you should set `auto_space_views` to `false`. + /// If you want the viewer from stopping to add views, you should set `auto_views` to `false`. /// - /// The viewer uses this to determine whether it should keep adding space views. + /// The viewer uses this to determine whether it should keep adding views. ViewportBlueprint with_past_viewer_recommendations( Collection _past_viewer_recommendations diff --git a/rerun_cpp/src/rerun/blueprint/components.hpp b/rerun_cpp/src/rerun/blueprint/components.hpp index 9407110804f8..5a464d805a01 100644 --- a/rerun_cpp/src/rerun/blueprint/components.hpp +++ b/rerun_cpp/src/rerun/blueprint/components.hpp @@ -5,7 +5,7 @@ #include "blueprint/components/active_tab.hpp" #include "blueprint/components/apply_latest_at.hpp" #include "blueprint/components/auto_layout.hpp" -#include "blueprint/components/auto_space_views.hpp" +#include "blueprint/components/auto_views.hpp" #include "blueprint/components/background_kind.hpp" #include "blueprint/components/column_share.hpp" #include "blueprint/components/component_column_selector.hpp" @@ -29,12 +29,12 @@ #include "blueprint/components/root_container.hpp" #include "blueprint/components/row_share.hpp" #include "blueprint/components/selected_columns.hpp" -#include "blueprint/components/space_view_class.hpp" -#include "blueprint/components/space_view_maximized.hpp" -#include "blueprint/components/space_view_origin.hpp" #include "blueprint/components/tensor_dimension_index_slider.hpp" #include "blueprint/components/timeline_name.hpp" +#include "blueprint/components/view_class.hpp" #include "blueprint/components/view_fit.hpp" +#include "blueprint/components/view_maximized.hpp" +#include "blueprint/components/view_origin.hpp" #include "blueprint/components/viewer_recommendation_hash.hpp" #include "blueprint/components/visible.hpp" #include "blueprint/components/visible_time_range.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/components/.gitattributes b/rerun_cpp/src/rerun/blueprint/components/.gitattributes index 222d19806052..377de233c7ab 100644 --- a/rerun_cpp/src/rerun/blueprint/components/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/components/.gitattributes @@ -4,7 +4,7 @@ active_tab.hpp linguist-generated=true apply_latest_at.hpp linguist-generated=true auto_layout.hpp linguist-generated=true -auto_space_views.hpp linguist-generated=true +auto_views.hpp linguist-generated=true background_kind.cpp linguist-generated=true background_kind.hpp linguist-generated=true column_share.hpp linguist-generated=true @@ -33,13 +33,13 @@ query_expression.hpp linguist-generated=true root_container.hpp linguist-generated=true row_share.hpp linguist-generated=true selected_columns.hpp linguist-generated=true -space_view_class.hpp linguist-generated=true -space_view_maximized.hpp linguist-generated=true -space_view_origin.hpp linguist-generated=true tensor_dimension_index_slider.hpp linguist-generated=true timeline_name.hpp linguist-generated=true +view_class.hpp linguist-generated=true view_fit.cpp linguist-generated=true view_fit.hpp linguist-generated=true +view_maximized.hpp linguist-generated=true +view_origin.hpp linguist-generated=true viewer_recommendation_hash.hpp linguist-generated=true visible.hpp linguist-generated=true visible_time_range.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/components/auto_space_views.hpp b/rerun_cpp/src/rerun/blueprint/components/auto_views.hpp similarity index 60% rename from rerun_cpp/src/rerun/blueprint/components/auto_space_views.hpp rename to rerun_cpp/src/rerun/blueprint/components/auto_views.hpp index b856d6bb6622..d016e280ca22 100644 --- a/rerun_cpp/src/rerun/blueprint/components/auto_space_views.hpp +++ b/rerun_cpp/src/rerun/blueprint/components/auto_views.hpp @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/auto_views.fbs". #pragma once @@ -11,52 +11,50 @@ #include namespace rerun::blueprint::components { - /// **Component**: Whether or not space views should be created automatically. - struct AutoSpaceViews { - rerun::datatypes::Bool auto_space_views; + /// **Component**: Whether or not views should be created automatically. + struct AutoViews { + rerun::datatypes::Bool auto_views; public: - AutoSpaceViews() = default; + AutoViews() = default; - AutoSpaceViews(rerun::datatypes::Bool auto_space_views_) - : auto_space_views(auto_space_views_) {} + AutoViews(rerun::datatypes::Bool auto_views_) : auto_views(auto_views_) {} - AutoSpaceViews& operator=(rerun::datatypes::Bool auto_space_views_) { - auto_space_views = auto_space_views_; + AutoViews& operator=(rerun::datatypes::Bool auto_views_) { + auto_views = auto_views_; return *this; } - AutoSpaceViews(bool value_) : auto_space_views(value_) {} + AutoViews(bool value_) : auto_views(value_) {} - AutoSpaceViews& operator=(bool value_) { - auto_space_views = value_; + AutoViews& operator=(bool value_) { + auto_views = value_; return *this; } /// Cast to the underlying Bool datatype operator rerun::datatypes::Bool() const { - return auto_space_views; + return auto_views; } }; } // namespace rerun::blueprint::components namespace rerun { - static_assert(sizeof(rerun::datatypes::Bool) == sizeof(blueprint::components::AutoSpaceViews)); + static_assert(sizeof(rerun::datatypes::Bool) == sizeof(blueprint::components::AutoViews)); /// \private template <> - struct Loggable { - static constexpr ComponentDescriptor Descriptor = - "rerun.blueprint.components.AutoSpaceViews"; + struct Loggable { + static constexpr ComponentDescriptor Descriptor = "rerun.blueprint.components.AutoViews"; /// Returns the arrow data type this type corresponds to. static const std::shared_ptr& arrow_datatype() { return Loggable::arrow_datatype(); } - /// Serializes an array of `rerun::blueprint:: components::AutoSpaceViews` into an arrow array. + /// Serializes an array of `rerun::blueprint:: components::AutoViews` into an arrow array. static Result> to_arrow( - const blueprint::components::AutoSpaceViews* instances, size_t num_instances + const blueprint::components::AutoViews* instances, size_t num_instances ) { if (num_instances == 0) { return Loggable::to_arrow(nullptr, 0); @@ -67,7 +65,7 @@ namespace rerun { ); } else { return Loggable::to_arrow( - &instances->auto_space_views, + &instances->auto_views, num_instances ); } diff --git a/rerun_cpp/src/rerun/blueprint/components/query_expression.hpp b/rerun_cpp/src/rerun/blueprint/components/query_expression.hpp index da04b43d5011..f4cf90c67023 100644 --- a/rerun_cpp/src/rerun/blueprint/components/query_expression.hpp +++ b/rerun_cpp/src/rerun/blueprint/components/query_expression.hpp @@ -18,7 +18,7 @@ namespace rerun::blueprint::components { /// Each expression is either an inclusion or an exclusion expression. /// Inclusions start with an optional `+` and exclusions must start with a `-`. /// - /// Multiple expressions are combined together as part of `SpaceViewContents`. + /// Multiple expressions are combined together as part of `archetypes::ViewContents`. /// /// The `/**` suffix matches the whole subtree, i.e. self and any child, recursively /// (`/world/**` matches both `/world` and `/world/car/driver`). diff --git a/rerun_cpp/src/rerun/blueprint/components/space_view_class.hpp b/rerun_cpp/src/rerun/blueprint/components/view_class.hpp similarity index 72% rename from rerun_cpp/src/rerun/blueprint/components/space_view_class.hpp rename to rerun_cpp/src/rerun/blueprint/components/view_class.hpp index 9961ccee293c..8230d57bf834 100644 --- a/rerun_cpp/src/rerun/blueprint/components/space_view_class.hpp +++ b/rerun_cpp/src/rerun/blueprint/components/view_class.hpp @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/space_view_class.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/view_class.fbs". #pragma once @@ -14,22 +14,22 @@ namespace rerun::blueprint::components { /// **Component**: The class identifier of view, e.g. `"2D"`, `"TextLog"`, …. - struct SpaceViewClass { + struct ViewClass { rerun::datatypes::Utf8 value; public: - SpaceViewClass() = default; + ViewClass() = default; - SpaceViewClass(rerun::datatypes::Utf8 value_) : value(std::move(value_)) {} + ViewClass(rerun::datatypes::Utf8 value_) : value(std::move(value_)) {} - SpaceViewClass& operator=(rerun::datatypes::Utf8 value_) { + ViewClass& operator=(rerun::datatypes::Utf8 value_) { value = std::move(value_); return *this; } - SpaceViewClass(std::string value_) : value(std::move(value_)) {} + ViewClass(std::string value_) : value(std::move(value_)) {} - SpaceViewClass& operator=(std::string value_) { + ViewClass& operator=(std::string value_) { value = std::move(value_); return *this; } @@ -42,22 +42,21 @@ namespace rerun::blueprint::components { } // namespace rerun::blueprint::components namespace rerun { - static_assert(sizeof(rerun::datatypes::Utf8) == sizeof(blueprint::components::SpaceViewClass)); + static_assert(sizeof(rerun::datatypes::Utf8) == sizeof(blueprint::components::ViewClass)); /// \private template <> - struct Loggable { - static constexpr ComponentDescriptor Descriptor = - "rerun.blueprint.components.SpaceViewClass"; + struct Loggable { + static constexpr ComponentDescriptor Descriptor = "rerun.blueprint.components.ViewClass"; /// Returns the arrow data type this type corresponds to. static const std::shared_ptr& arrow_datatype() { return Loggable::arrow_datatype(); } - /// Serializes an array of `rerun::blueprint:: components::SpaceViewClass` into an arrow array. + /// Serializes an array of `rerun::blueprint:: components::ViewClass` into an arrow array. static Result> to_arrow( - const blueprint::components::SpaceViewClass* instances, size_t num_instances + const blueprint::components::ViewClass* instances, size_t num_instances ) { if (num_instances == 0) { return Loggable::to_arrow(nullptr, 0); diff --git a/rerun_cpp/src/rerun/blueprint/components/space_view_maximized.hpp b/rerun_cpp/src/rerun/blueprint/components/view_maximized.hpp similarity index 60% rename from rerun_cpp/src/rerun/blueprint/components/space_view_maximized.hpp rename to rerun_cpp/src/rerun/blueprint/components/view_maximized.hpp index 9cfb642c284c..6e59871b2af9 100644 --- a/rerun_cpp/src/rerun/blueprint/components/space_view_maximized.hpp +++ b/rerun_cpp/src/rerun/blueprint/components/view_maximized.hpp @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/view_maximized.fbs". #pragma once @@ -12,53 +12,51 @@ #include namespace rerun::blueprint::components { - /// **Component**: Whether a space view is maximized. - struct SpaceViewMaximized { - rerun::datatypes::Uuid space_view_id; + /// **Component**: Whether a view is maximized. + struct ViewMaximized { + rerun::datatypes::Uuid view_id; public: - SpaceViewMaximized() = default; + ViewMaximized() = default; - SpaceViewMaximized(rerun::datatypes::Uuid space_view_id_) : space_view_id(space_view_id_) {} + ViewMaximized(rerun::datatypes::Uuid view_id_) : view_id(view_id_) {} - SpaceViewMaximized& operator=(rerun::datatypes::Uuid space_view_id_) { - space_view_id = space_view_id_; + ViewMaximized& operator=(rerun::datatypes::Uuid view_id_) { + view_id = view_id_; return *this; } - SpaceViewMaximized(std::array bytes_) : space_view_id(bytes_) {} + ViewMaximized(std::array bytes_) : view_id(bytes_) {} - SpaceViewMaximized& operator=(std::array bytes_) { - space_view_id = bytes_; + ViewMaximized& operator=(std::array bytes_) { + view_id = bytes_; return *this; } /// Cast to the underlying Uuid datatype operator rerun::datatypes::Uuid() const { - return space_view_id; + return view_id; } }; } // namespace rerun::blueprint::components namespace rerun { - static_assert( - sizeof(rerun::datatypes::Uuid) == sizeof(blueprint::components::SpaceViewMaximized) - ); + static_assert(sizeof(rerun::datatypes::Uuid) == sizeof(blueprint::components::ViewMaximized)); /// \private template <> - struct Loggable { + struct Loggable { static constexpr ComponentDescriptor Descriptor = - "rerun.blueprint.components.SpaceViewMaximized"; + "rerun.blueprint.components.ViewMaximized"; /// Returns the arrow data type this type corresponds to. static const std::shared_ptr& arrow_datatype() { return Loggable::arrow_datatype(); } - /// Serializes an array of `rerun::blueprint:: components::SpaceViewMaximized` into an arrow array. + /// Serializes an array of `rerun::blueprint:: components::ViewMaximized` into an arrow array. static Result> to_arrow( - const blueprint::components::SpaceViewMaximized* instances, size_t num_instances + const blueprint::components::ViewMaximized* instances, size_t num_instances ) { if (num_instances == 0) { return Loggable::to_arrow(nullptr, 0); @@ -69,7 +67,7 @@ namespace rerun { ); } else { return Loggable::to_arrow( - &instances->space_view_id, + &instances->view_id, num_instances ); } diff --git a/rerun_cpp/src/rerun/blueprint/components/space_view_origin.hpp b/rerun_cpp/src/rerun/blueprint/components/view_origin.hpp similarity index 71% rename from rerun_cpp/src/rerun/blueprint/components/space_view_origin.hpp rename to rerun_cpp/src/rerun/blueprint/components/view_origin.hpp index 5d75029545d9..5ed8afaf1836 100644 --- a/rerun_cpp/src/rerun/blueprint/components/space_view_origin.hpp +++ b/rerun_cpp/src/rerun/blueprint/components/view_origin.hpp @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/space_view_origin.fbs". +// Based on "crates/store/re_types/definitions/rerun/blueprint/components/view_origin.fbs". #pragma once @@ -13,23 +13,23 @@ #include namespace rerun::blueprint::components { - /// **Component**: The origin of a `SpaceView`. - struct SpaceViewOrigin { + /// **Component**: The origin of a view. + struct ViewOrigin { rerun::datatypes::EntityPath value; public: - SpaceViewOrigin() = default; + ViewOrigin() = default; - SpaceViewOrigin(rerun::datatypes::EntityPath value_) : value(std::move(value_)) {} + ViewOrigin(rerun::datatypes::EntityPath value_) : value(std::move(value_)) {} - SpaceViewOrigin& operator=(rerun::datatypes::EntityPath value_) { + ViewOrigin& operator=(rerun::datatypes::EntityPath value_) { value = std::move(value_); return *this; } - SpaceViewOrigin(std::string path_) : value(std::move(path_)) {} + ViewOrigin(std::string path_) : value(std::move(path_)) {} - SpaceViewOrigin& operator=(std::string path_) { + ViewOrigin& operator=(std::string path_) { value = std::move(path_); return *this; } @@ -43,23 +43,22 @@ namespace rerun::blueprint::components { namespace rerun { static_assert( - sizeof(rerun::datatypes::EntityPath) == sizeof(blueprint::components::SpaceViewOrigin) + sizeof(rerun::datatypes::EntityPath) == sizeof(blueprint::components::ViewOrigin) ); /// \private template <> - struct Loggable { - static constexpr ComponentDescriptor Descriptor = - "rerun.blueprint.components.SpaceViewOrigin"; + struct Loggable { + static constexpr ComponentDescriptor Descriptor = "rerun.blueprint.components.ViewOrigin"; /// Returns the arrow data type this type corresponds to. static const std::shared_ptr& arrow_datatype() { return Loggable::arrow_datatype(); } - /// Serializes an array of `rerun::blueprint:: components::SpaceViewOrigin` into an arrow array. + /// Serializes an array of `rerun::blueprint:: components::ViewOrigin` into an arrow array. static Result> to_arrow( - const blueprint::components::SpaceViewOrigin* instances, size_t num_instances + const blueprint::components::ViewOrigin* instances, size_t num_instances ) { if (num_instances == 0) { return Loggable::to_arrow(nullptr, 0); diff --git a/rerun_cpp/src/rerun/components/disconnected_space.hpp b/rerun_cpp/src/rerun/components/disconnected_space.hpp index 2f9579ee59fe..24dd0ee0d89f 100644 --- a/rerun_cpp/src/rerun/components/disconnected_space.hpp +++ b/rerun_cpp/src/rerun/components/disconnected_space.hpp @@ -15,7 +15,7 @@ namespace rerun::components { /// /// Specifies that the entity path at which this is logged is spatially disconnected from its parent, /// making it impossible to transform the entity path into its parent's space and vice versa. - /// It *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views. + /// It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. /// This is useful for specifying that a subgraph is independent of the rest of the scene. struct DisconnectedSpace { /// Whether the entity path at which this is logged is disconnected from its parent. diff --git a/rerun_py/docs/gen_common_index.py b/rerun_py/docs/gen_common_index.py index fe3d68ef05ca..da8d9dc6c073 100755 --- a/rerun_py/docs/gen_common_index.py +++ b/rerun_py/docs/gen_common_index.py @@ -290,7 +290,7 @@ class Section: "Vertical", "Grid", "Tabs", - "SpaceView", + "View", "BarChartView", "Spatial2DView", "Spatial3DView", @@ -385,7 +385,7 @@ class Section: func_list=[ "add_space_view", "new_blueprint", - "set_auto_space_views", + "set_auto_views", "set_panels", ], show_tables=False, diff --git a/rerun_py/rerun_sdk/rerun/.gitattributes b/rerun_py/rerun_sdk/rerun/.gitattributes index a3b0b15e821f..1c8b26f8ed52 100644 --- a/rerun_py/rerun_sdk/rerun/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/.gitattributes @@ -26,7 +26,7 @@ archetypes/time_series_scalar.py linguist-generated=true archetypes/transform3d.py linguist-generated=true archetypes/view_coordinates.py linguist-generated=true blueprint/__init__.py linguist-generated=true -blueprint/auto_space_views.py linguist-generated=true +blueprint/auto_views.py linguist-generated=true blueprint/panel_view.py linguist-generated=true blueprint/space_view_component.py linguist-generated=true components/__init__.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py b/rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py index f3c55e500c7c..bbac1df347ea 100644 --- a/rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py @@ -23,7 +23,7 @@ class DisconnectedSpace(DisconnectedSpaceExt, Archetype): Specifies that the entity path at which this is logged is spatially disconnected from its parent, making it impossible to transform the entity path into its parent's space and vice versa. - It *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views. + It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. This is useful for specifying that a subgraph is independent of the rest of the scene. Example diff --git a/rerun_py/rerun_sdk/rerun/blueprint/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/__init__.py index 277099a55d73..a27bf0ee97d1 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/__init__.py @@ -23,9 +23,9 @@ PanelState as PanelState, PanelStateLike as PanelStateLike, SelectionPanel as SelectionPanel, - SpaceView as SpaceView, TimePanel as TimePanel, TopPanel as TopPanel, + View as View, ) from .archetypes import ( Background as Background, diff --git a/rerun_py/rerun_sdk/rerun/blueprint/api.py b/rerun_py/rerun_sdk/rerun/blueprint/api.py index aa2dc076b14c..9727a50b19df 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/api.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/api.py @@ -10,16 +10,16 @@ from ..datatypes import BoolLike, EntityPathLike, Float32ArrayLike, Utf8ArrayLike, Utf8Like from ..memory import MemoryRecording from ..recording_stream import RecordingStream -from .archetypes import ContainerBlueprint, PanelBlueprint, SpaceViewBlueprint, SpaceViewContents, ViewportBlueprint +from .archetypes import ContainerBlueprint, PanelBlueprint, ViewBlueprint, ViewContents, ViewportBlueprint from .components import PanelState, PanelStateLike from .components.container_kind import ContainerKindLike -SpaceViewContentsLike = Union[Utf8ArrayLike, SpaceViewContents] +ViewContentsLike = Union[Utf8ArrayLike, ViewContents] -class SpaceView: +class View: """ - Base class for all space view types. + Base class for all view types. Consider using one of the subclasses instead of this class directly: @@ -31,7 +31,7 @@ class SpaceView: - [rerun.blueprint.TextLogView][] - [rerun.blueprint.TimeSeriesView][] - These are ergonomic helpers on top of [rerun.blueprint.archetypes.SpaceViewBlueprint][]. + These are ergonomic helpers on top of [rerun.blueprint.archetypes.ViewBlueprint][]. """ def __init__( @@ -39,7 +39,7 @@ def __init__( *, class_identifier: Utf8Like, origin: EntityPathLike, - contents: SpaceViewContentsLike, + contents: ViewContentsLike, name: Utf8Like | None, visible: BoolLike | None = None, properties: dict[str, AsComponents] = {}, @@ -47,33 +47,33 @@ def __init__( overrides: dict[EntityPathLike, list[ComponentBatchLike]] = {}, ): """ - Construct a blueprint for a new space view. + Construct a blueprint for a new view. Parameters ---------- name - The name of the space view. + The name of the view. class_identifier - The class of the space view to add. This must correspond to a known space view class. - Prefer to use one of the subclasses of `SpaceView` which will populate this for you. + The class of the view to add. This must correspond to a known view class. + Prefer to use one of the subclasses of `View` which will populate this for you. origin - The `EntityPath` to use as the origin of this space view. All other entities will be transformed + The `EntityPath` to use as the origin of this view. All other entities will be transformed to be displayed relative to this origin. contents - The contents of the space view specified as a query expression. This is either a single expression, - or a list of multiple expressions. See [rerun.blueprint.archetypes.SpaceViewContents][]. + The contents of the view specified as a query expression. This is either a single expression, + or a list of multiple expressions. See [rerun.blueprint.archetypes.ViewContents][]. visible: - Whether this space view is visible. + Whether this view is visible. Defaults to true if not specified. properties - Dictionary of property archetypes to add to space view's internal hierarchy. + Dictionary of property archetypes to add to view's internal hierarchy. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths @@ -93,7 +93,7 @@ def __init__( def blueprint_path(self) -> str: """ - The blueprint path where this space view will be logged. + The blueprint path where this view will be logged. Note that although this is an `EntityPath`, is scoped to the blueprint tree and not a part of the regular data hierarchy. @@ -101,27 +101,27 @@ def blueprint_path(self) -> str: return f"space_view/{self.id}" def to_container(self) -> Container: - """Convert this space view to a container.""" + """Convert this view to a container.""" from .containers import Tabs return Tabs(self) def to_blueprint(self) -> Blueprint: - """Convert this space view to a full blueprint.""" + """Convert this view to a full blueprint.""" return Blueprint(self) def _log_to_stream(self, stream: RecordingStream) -> None: """Internal method to convert to an archetype and log to the stream.""" - if isinstance(self.contents, SpaceViewContents): - # If contents is already a SpaceViewContents, we can just use it directly + if isinstance(self.contents, ViewContents): + # If contents is already a ViewContents, we can just use it directly contents = self.contents else: - # Otherwise we delegate to the SpaceViewContents constructor - contents = SpaceViewContents(query=self.contents) # type: ignore[arg-type] + # Otherwise we delegate to the ViewContents constructor + contents = ViewContents(query=self.contents) # type: ignore[arg-type] - stream.log(self.blueprint_path() + "/SpaceViewContents", contents) # type: ignore[attr-defined] + stream.log(self.blueprint_path() + "/ViewContents", contents) # type: ignore[attr-defined] - arch = SpaceViewBlueprint( + arch = ViewBlueprint( class_identifier=self.class_identifier, display_name=self.name, space_origin=self.origin, @@ -143,7 +143,7 @@ def _log_to_stream(self, stream: RecordingStream) -> None: for path, components in self.overrides.items(): stream.log( # type: ignore[attr-defined] - f"{self.blueprint_path()}/SpaceViewContents/individual_overrides/{path}", components, recording=stream + f"{self.blueprint_path()}/ViewContents/individual_overrides/{path}", components, recording=stream ) def _ipython_display_(self) -> None: @@ -168,8 +168,8 @@ class Container: def __init__( self, - *args: Container | SpaceView, - contents: Optional[Iterable[Container | SpaceView]] = None, + *args: Container | View, + contents: Optional[Iterable[Container | View]] = None, kind: ContainerKindLike, column_shares: Optional[Float32ArrayLike] = None, row_shares: Optional[Float32ArrayLike] = None, @@ -185,7 +185,7 @@ def __init__( *args: All positional arguments are forwarded to the `contents` parameter for convenience. contents: - The contents of the container. Each item in the iterable must be a `SpaceView` or a `Container`. + The contents of the container. Each item in the iterable must be a `View` or a `Container`. This can only be used if no positional arguments are provided. kind The kind of the container. This must correspond to a known container kind. @@ -225,7 +225,7 @@ def __init__( def blueprint_path(self) -> str: """ - The blueprint path where this space view will be logged. + The blueprint path where this view will be logged. Note that although this is an `EntityPath`, is scoped to the blueprint tree and not a part of the regular data hierarchy. @@ -233,7 +233,7 @@ def blueprint_path(self) -> str: return f"container/{self.id}" def to_container(self) -> Container: - """Convert this space view to a container.""" + """Convert this view to a container.""" return self def to_blueprint(self) -> Blueprint: @@ -246,7 +246,7 @@ def _log_to_stream(self, stream: RecordingStream) -> None: for i, sub in enumerate(self.contents): sub._log_to_stream(stream) - if i == self.active_tab or (isinstance(sub, SpaceView) and sub.name == self.active_tab): + if i == self.active_tab or (isinstance(sub, View) and sub.name == self.active_tab): active_tab_path = sub.blueprint_path() if self.active_tab is not None and active_tab_path is None: @@ -316,7 +316,7 @@ def __init__(self, *, blueprint_path: str, expanded: bool | None = None, state: def blueprint_path(self) -> str: """ - The blueprint path where this space view will be logged. + The blueprint path where this view will be logged. Note that although this is an `EntityPath`, is scoped to the blueprint tree and not a part of the regular data hierarchy. @@ -413,7 +413,7 @@ def __init__(self, *, expanded: bool | None = None, state: PanelStateLike | None super().__init__(blueprint_path="time_panel", expanded=expanded, state=state) -ContainerLike = Union[Container, SpaceView] +ContainerLike = Union[Container, View] """ A type that can be converted to a container. @@ -434,7 +434,7 @@ def __init__( self, *parts: BlueprintPart, auto_layout: bool | None = None, - auto_space_views: bool | None = None, + auto_views: bool | None = None, collapse_panels: bool = False, ): """ @@ -459,13 +459,13 @@ def __init__( The parts of the blueprint. auto_layout: Whether to automatically layout the viewport. If `True`, the container layout will be - reset whenever a new space view is added to the viewport. Defaults to `False`. - Defaults to `False` unless no Containers or SpaceViews are provided, in which case it defaults to `True`. + reset whenever a new view is added to the viewport. Defaults to `False`. + Defaults to `False` unless no Containers or Views are provided, in which case it defaults to `True`. If you want to create a completely empty Blueprint, you must explicitly set this to `False`. - auto_space_views: - Whether to automatically add space views to the viewport. If `True`, the viewport will - automatically add space views based on content in the data store. - Defaults to `False` unless no Containers or SpaceViews are provided, in which case it defaults to `True`. + auto_views: + Whether to automatically add views to the viewport. If `True`, the viewport will + automatically add views based on content in the data store. + Defaults to `False` unless no Containers or Views are provided, in which case it defaults to `True`. If you want to create a completely empty Blueprint, you must explicitly set this to `False`. collapse_panels: Whether to collapse panels in the viewer. Defaults to `False`. @@ -480,7 +480,7 @@ def __init__( contents: list[ContainerLike] = [] for part in parts: - if isinstance(part, (Container, SpaceView)): + if isinstance(part, (Container, View)): contents.append(part) elif isinstance(part, TopPanel): if hasattr(self, "top_panel"): @@ -501,13 +501,13 @@ def __init__( else: raise ValueError(f"Unknown part type: {part}") - self.auto_space_views = auto_space_views + self.auto_views = auto_views self.auto_layout = auto_layout if len(contents) == 0: - # If there's no content, switch `auto_layout` and `auto_space_views` defaults to `True`. - if self.auto_space_views is None: - self.auto_space_views = True + # If there's no content, switch `auto_layout` and `auto_views` defaults to `True`. + if self.auto_views is None: + self.auto_views = True if self.auto_layout is None: self.auto_layout = True elif len(contents) == 1: @@ -531,7 +531,7 @@ def _log_to_stream(self, stream: RecordingStream) -> None: viewport_arch = ViewportBlueprint( root_container=root_container_id, auto_layout=self.auto_layout, - auto_space_views=self.auto_space_views, + auto_views=self.auto_views, ) stream.log("viewport", viewport_arch) # type: ignore[attr-defined] @@ -657,7 +657,7 @@ def spawn( self.connect(application_id=application_id, addr=f"127.0.0.1:{port}") -BlueprintLike = Union[Blueprint, SpaceView, Container] +BlueprintLike = Union[Blueprint, View, Container] """ A type that can be converted to a blueprint. diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes index 03a4f9d20824..7c61132e3f62 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes @@ -16,11 +16,11 @@ map_zoom.py linguist-generated=true panel_blueprint.py linguist-generated=true plot_legend.py linguist-generated=true scalar_axis.py linguist-generated=true -space_view_blueprint.py linguist-generated=true -space_view_contents.py linguist-generated=true tensor_scalar_mapping.py linguist-generated=true tensor_slice_selection.py linguist-generated=true tensor_view_fit.py linguist-generated=true +view_blueprint.py linguist-generated=true +view_contents.py linguist-generated=true viewport_blueprint.py linguist-generated=true visible_time_ranges.py linguist-generated=true visual_bounds2d.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py index 58d545a3f97a..897b98f6da68 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py @@ -16,11 +16,11 @@ from .panel_blueprint import PanelBlueprint from .plot_legend import PlotLegend from .scalar_axis import ScalarAxis -from .space_view_blueprint import SpaceViewBlueprint -from .space_view_contents import SpaceViewContents from .tensor_scalar_mapping import TensorScalarMapping from .tensor_slice_selection import TensorSliceSelection from .tensor_view_fit import TensorViewFit +from .view_blueprint import ViewBlueprint +from .view_contents import ViewContents from .viewport_blueprint import ViewportBlueprint from .visible_time_ranges import VisibleTimeRanges from .visual_bounds2d import VisualBounds2D @@ -40,11 +40,11 @@ "PanelBlueprint", "PlotLegend", "ScalarAxis", - "SpaceViewBlueprint", - "SpaceViewContents", "TensorScalarMapping", "TensorSliceSelection", "TensorViewFit", + "ViewBlueprint", + "ViewContents", "ViewportBlueprint", "VisibleTimeRanges", "VisualBounds2D", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/container_blueprint.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/container_blueprint.py index 967fab8cb43c..9f225bd61254 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/container_blueprint.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/container_blueprint.py @@ -45,7 +45,7 @@ def __init__( display_name: The name of the container. contents: - `ContainerId`s or `SpaceViewId`s that are children of this container. + `ContainerId`s or `ViewId`s that are children of this container. col_shares: The layout shares of each column in the container. @@ -132,7 +132,7 @@ def _clear(cls) -> ContainerBlueprint: default=None, converter=blueprint_components.IncludedContentBatch._optional, # type: ignore[misc] ) - # `ContainerId`s or `SpaceViewId`s that are children of this container. + # `ContainerId`s or `ViewId`s that are children of this container. # # (Docstring intentionally commented out to hide this field from the docs) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/space_view_blueprint.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/view_blueprint.py similarity index 73% rename from rerun_py/rerun_sdk/rerun/blueprint/archetypes/space_view_blueprint.py rename to rerun_py/rerun_sdk/rerun/blueprint/archetypes/view_blueprint.py index 202092a5d0a5..70ef957a1617 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/space_view_blueprint.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/view_blueprint.py @@ -1,7 +1,7 @@ # DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs -# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_blueprint.fbs". +# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/view_blueprint.fbs". -# You can extend this class by creating a "SpaceViewBlueprintExt" class in "space_view_blueprint_ext.py". +# You can extend this class by creating a "ViewBlueprintExt" class in "view_blueprint_ext.py". from __future__ import annotations @@ -16,11 +16,11 @@ from ...blueprint import components as blueprint_components from ...error_utils import catch_and_log_exceptions -__all__ = ["SpaceViewBlueprint"] +__all__ = ["ViewBlueprint"] @define(str=False, repr=False, init=False) -class SpaceViewBlueprint(Archetype): +class ViewBlueprint(Archetype): """**Archetype**: The description of a single view.""" def __init__( @@ -32,7 +32,7 @@ def __init__( visible: datatypes.BoolLike | None = None, ): """ - Create a new instance of the SpaceViewBlueprint archetype. + Create a new instance of the ViewBlueprint archetype. Parameters ---------- @@ -41,21 +41,21 @@ def __init__( display_name: The name of the view. space_origin: - The "anchor point" of this space view. + The "anchor point" of this view. Defaults to the root path '/' if not specified. - The transform at this path forms the reference point for all scene->world transforms in this space view. - I.e. the position of this entity path in space forms the origin of the coordinate system in this space view. - Furthermore, this is the primary indicator for heuristics on what entities we show in this space view. + The transform at this path forms the reference point for all scene->world transforms in this view. + I.e. the position of this entity path in space forms the origin of the coordinate system in this view. + Furthermore, this is the primary indicator for heuristics on what entities we show in this view. visible: - Whether this space view is visible. + Whether this view is visible. Defaults to true if not specified. """ - # You can define your own __init__ function as a member of SpaceViewBlueprintExt in space_view_blueprint_ext.py + # You can define your own __init__ function as a member of ViewBlueprintExt in view_blueprint_ext.py with catch_and_log_exceptions(context=self.__class__.__name__): self.__attrs_init__( class_identifier=class_identifier, display_name=display_name, space_origin=space_origin, visible=visible @@ -73,15 +73,15 @@ def __attrs_clear__(self) -> None: ) @classmethod - def _clear(cls) -> SpaceViewBlueprint: - """Produce an empty SpaceViewBlueprint, bypassing `__init__`.""" + def _clear(cls) -> ViewBlueprint: + """Produce an empty ViewBlueprint, bypassing `__init__`.""" inst = cls.__new__(cls) inst.__attrs_clear__() return inst - class_identifier: blueprint_components.SpaceViewClassBatch = field( + class_identifier: blueprint_components.ViewClassBatch = field( metadata={"component": "required"}, - converter=blueprint_components.SpaceViewClassBatch._required, # type: ignore[misc] + converter=blueprint_components.ViewClassBatch._required, # type: ignore[misc] ) # The class of the view. # @@ -96,18 +96,18 @@ def _clear(cls) -> SpaceViewBlueprint: # # (Docstring intentionally commented out to hide this field from the docs) - space_origin: blueprint_components.SpaceViewOriginBatch | None = field( + space_origin: blueprint_components.ViewOriginBatch | None = field( metadata={"component": "optional"}, default=None, - converter=blueprint_components.SpaceViewOriginBatch._optional, # type: ignore[misc] + converter=blueprint_components.ViewOriginBatch._optional, # type: ignore[misc] ) - # The "anchor point" of this space view. + # The "anchor point" of this view. # # Defaults to the root path '/' if not specified. # - # The transform at this path forms the reference point for all scene->world transforms in this space view. - # I.e. the position of this entity path in space forms the origin of the coordinate system in this space view. - # Furthermore, this is the primary indicator for heuristics on what entities we show in this space view. + # The transform at this path forms the reference point for all scene->world transforms in this view. + # I.e. the position of this entity path in space forms the origin of the coordinate system in this view. + # Furthermore, this is the primary indicator for heuristics on what entities we show in this view. # # (Docstring intentionally commented out to hide this field from the docs) @@ -116,7 +116,7 @@ def _clear(cls) -> SpaceViewBlueprint: default=None, converter=blueprint_components.VisibleBatch._optional, # type: ignore[misc] ) - # Whether this space view is visible. + # Whether this view is visible. # # Defaults to true if not specified. # diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/space_view_contents.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/view_contents.py similarity index 83% rename from rerun_py/rerun_sdk/rerun/blueprint/archetypes/space_view_contents.py rename to rerun_py/rerun_sdk/rerun/blueprint/archetypes/view_contents.py index aedf92f92799..8708444a715a 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/space_view_contents.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/view_contents.py @@ -1,7 +1,7 @@ # DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs -# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/space_view_contents.fbs". +# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/view_contents.fbs". -# You can extend this class by creating a "SpaceViewContentsExt" class in "space_view_contents_ext.py". +# You can extend this class by creating a "ViewContentsExt" class in "view_contents_ext.py". from __future__ import annotations @@ -16,13 +16,13 @@ from ...blueprint import components as blueprint_components from ...error_utils import catch_and_log_exceptions -__all__ = ["SpaceViewContents"] +__all__ = ["ViewContents"] @define(str=False, repr=False, init=False) -class SpaceViewContents(Archetype): +class ViewContents(Archetype): """ - **Archetype**: The contents of a `SpaceView`. + **Archetype**: The contents of a `View`. The contents are found by combining a collection of `QueryExpression`s. @@ -64,18 +64,18 @@ class SpaceViewContents(Archetype): def __init__(self: Any, query: datatypes.Utf8ArrayLike): """ - Create a new instance of the SpaceViewContents archetype. + Create a new instance of the ViewContents archetype. Parameters ---------- query: - The `QueryExpression` that populates the contents for the `SpaceView`. + The `QueryExpression` that populates the contents for the view. - They determine which entities are part of the spaceview. + They determine which entities are part of the view. """ - # You can define your own __init__ function as a member of SpaceViewContentsExt in space_view_contents_ext.py + # You can define your own __init__ function as a member of ViewContentsExt in view_contents_ext.py with catch_and_log_exceptions(context=self.__class__.__name__): self.__attrs_init__(query=query) return @@ -88,8 +88,8 @@ def __attrs_clear__(self) -> None: ) @classmethod - def _clear(cls) -> SpaceViewContents: - """Produce an empty SpaceViewContents, bypassing `__init__`.""" + def _clear(cls) -> ViewContents: + """Produce an empty ViewContents, bypassing `__init__`.""" inst = cls.__new__(cls) inst.__attrs_clear__() return inst @@ -98,9 +98,9 @@ def _clear(cls) -> SpaceViewContents: metadata={"component": "required"}, converter=blueprint_components.QueryExpressionBatch._required, # type: ignore[misc] ) - # The `QueryExpression` that populates the contents for the `SpaceView`. + # The `QueryExpression` that populates the contents for the view. # - # They determine which entities are part of the spaceview. + # They determine which entities are part of the view. # # (Docstring intentionally commented out to hide this field from the docs) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/viewport_blueprint.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/viewport_blueprint.py index 632731f1e66a..3c8e85ce7139 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/viewport_blueprint.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/viewport_blueprint.py @@ -29,7 +29,7 @@ def __init__( root_container: datatypes.UuidLike | None = None, maximized: datatypes.UuidLike | None = None, auto_layout: datatypes.BoolLike | None = None, - auto_space_views: datatypes.BoolLike | None = None, + auto_views: datatypes.BoolLike | None = None, past_viewer_recommendations: datatypes.UInt64ArrayLike | None = None, ): """ @@ -38,27 +38,27 @@ def __init__( Parameters ---------- root_container: - The layout of the space-views + The layout of the views maximized: Show one tab as maximized? auto_layout: Whether the viewport layout is determined automatically. - If `true`, the container layout will be reset whenever a new space view is added or removed. + If `true`, the container layout will be reset whenever a new view is added or removed. This defaults to `false` and is automatically set to `false` when there is user determined layout. - auto_space_views: - Whether or not space views should be created automatically. + auto_views: + Whether or not views should be created automatically. - If `true`, the viewer will only add space views that it hasn't considered previously (as identified by `past_viewer_recommendations`) - and which aren't deemed redundant to existing space views. - This defaults to `false` and is automatically set to `false` when the user adds space views manually in the viewer. + If `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`) + and which aren't deemed redundant to existing views. + This defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer. past_viewer_recommendations: - Hashes of all recommended space views the viewer has already added and that should not be added again. + Hashes of all recommended views the viewer has already added and that should not be added again. This is an internal field and should not be set usually. - If you want the viewer from stopping to add space views, you should set `auto_space_views` to `false`. + If you want the viewer from stopping to add views, you should set `auto_views` to `false`. - The viewer uses this to determine whether it should keep adding space views. + The viewer uses this to determine whether it should keep adding views. """ @@ -68,7 +68,7 @@ def __init__( root_container=root_container, maximized=maximized, auto_layout=auto_layout, - auto_space_views=auto_space_views, + auto_views=auto_views, past_viewer_recommendations=past_viewer_recommendations, ) return @@ -80,7 +80,7 @@ def __attrs_clear__(self) -> None: root_container=None, # type: ignore[arg-type] maximized=None, # type: ignore[arg-type] auto_layout=None, # type: ignore[arg-type] - auto_space_views=None, # type: ignore[arg-type] + auto_views=None, # type: ignore[arg-type] past_viewer_recommendations=None, # type: ignore[arg-type] ) @@ -96,14 +96,14 @@ def _clear(cls) -> ViewportBlueprint: default=None, converter=blueprint_components.RootContainerBatch._optional, # type: ignore[misc] ) - # The layout of the space-views + # The layout of the views # # (Docstring intentionally commented out to hide this field from the docs) - maximized: blueprint_components.SpaceViewMaximizedBatch | None = field( + maximized: blueprint_components.ViewMaximizedBatch | None = field( metadata={"component": "optional"}, default=None, - converter=blueprint_components.SpaceViewMaximizedBatch._optional, # type: ignore[misc] + converter=blueprint_components.ViewMaximizedBatch._optional, # type: ignore[misc] ) # Show one tab as maximized? # @@ -116,21 +116,21 @@ def _clear(cls) -> ViewportBlueprint: ) # Whether the viewport layout is determined automatically. # - # If `true`, the container layout will be reset whenever a new space view is added or removed. + # If `true`, the container layout will be reset whenever a new view is added or removed. # This defaults to `false` and is automatically set to `false` when there is user determined layout. # # (Docstring intentionally commented out to hide this field from the docs) - auto_space_views: blueprint_components.AutoSpaceViewsBatch | None = field( + auto_views: blueprint_components.AutoViewsBatch | None = field( metadata={"component": "optional"}, default=None, - converter=blueprint_components.AutoSpaceViewsBatch._optional, # type: ignore[misc] + converter=blueprint_components.AutoViewsBatch._optional, # type: ignore[misc] ) - # Whether or not space views should be created automatically. + # Whether or not views should be created automatically. # - # If `true`, the viewer will only add space views that it hasn't considered previously (as identified by `past_viewer_recommendations`) - # and which aren't deemed redundant to existing space views. - # This defaults to `false` and is automatically set to `false` when the user adds space views manually in the viewer. + # If `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`) + # and which aren't deemed redundant to existing views. + # This defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer. # # (Docstring intentionally commented out to hide this field from the docs) @@ -139,12 +139,12 @@ def _clear(cls) -> ViewportBlueprint: default=None, converter=blueprint_components.ViewerRecommendationHashBatch._optional, # type: ignore[misc] ) - # Hashes of all recommended space views the viewer has already added and that should not be added again. + # Hashes of all recommended views the viewer has already added and that should not be added again. # # This is an internal field and should not be set usually. - # If you want the viewer from stopping to add space views, you should set `auto_space_views` to `false`. + # If you want the viewer from stopping to add views, you should set `auto_views` to `false`. # - # The viewer uses this to determine whether it should keep adding space views. + # The viewer uses this to determine whether it should keep adding views. # # (Docstring intentionally commented out to hide this field from the docs) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes index 6c5eeaa92aa6..ec961c457f89 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes @@ -5,7 +5,7 @@ __init__.py linguist-generated=true active_tab.py linguist-generated=true apply_latest_at.py linguist-generated=true auto_layout.py linguist-generated=true -auto_space_views.py linguist-generated=true +auto_views.py linguist-generated=true background_kind.py linguist-generated=true column_share.py linguist-generated=true component_column_selector.py linguist-generated=true @@ -29,12 +29,12 @@ query_expression.py linguist-generated=true root_container.py linguist-generated=true row_share.py linguist-generated=true selected_columns.py linguist-generated=true -space_view_class.py linguist-generated=true -space_view_maximized.py linguist-generated=true -space_view_origin.py linguist-generated=true tensor_dimension_index_slider.py linguist-generated=true timeline_name.py linguist-generated=true +view_class.py linguist-generated=true view_fit.py linguist-generated=true +view_maximized.py linguist-generated=true +view_origin.py linguist-generated=true viewer_recommendation_hash.py linguist-generated=true visible.py linguist-generated=true visible_time_range.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py index d09f761a625d..14bab8768323 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py @@ -5,7 +5,7 @@ from .active_tab import ActiveTab, ActiveTabBatch from .apply_latest_at import ApplyLatestAt, ApplyLatestAtBatch from .auto_layout import AutoLayout, AutoLayoutBatch -from .auto_space_views import AutoSpaceViews, AutoSpaceViewsBatch +from .auto_views import AutoViews, AutoViewsBatch from .background_kind import BackgroundKind, BackgroundKindArrayLike, BackgroundKindBatch, BackgroundKindLike from .column_share import ColumnShare, ColumnShareBatch from .component_column_selector import ComponentColumnSelector, ComponentColumnSelectorBatch @@ -29,12 +29,12 @@ from .root_container import RootContainer, RootContainerBatch from .row_share import RowShare, RowShareBatch from .selected_columns import SelectedColumns, SelectedColumnsBatch -from .space_view_class import SpaceViewClass, SpaceViewClassBatch -from .space_view_maximized import SpaceViewMaximized, SpaceViewMaximizedBatch -from .space_view_origin import SpaceViewOrigin, SpaceViewOriginBatch from .tensor_dimension_index_slider import TensorDimensionIndexSlider, TensorDimensionIndexSliderBatch from .timeline_name import TimelineName, TimelineNameBatch +from .view_class import ViewClass, ViewClassBatch from .view_fit import ViewFit, ViewFitArrayLike, ViewFitBatch, ViewFitLike +from .view_maximized import ViewMaximized, ViewMaximizedBatch +from .view_origin import ViewOrigin, ViewOriginBatch from .viewer_recommendation_hash import ViewerRecommendationHash, ViewerRecommendationHashBatch from .visible import Visible, VisibleBatch from .visible_time_range import VisibleTimeRange, VisibleTimeRangeBatch @@ -49,8 +49,8 @@ "ApplyLatestAtBatch", "AutoLayout", "AutoLayoutBatch", - "AutoSpaceViews", - "AutoSpaceViewsBatch", + "AutoViews", + "AutoViewsBatch", "BackgroundKind", "BackgroundKindArrayLike", "BackgroundKindBatch", @@ -107,20 +107,20 @@ "RowShareBatch", "SelectedColumns", "SelectedColumnsBatch", - "SpaceViewClass", - "SpaceViewClassBatch", - "SpaceViewMaximized", - "SpaceViewMaximizedBatch", - "SpaceViewOrigin", - "SpaceViewOriginBatch", "TensorDimensionIndexSlider", "TensorDimensionIndexSliderBatch", "TimelineName", "TimelineNameBatch", + "ViewClass", + "ViewClassBatch", "ViewFit", "ViewFitArrayLike", "ViewFitBatch", "ViewFitLike", + "ViewMaximized", + "ViewMaximizedBatch", + "ViewOrigin", + "ViewOriginBatch", "ViewerRecommendationHash", "ViewerRecommendationHashBatch", "Visible", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/auto_space_views.py b/rerun_py/rerun_sdk/rerun/blueprint/components/auto_space_views.py deleted file mode 100644 index fde719150915..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/auto_space_views.py +++ /dev/null @@ -1,33 +0,0 @@ -# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs -# Based on "crates/store/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs". - -# You can extend this class by creating a "AutoSpaceViewsExt" class in "auto_space_views_ext.py". - -from __future__ import annotations - -from ... import datatypes -from ..._baseclasses import ( - ComponentBatchMixin, - ComponentDescriptor, - ComponentMixin, -) - -__all__ = ["AutoSpaceViews", "AutoSpaceViewsBatch"] - - -class AutoSpaceViews(datatypes.Bool, ComponentMixin): - """**Component**: Whether or not space views should be created automatically.""" - - _BATCH_TYPE = None - # You can define your own __init__ function as a member of AutoSpaceViewsExt in auto_space_views_ext.py - - # Note: there are no fields here because AutoSpaceViews delegates to datatypes.Bool - pass - - -class AutoSpaceViewsBatch(datatypes.BoolBatch, ComponentBatchMixin): - _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.AutoSpaceViews") - - -# This is patched in late to avoid circular dependencies. -AutoSpaceViews._BATCH_TYPE = AutoSpaceViewsBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/auto_views.py b/rerun_py/rerun_sdk/rerun/blueprint/components/auto_views.py new file mode 100644 index 000000000000..f93830b8eee4 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/auto_views.py @@ -0,0 +1,33 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/components/auto_views.fbs". + +# You can extend this class by creating a "AutoViewsExt" class in "auto_views_ext.py". + +from __future__ import annotations + +from ... import datatypes +from ..._baseclasses import ( + ComponentBatchMixin, + ComponentDescriptor, + ComponentMixin, +) + +__all__ = ["AutoViews", "AutoViewsBatch"] + + +class AutoViews(datatypes.Bool, ComponentMixin): + """**Component**: Whether or not views should be created automatically.""" + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of AutoViewsExt in auto_views_ext.py + + # Note: there are no fields here because AutoViews delegates to datatypes.Bool + pass + + +class AutoViewsBatch(datatypes.BoolBatch, ComponentBatchMixin): + _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.AutoViews") + + +# This is patched in late to avoid circular dependencies. +AutoViews._BATCH_TYPE = AutoViewsBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/query_expression.py b/rerun_py/rerun_sdk/rerun/blueprint/components/query_expression.py index 560225d06901..5df431851147 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/query_expression.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/query_expression.py @@ -22,7 +22,7 @@ class QueryExpression(datatypes.Utf8, ComponentMixin): Each expression is either an inclusion or an exclusion expression. Inclusions start with an optional `+` and exclusions must start with a `-`. - Multiple expressions are combined together as part of `SpaceViewContents`. + Multiple expressions are combined together as part of [`archetypes.ViewContents`][rerun.blueprint.archetypes.ViewContents]. The `/**` suffix matches the whole subtree, i.e. self and any child, recursively (`/world/**` matches both `/world` and `/world/car/driver`). diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_class.py b/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_class.py deleted file mode 100644 index af87eff847a6..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_class.py +++ /dev/null @@ -1,33 +0,0 @@ -# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs -# Based on "crates/store/re_types/definitions/rerun/blueprint/components/space_view_class.fbs". - -# You can extend this class by creating a "SpaceViewClassExt" class in "space_view_class_ext.py". - -from __future__ import annotations - -from ... import datatypes -from ..._baseclasses import ( - ComponentBatchMixin, - ComponentDescriptor, - ComponentMixin, -) - -__all__ = ["SpaceViewClass", "SpaceViewClassBatch"] - - -class SpaceViewClass(datatypes.Utf8, ComponentMixin): - """**Component**: The class identifier of view, e.g. `"2D"`, `"TextLog"`, ….""" - - _BATCH_TYPE = None - # You can define your own __init__ function as a member of SpaceViewClassExt in space_view_class_ext.py - - # Note: there are no fields here because SpaceViewClass delegates to datatypes.Utf8 - pass - - -class SpaceViewClassBatch(datatypes.Utf8Batch, ComponentBatchMixin): - _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.SpaceViewClass") - - -# This is patched in late to avoid circular dependencies. -SpaceViewClass._BATCH_TYPE = SpaceViewClassBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_maximized.py b/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_maximized.py deleted file mode 100644 index 9a89157122a3..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_maximized.py +++ /dev/null @@ -1,33 +0,0 @@ -# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs -# Based on "crates/store/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs". - -# You can extend this class by creating a "SpaceViewMaximizedExt" class in "space_view_maximized_ext.py". - -from __future__ import annotations - -from ... import datatypes -from ..._baseclasses import ( - ComponentBatchMixin, - ComponentDescriptor, - ComponentMixin, -) - -__all__ = ["SpaceViewMaximized", "SpaceViewMaximizedBatch"] - - -class SpaceViewMaximized(datatypes.Uuid, ComponentMixin): - """**Component**: Whether a space view is maximized.""" - - _BATCH_TYPE = None - # You can define your own __init__ function as a member of SpaceViewMaximizedExt in space_view_maximized_ext.py - - # Note: there are no fields here because SpaceViewMaximized delegates to datatypes.Uuid - pass - - -class SpaceViewMaximizedBatch(datatypes.UuidBatch, ComponentBatchMixin): - _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.SpaceViewMaximized") - - -# This is patched in late to avoid circular dependencies. -SpaceViewMaximized._BATCH_TYPE = SpaceViewMaximizedBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_origin.py b/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_origin.py deleted file mode 100644 index 3ae499d8c4d6..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_origin.py +++ /dev/null @@ -1,33 +0,0 @@ -# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs -# Based on "crates/store/re_types/definitions/rerun/blueprint/components/space_view_origin.fbs". - -# You can extend this class by creating a "SpaceViewOriginExt" class in "space_view_origin_ext.py". - -from __future__ import annotations - -from ... import datatypes -from ..._baseclasses import ( - ComponentBatchMixin, - ComponentDescriptor, - ComponentMixin, -) - -__all__ = ["SpaceViewOrigin", "SpaceViewOriginBatch"] - - -class SpaceViewOrigin(datatypes.EntityPath, ComponentMixin): - """**Component**: The origin of a `SpaceView`.""" - - _BATCH_TYPE = None - # You can define your own __init__ function as a member of SpaceViewOriginExt in space_view_origin_ext.py - - # Note: there are no fields here because SpaceViewOrigin delegates to datatypes.EntityPath - pass - - -class SpaceViewOriginBatch(datatypes.EntityPathBatch, ComponentBatchMixin): - _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.SpaceViewOrigin") - - -# This is patched in late to avoid circular dependencies. -SpaceViewOrigin._BATCH_TYPE = SpaceViewOriginBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/view_class.py b/rerun_py/rerun_sdk/rerun/blueprint/components/view_class.py new file mode 100644 index 000000000000..6c060d24224f --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/view_class.py @@ -0,0 +1,33 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/components/view_class.fbs". + +# You can extend this class by creating a "ViewClassExt" class in "view_class_ext.py". + +from __future__ import annotations + +from ... import datatypes +from ..._baseclasses import ( + ComponentBatchMixin, + ComponentDescriptor, + ComponentMixin, +) + +__all__ = ["ViewClass", "ViewClassBatch"] + + +class ViewClass(datatypes.Utf8, ComponentMixin): + """**Component**: The class identifier of view, e.g. `"2D"`, `"TextLog"`, ….""" + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of ViewClassExt in view_class_ext.py + + # Note: there are no fields here because ViewClass delegates to datatypes.Utf8 + pass + + +class ViewClassBatch(datatypes.Utf8Batch, ComponentBatchMixin): + _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.ViewClass") + + +# This is patched in late to avoid circular dependencies. +ViewClass._BATCH_TYPE = ViewClassBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/view_maximized.py b/rerun_py/rerun_sdk/rerun/blueprint/components/view_maximized.py new file mode 100644 index 000000000000..aa1db353f0c2 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/view_maximized.py @@ -0,0 +1,33 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/components/view_maximized.fbs". + +# You can extend this class by creating a "ViewMaximizedExt" class in "view_maximized_ext.py". + +from __future__ import annotations + +from ... import datatypes +from ..._baseclasses import ( + ComponentBatchMixin, + ComponentDescriptor, + ComponentMixin, +) + +__all__ = ["ViewMaximized", "ViewMaximizedBatch"] + + +class ViewMaximized(datatypes.Uuid, ComponentMixin): + """**Component**: Whether a view is maximized.""" + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of ViewMaximizedExt in view_maximized_ext.py + + # Note: there are no fields here because ViewMaximized delegates to datatypes.Uuid + pass + + +class ViewMaximizedBatch(datatypes.UuidBatch, ComponentBatchMixin): + _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.ViewMaximized") + + +# This is patched in late to avoid circular dependencies. +ViewMaximized._BATCH_TYPE = ViewMaximizedBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/view_origin.py b/rerun_py/rerun_sdk/rerun/blueprint/components/view_origin.py new file mode 100644 index 000000000000..732a5a299734 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/view_origin.py @@ -0,0 +1,33 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/components/view_origin.fbs". + +# You can extend this class by creating a "ViewOriginExt" class in "view_origin_ext.py". + +from __future__ import annotations + +from ... import datatypes +from ..._baseclasses import ( + ComponentBatchMixin, + ComponentDescriptor, + ComponentMixin, +) + +__all__ = ["ViewOrigin", "ViewOriginBatch"] + + +class ViewOrigin(datatypes.EntityPath, ComponentMixin): + """**Component**: The origin of a view.""" + + _BATCH_TYPE = None + # You can define your own __init__ function as a member of ViewOriginExt in view_origin_ext.py + + # Note: there are no fields here because ViewOrigin delegates to datatypes.EntityPath + pass + + +class ViewOriginBatch(datatypes.EntityPathBatch, ComponentBatchMixin): + _COMPONENT_DESCRIPTOR: ComponentDescriptor = ComponentDescriptor("rerun.blueprint.components.ViewOrigin") + + +# This is patched in late to avoid circular dependencies. +ViewOrigin._BATCH_TYPE = ViewOriginBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/containers.py b/rerun_py/rerun_sdk/rerun/blueprint/containers.py index 4ca94b223e34..06f88c00cb1a 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/containers.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/containers.py @@ -3,7 +3,7 @@ from typing import Iterable, Optional from ..datatypes import Float32ArrayLike, Utf8Like -from .api import Container, SpaceView +from .api import Container, View from .components.container_kind import ContainerKind @@ -12,8 +12,8 @@ class Horizontal(Container): def __init__( self, - *args: Container | SpaceView, - contents: Optional[Iterable[Container | SpaceView]] = None, + *args: Container | View, + contents: Optional[Iterable[Container | View]] = None, column_shares: Optional[Float32ArrayLike] = None, name: Utf8Like | None = None, ): @@ -25,7 +25,7 @@ def __init__( *args: All positional arguments are forwarded to the `contents` parameter for convenience. contents: - The contents of the container. Each item in the iterable must be a `SpaceView` or a `Container`. + The contents of the container. Each item in the iterable must be a `View` or a `Container`. This can only be used if no positional arguments are provided. column_shares The layout shares of the columns in the container. The share is used to determine what fraction of the total width each @@ -44,8 +44,8 @@ class Vertical(Container): def __init__( self, - *args: Container | SpaceView, - contents: Optional[Iterable[Container | SpaceView]] = None, + *args: Container | View, + contents: Optional[Iterable[Container | View]] = None, row_shares: Optional[Float32ArrayLike] = None, name: Utf8Like | None = None, ): @@ -57,7 +57,7 @@ def __init__( *args: All positional arguments are forwarded to the `contents` parameter for convenience. contents: - The contents of the container. Each item in the iterable must be a `SpaceView` or a `Container`. + The contents of the container. Each item in the iterable must be a `View` or a `Container`. This can only be used if no positional arguments are provided. row_shares The layout shares of the rows in the container. The share is used to determine what fraction of the total height each @@ -74,8 +74,8 @@ class Grid(Container): def __init__( self, - *args: Container | SpaceView, - contents: Optional[Iterable[Container | SpaceView]] = None, + *args: Container | View, + contents: Optional[Iterable[Container | View]] = None, column_shares: Optional[Float32ArrayLike] = None, row_shares: Optional[Float32ArrayLike] = None, grid_columns: Optional[int] = None, @@ -89,7 +89,7 @@ def __init__( *args: All positional arguments are forwarded to the `contents` parameter for convenience. contents: - The contents of the container. Each item in the iterable must be a `SpaceView` or a `Container`. + The contents of the container. Each item in the iterable must be a `View` or a `Container`. This can only be used if no positional arguments are provided. column_shares The layout shares of the columns in the container. The share is used to determine what fraction of the total width each @@ -119,8 +119,8 @@ class Tabs(Container): def __init__( self, - *args: Container | SpaceView, - contents: Optional[Iterable[Container | SpaceView]] = None, + *args: Container | View, + contents: Optional[Iterable[Container | View]] = None, active_tab: Optional[int | str] = None, name: Utf8Like | None = None, ): @@ -132,7 +132,7 @@ def __init__( *args: All positional arguments are forwarded to the `contents` parameter for convenience. contents: - The contents of the container. Each item in the iterable must be a `SpaceView` or a `Container`. + The contents of the container. Each item in the iterable must be a `View` or a `Container`. This can only be used if no positional arguments are provided. active_tab: The index or name of the active tab. diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/bar_chart_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/bar_chart_view.py index 369af72d3652..43fef388fed3 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/bar_chart_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/bar_chart_view.py @@ -12,10 +12,10 @@ from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like from .. import archetypes as blueprint_archetypes, components as blueprint_components -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike -class BarChartView(SpaceView): +class BarChartView(View): """ **View**: A bar chart view. @@ -52,7 +52,7 @@ def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -70,7 +70,7 @@ def __init__( contents: The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. - See [rerun.blueprint.archetypes.SpaceViewContents][]. + See [rerun.blueprint.archetypes.ViewContents][]. name: The display name of the view. visible: @@ -78,11 +78,11 @@ def __init__( Defaults to true if not specified. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py index 119b0b8f198d..5996dbb7ecb1 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py @@ -12,10 +12,10 @@ from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like from .. import archetypes as blueprint_archetypes -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike -class DataframeView(SpaceView): +class DataframeView(View): """ **View**: A view to display any data in a tabular form. @@ -73,7 +73,7 @@ def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -91,7 +91,7 @@ def __init__( contents: The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. - See [rerun.blueprint.archetypes.SpaceViewContents][]. + See [rerun.blueprint.archetypes.ViewContents][]. name: The display name of the view. visible: @@ -99,11 +99,11 @@ def __init__( Defaults to true if not specified. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/graph_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/graph_view.py index 753f74e416d1..ea1d6c022aca 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/graph_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/graph_view.py @@ -12,10 +12,10 @@ from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like from .. import archetypes as blueprint_archetypes -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike -class GraphView(SpaceView): +class GraphView(View): """ **View**: A graph view to display time-variying, directed or undirected graph visualization. @@ -64,7 +64,7 @@ def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -87,7 +87,7 @@ def __init__( contents: The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. - See [rerun.blueprint.archetypes.SpaceViewContents][]. + See [rerun.blueprint.archetypes.ViewContents][]. name: The display name of the view. visible: @@ -95,11 +95,11 @@ def __init__( Defaults to true if not specified. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/map_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/map_view.py index 52fd01afdb64..9e0270003eb3 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/map_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/map_view.py @@ -12,10 +12,10 @@ from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like from .. import archetypes as blueprint_archetypes, components as blueprint_components -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike -class MapView(SpaceView): +class MapView(View): """ **View**: A 2D map view to display geospatial primitives. @@ -59,7 +59,7 @@ def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -78,7 +78,7 @@ def __init__( contents: The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. - See [rerun.blueprint.archetypes.SpaceViewContents][]. + See [rerun.blueprint.archetypes.ViewContents][]. name: The display name of the view. visible: @@ -86,11 +86,11 @@ def __init__( Defaults to true if not specified. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/spatial2d_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/spatial2d_view.py index f7d9a4532090..0cf006b4c4bc 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/spatial2d_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/spatial2d_view.py @@ -12,10 +12,10 @@ from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like from .. import archetypes as blueprint_archetypes, components as blueprint_components -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike -class Spatial2DView(SpaceView): +class Spatial2DView(View): """ **View**: For viewing spatial 2D data. @@ -71,7 +71,7 @@ def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -97,7 +97,7 @@ def __init__( contents: The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. - See [rerun.blueprint.archetypes.SpaceViewContents][]. + See [rerun.blueprint.archetypes.ViewContents][]. name: The display name of the view. visible: @@ -105,11 +105,11 @@ def __init__( Defaults to true if not specified. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/spatial3d_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/spatial3d_view.py index 0fac6a2391d2..555bbb734b28 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/spatial3d_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/spatial3d_view.py @@ -12,10 +12,10 @@ from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like from .. import archetypes as blueprint_archetypes, components as blueprint_components -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike -class Spatial3DView(SpaceView): +class Spatial3DView(View): """ **View**: For viewing spatial 3D data. @@ -76,7 +76,7 @@ def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -102,7 +102,7 @@ def __init__( contents: The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. - See [rerun.blueprint.archetypes.SpaceViewContents][]. + See [rerun.blueprint.archetypes.ViewContents][]. name: The display name of the view. visible: @@ -110,11 +110,11 @@ def __init__( Defaults to true if not specified. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/tensor_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/tensor_view.py index 0ca72991b2a8..203da0d114cf 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/tensor_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/tensor_view.py @@ -12,10 +12,10 @@ from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like from .. import archetypes as blueprint_archetypes, components as blueprint_components -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike -class TensorView(SpaceView): +class TensorView(View): """ **View**: A view on a tensor of any dimensionality. @@ -75,7 +75,7 @@ def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -95,7 +95,7 @@ def __init__( contents: The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. - See [rerun.blueprint.archetypes.SpaceViewContents][]. + See [rerun.blueprint.archetypes.ViewContents][]. name: The display name of the view. visible: @@ -103,11 +103,11 @@ def __init__( Defaults to true if not specified. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/text_document_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/text_document_view.py index 5f33cfefe668..095eac37395f 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/text_document_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/text_document_view.py @@ -11,10 +11,10 @@ from ... import datatypes from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike -class TextDocumentView(SpaceView): +class TextDocumentView(View): """ **View**: A view of a single text document, for use with [`archetypes.TextDocument`][rerun.archetypes.TextDocument]. @@ -90,7 +90,7 @@ def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -107,7 +107,7 @@ def __init__( contents: The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. - See [rerun.blueprint.archetypes.SpaceViewContents][]. + See [rerun.blueprint.archetypes.ViewContents][]. name: The display name of the view. visible: @@ -115,11 +115,11 @@ def __init__( Defaults to true if not specified. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/text_log_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/text_log_view.py index 78572b7cd79a..ae3ac77cddf2 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/text_log_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/text_log_view.py @@ -11,10 +11,10 @@ from ... import datatypes from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike -class TextLogView(SpaceView): +class TextLogView(View): """ **View**: A view of a text log, for use with [`archetypes.TextLog`][rerun.archetypes.TextLog]. @@ -56,7 +56,7 @@ def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -73,7 +73,7 @@ def __init__( contents: The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. - See [rerun.blueprint.archetypes.SpaceViewContents][]. + See [rerun.blueprint.archetypes.ViewContents][]. name: The display name of the view. visible: @@ -81,11 +81,11 @@ def __init__( Defaults to true if not specified. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/time_series_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/time_series_view.py index 7924e94ae169..64c524f59b48 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/time_series_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/time_series_view.py @@ -12,10 +12,10 @@ from ..._baseclasses import AsComponents, ComponentBatchLike from ...datatypes import EntityPathLike, Utf8Like from .. import archetypes as blueprint_archetypes, components as blueprint_components -from ..api import SpaceView, SpaceViewContentsLike +from ..api import View, ViewContentsLike -class TimeSeriesView(SpaceView): +class TimeSeriesView(View): """ **View**: A time series view for scalars over time, for use with [`archetypes.Scalar`][rerun.archetypes.Scalar]. @@ -86,7 +86,7 @@ def __init__( self, *, origin: EntityPathLike = "/", - contents: SpaceViewContentsLike = "$origin/**", + contents: ViewContentsLike = "$origin/**", name: Utf8Like | None = None, visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], @@ -109,7 +109,7 @@ def __init__( contents: The contents of the view specified as a query expression. This is either a single expression, or a list of multiple expressions. - See [rerun.blueprint.archetypes.SpaceViewContents][]. + See [rerun.blueprint.archetypes.ViewContents][]. name: The display name of the view. visible: @@ -117,11 +117,11 @@ def __init__( Defaults to true if not specified. defaults: - List of default components or component batches to add to the space view. When an archetype + List of default components or component batches to add to the view. When an archetype in the view is missing a component included in this set, the value of default will be used instead of the normal fallback for the visualizer. overrides: - Dictionary of overrides to apply to the space view. The key is the path to the entity where the override + Dictionary of overrides to apply to the view. The key is the path to the entity where the override should be applied. The value is a list of component or component batches to apply to the entity. Important note: the path must be a fully qualified entity path starting at the root. The override paths diff --git a/rerun_py/rerun_sdk/rerun/components/disconnected_space.py b/rerun_py/rerun_sdk/rerun/components/disconnected_space.py index b1d96b08ef1f..4ca00a3af3c0 100644 --- a/rerun_py/rerun_sdk/rerun/components/disconnected_space.py +++ b/rerun_py/rerun_sdk/rerun/components/disconnected_space.py @@ -22,7 +22,7 @@ class DisconnectedSpace(DisconnectedSpaceExt, datatypes.Bool, ComponentMixin): Specifies that the entity path at which this is logged is spatially disconnected from its parent, making it impossible to transform the entity path into its parent's space and vice versa. - It *only* applies to space views that work with spatial transformations, i.e. 2D & 3D space views. + It *only* applies to views that work with spatial transformations, i.e. 2D & 3D views. This is useful for specifying that a subgraph is independent of the rest of the scene. """ diff --git a/rerun_py/tests/unit/blueprint_utils.py b/rerun_py/tests/unit/blueprint_utils.py index 7fefa7bab81d..cbead13721b0 100644 --- a/rerun_py/tests/unit/blueprint_utils.py +++ b/rerun_py/tests/unit/blueprint_utils.py @@ -5,7 +5,7 @@ import rerun.blueprint as rrb -def assert_blueprint_contents_are_equal(*contents: rrb.SpaceView | rrb.Container) -> None: +def assert_blueprint_contents_are_equal(*contents: rrb.View | rrb.Container) -> None: """ Check for equivalence between blueprint contents (views and containers). diff --git a/rerun_py/tests/unit/test_space_view_blueprint.py b/rerun_py/tests/unit/test_view_blueprint.py similarity index 73% rename from rerun_py/tests/unit/test_space_view_blueprint.py rename to rerun_py/tests/unit/test_view_blueprint.py index 4b4c228b75fe..ae517f6b3240 100644 --- a/rerun_py/tests/unit/test_space_view_blueprint.py +++ b/rerun_py/tests/unit/test_view_blueprint.py @@ -3,9 +3,9 @@ import itertools from typing import Optional, cast -from rerun.blueprint.archetypes.space_view_blueprint import SpaceViewBlueprint -from rerun.blueprint.components.space_view_class import SpaceViewClass, SpaceViewClassBatch -from rerun.blueprint.components.space_view_origin import SpaceViewOrigin, SpaceViewOriginBatch +from rerun.blueprint.archetypes.view_blueprint import ViewBlueprint +from rerun.blueprint.components.view_class import ViewClass, ViewClassBatch +from rerun.blueprint.components.view_origin import ViewOrigin, ViewOriginBatch from rerun.blueprint.components.visible import Visible, VisibleBatch from rerun.components.name import Name, NameBatch from rerun.datatypes.bool import BoolLike @@ -15,10 +15,10 @@ from .common_arrays import none_empty_or_value -def test_space_view_blueprint() -> None: - class_identifier_arrays = ["3D", SpaceViewClass("3D")] +def test_view_blueprint() -> None: + class_identifier_arrays = ["3D", ViewClass("3D")] display_name_arrays = ["3D view", Name("3D view"), None] - space_origin_arrays = ["/robot/arm", None, SpaceViewOrigin("/robot/arm")] + space_origin_arrays = ["/robot/arm", None, ViewOrigin("/robot/arm")] visible_arrays = [False, Visible(False), None] all_arrays = itertools.zip_longest( @@ -38,14 +38,14 @@ def test_space_view_blueprint() -> None: visible = cast(Optional[BoolLike], visible) print( - "rr.SpaceViewBlueprint(\n", + "rr.ViewBlueprint(\n", f" class_identifier={class_identifier!r}\n", f" display_name={display_name!r}\n", f" space_origin={space_origin!r}\n", f" visible={visible!r}\n", ")", ) - arch = SpaceViewBlueprint( + arch = ViewBlueprint( class_identifier, display_name=display_name, space_origin=space_origin, @@ -54,7 +54,7 @@ def test_space_view_blueprint() -> None: print(f"{arch}\n") # Equality checks on some of these are a bit silly, but at least they test out that the serialization code runs without problems. - assert arch.class_identifier == SpaceViewClassBatch("3D") + assert arch.class_identifier == ViewClassBatch("3D") assert arch.display_name == NameBatch._optional(none_empty_or_value(display_name, "3D view")) - assert arch.space_origin == SpaceViewOriginBatch._optional(none_empty_or_value(space_origin, "/robot/arm")) + assert arch.space_origin == ViewOriginBatch._optional(none_empty_or_value(space_origin, "/robot/arm")) assert arch.visible == VisibleBatch._optional(none_empty_or_value(visible, False)) diff --git a/rerun_py/tests/unit/test_space_view_contents.py b/rerun_py/tests/unit/test_view_contents.py similarity index 87% rename from rerun_py/tests/unit/test_space_view_contents.py rename to rerun_py/tests/unit/test_view_contents.py index 4ed50b269959..93aa0e4ba5c2 100644 --- a/rerun_py/tests/unit/test_space_view_contents.py +++ b/rerun_py/tests/unit/test_view_contents.py @@ -3,7 +3,7 @@ import itertools from typing import cast -from rerun.blueprint.archetypes.space_view_contents import SpaceViewContents +from rerun.blueprint.archetypes.view_contents import ViewContents from rerun.blueprint.components.query_expression import QueryExpression, QueryExpressionBatch from rerun.datatypes.utf8 import Utf8ArrayLike @@ -31,11 +31,11 @@ def test_space_view_contents() -> None: query = cast(Utf8ArrayLike, query) print( - "rr.SpaceViewContents(\n", + "rr.ViewContents(\n", f" {query!r}\n", ")", ) - arch = SpaceViewContents( + arch = ViewContents( query, ) diff --git a/rerun_py/tests/unit/test_viewport_blueprint.py b/rerun_py/tests/unit/test_viewport_blueprint.py index 29e6691cca48..bd05fdfac912 100644 --- a/rerun_py/tests/unit/test_viewport_blueprint.py +++ b/rerun_py/tests/unit/test_viewport_blueprint.py @@ -5,9 +5,9 @@ from rerun.blueprint.archetypes.viewport_blueprint import ViewportBlueprint from rerun.blueprint.components.auto_layout import AutoLayoutBatch -from rerun.blueprint.components.auto_space_views import AutoSpaceViewsBatch +from rerun.blueprint.components.auto_views import AutoViewsBatch from rerun.blueprint.components.root_container import RootContainerBatch -from rerun.blueprint.components.space_view_maximized import SpaceViewMaximizedBatch +from rerun.blueprint.components.view_maximized import ViewMaximizedBatch from rerun.blueprint.components.viewer_recommendation_hash import ( ViewerRecommendationHash, ViewerRecommendationHashBatch, @@ -29,7 +29,7 @@ def test_viewport_blueprint() -> None: uuid_bytes1, ] auto_layout_arrays = [None, True] - auto_space_views_arrays = [None, False] + auto_views_arrays = [None, False] viewer_recommendation_hash_arrays = [ None, [123, 321], @@ -40,7 +40,7 @@ def test_viewport_blueprint() -> None: root_container_arrays, maximized_arrays, auto_layout_arrays, - auto_space_views_arrays, + auto_views_arrays, viewer_recommendation_hash_arrays, ) @@ -48,14 +48,14 @@ def test_viewport_blueprint() -> None: root_container, maximized, auto_layout, - auto_space_views, + auto_views, past_viewer_recommendations, ) in all_arrays: # mypy can't track types properly through itertools zip so re-cast root_container = cast(Optional[UuidLike], root_container) maximized = cast(Optional[UuidLike], maximized) auto_layout = cast(Optional[BoolLike], auto_layout) - auto_space_views = cast(Optional[BoolLike], auto_space_views) + auto_views = cast(Optional[BoolLike], auto_views) past_viewer_recommendations = cast(Optional[UInt64ArrayLike], past_viewer_recommendations) print( @@ -63,7 +63,7 @@ def test_viewport_blueprint() -> None: f" root_container={root_container!r}\n", f" maximized={maximized!r}\n", f" auto_layout={auto_layout!r}\n", - f" auto_space_views={auto_space_views!r}\n", + f" auto_views={auto_views!r}\n", f" past_viewer_recommendations={past_viewer_recommendations!r}\n", ")", ) @@ -71,15 +71,15 @@ def test_viewport_blueprint() -> None: root_container=root_container, maximized=maximized, auto_layout=auto_layout, - auto_space_views=auto_space_views, + auto_views=auto_views, past_viewer_recommendations=past_viewer_recommendations, ) print(f"{arch}\n") assert arch.root_container == RootContainerBatch._optional(none_empty_or_value(root_container, uuid_bytes0)) - assert arch.maximized == SpaceViewMaximizedBatch._optional(none_empty_or_value(maximized, uuid_bytes1)) + assert arch.maximized == ViewMaximizedBatch._optional(none_empty_or_value(maximized, uuid_bytes1)) assert arch.auto_layout == AutoLayoutBatch._optional(none_empty_or_value(auto_layout, True)) - assert arch.auto_space_views == AutoSpaceViewsBatch._optional(none_empty_or_value(auto_space_views, False)) + assert arch.auto_views == AutoViewsBatch._optional(none_empty_or_value(auto_views, False)) assert arch.past_viewer_recommendations == ViewerRecommendationHashBatch._optional( none_empty_or_value(past_viewer_recommendations, [123, 321]) ) diff --git a/scripts/lint.py b/scripts/lint.py index 6f703f647143..f99428e69a89 100755 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -285,7 +285,7 @@ def test_lint_line() -> None: should_pass = [ "hello world", - "this is a 2D spaceview", + "this is a 2D view", "todo lowercase is fine", 'todo!("Macro is ok with text")', "TODO_TOKEN", @@ -368,7 +368,7 @@ def test_lint_line() -> None: ] should_error = [ - "this is a 2d spaceview", + "this is a 2d view", "FIXME", "HACK", "TODO", @@ -393,7 +393,7 @@ def test_lint_line() -> None: r'println!("Problem: \"{}\"", string)', r'println!("Problem: \"{0}\"")', r'println!("Problem: \"{string}\"")', - 'ui.label("This uses ugly title casing for Space View.")', + 'ui.label("This uses ugly title casing for View.")', "trailing whitespace ", "rr_stream", "rec_stream", diff --git a/tests/python/release_checklist/check_1d_tensor_data.py b/tests/python/release_checklist/check_1d_tensor_data.py index 6e1624f95488..ae418182e979 100644 --- a/tests/python/release_checklist/check_1d_tensor_data.py +++ b/tests/python/release_checklist/check_1d_tensor_data.py @@ -16,7 +16,7 @@ You should see: * a tensor view with 1D data - * Note: when selecting the tensor space view, there should be two "Dimension Mapping" widgets, which can be used to + * Note: when selecting the tensor view, there should be two "Dimension Mapping" widgets, which can be used to display the tensor vertically or horizontally. The "Selectors" list should be empty. * an image view with a 1D image * a bar chart diff --git a/tests/python/release_checklist/check_all_components_ui.py b/tests/python/release_checklist/check_all_components_ui.py index b9106703631f..0849f5983c8b 100644 --- a/tests/python/release_checklist/check_all_components_ui.py +++ b/tests/python/release_checklist/check_all_components_ui.py @@ -253,7 +253,7 @@ def log_readme() -> None: rr.log("readme", rr.TextDocument(README, media_type=rr.MediaType.MARKDOWN), static=True) -def log_some_space_views() -> None: +def log_some_views() -> None: # check that we didn't forget a component missing_components = set(c for c in dir(rr.components) if c.endswith("Batch")) - set(ALL_COMPONENTS.keys()) assert ( @@ -297,7 +297,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": diff --git a/tests/python/release_checklist/check_annotations.py b/tests/python/release_checklist/check_annotations.py index 8d5f00245c53..3e8ff3f8012b 100644 --- a/tests/python/release_checklist/check_annotations.py +++ b/tests/python/release_checklist/check_annotations.py @@ -14,7 +14,7 @@ ### Actions -There should be one space-view with an image and a batch of 2 rectangles. +There should be one view with an image and a batch of 2 rectangles. The image should contain a red region and a green region. There should be 1 red rectangle and 1 green rectangle. diff --git a/tests/python/release_checklist/check_container_hierarchy.py b/tests/python/release_checklist/check_container_hierarchy.py index d03cfa74a672..90150e3c6514 100644 --- a/tests/python/release_checklist/check_container_hierarchy.py +++ b/tests/python/release_checklist/check_container_hierarchy.py @@ -15,7 +15,7 @@ TODO(ab): setup the container hierarchy with the blueprint API when available. -* Organize the space views in a non-trivial hierarchy of containers. +* Organize the views in a non-trivial hierarchy of containers. * As a starting point, ensure that the hierarchy is "sane" (i.e. no leaf/single-child containers, etc.). @@ -61,7 +61,7 @@ def log_readme() -> None: rr.log("readme", rr.TextDocument(README, media_type=rr.MediaType.MARKDOWN), static=True) -def log_some_space_views() -> None: +def log_some_views() -> None: from math import cos, sin, tau rr.set_time_sequence("frame_nr", 0) @@ -89,7 +89,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": diff --git a/tests/python/release_checklist/check_context_menu_add_entity_to_new_space_view.py b/tests/python/release_checklist/check_context_menu_add_entity_to_new_space_view.py index d3d71f4ecdc9..2bd104a8927a 100644 --- a/tests/python/release_checklist/check_context_menu_add_entity_to_new_space_view.py +++ b/tests/python/release_checklist/check_context_menu_add_entity_to_new_space_view.py @@ -10,18 +10,18 @@ import rerun.blueprint as rrb README = """\ -# Context Menu - Add entity to new space view +# Context Menu - Add entity to new view #### Blueprint tree * "Expand all" on the Vertical containers. -* Right-click on the `boxes3d` entity and select "Add to new space view" -> "3D". Check a new space view is created _and selected_ with the boxes3d entity and origin set to root. -* In each space view, right-click on the leaf entity, and check that "Add to new space view" recommends at least space views of the same kind. -* Select both the `boxes3d` entity and the `text_logs` entity. Check no space view is recommended (except Dataframe if enabled). +* Right-click on the `boxes3d` entity and select "Add to new view" -> "3D". Check a new view is created _and selected_ with the boxes3d entity and origin set to root. +* In each view, right-click on the leaf entity, and check that "Add to new view" recommends at least views of the same kind. +* Select both the `boxes3d` entity and the `text_logs` entity. Check no view is recommended (except Dataframe if enabled). #### Streams tree -* Right-click on the `bars` entity and check that a Bar Plot space view can successfully be created. +* Right-click on the `bars` entity and check that a Bar Plot view can successfully be created. """ @@ -43,7 +43,7 @@ def blueprint() -> rrb.BlueprintLike: ) -def log_some_space_views() -> None: +def log_some_views() -> None: rr.set_time_sequence("frame_nr", 0) rr.log("boxes3d", rr.Boxes3D(centers=[[0, 0, 0], [1, 1.5, 1.15], [3, 2, 1]], half_sizes=[0.5, 1, 0.5] * 3)) @@ -61,7 +61,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4(), default_blueprint=blueprint()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": diff --git a/tests/python/release_checklist/check_context_menu_collapse_expand_all.py b/tests/python/release_checklist/check_context_menu_collapse_expand_all.py index 8bb5e1aef70b..ee1d9d74ffa8 100644 --- a/tests/python/release_checklist/check_context_menu_collapse_expand_all.py +++ b/tests/python/release_checklist/check_context_menu_collapse_expand_all.py @@ -8,7 +8,7 @@ import rerun.blueprint as rrb README = """\ -# Context Menu - Add entity to new space view +# Context Menu - Add entity to new view ## Blueprint tree @@ -44,7 +44,7 @@ def blueprint() -> rrb.BlueprintLike: ) -def log_some_space_views() -> None: +def log_some_views() -> None: rr.set_time_sequence("frame_nr", 0) rr.log("/", rr.Boxes3D(centers=[0, 0, 0], half_sizes=[1, 1, 1])) rr.log("/world/robot/arm/actuator/thing", rr.Boxes3D(centers=[0.5, 0, 0], half_sizes=[0.1, 0.1, 0.1])) @@ -54,7 +54,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4(), default_blueprint=blueprint()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": diff --git a/tests/python/release_checklist/check_context_menu_invalid_sub_container.py b/tests/python/release_checklist/check_context_menu_invalid_sub_container.py index dee6f5f9b755..9a32db71f704 100644 --- a/tests/python/release_checklist/check_context_menu_invalid_sub_container.py +++ b/tests/python/release_checklist/check_context_menu_invalid_sub_container.py @@ -13,8 +13,8 @@ * Single-select the horizontal container, check that it disallow adding a horizontal container inside it. * Same for the vertical container. -* Single select a space view inside a horizontal container, check that it disallow moving to a new horizontal container. -* Same for a space view inside a vertical container. +* Single select a view inside a horizontal container, check that it disallow moving to a new horizontal container. +* Same for a view inside a vertical container. """ @@ -38,7 +38,7 @@ def blueprint() -> rrb.BlueprintLike: ) -def log_some_space_views() -> None: +def log_some_views() -> None: rr.set_time_sequence("frame_nr", 0) rr.log("boxes3d", rr.Boxes3D(centers=[[0, 0, 0], [1, 1.5, 1.15], [3, 2, 1]], half_sizes=[0.5, 1, 0.5] * 3)) @@ -49,7 +49,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4(), default_blueprint=blueprint()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": diff --git a/tests/python/release_checklist/check_context_menu_multi_selection.py b/tests/python/release_checklist/check_context_menu_multi_selection.py index 10f00280ec51..68f47c6ee008 100644 --- a/tests/python/release_checklist/check_context_menu_multi_selection.py +++ b/tests/python/release_checklist/check_context_menu_multi_selection.py @@ -17,7 +17,7 @@ ========================================================== ITEMS CONTEXT MENU CONTENT ========================================================== -2x Space views Hide all +2x Views Hide all Remove Expand all @@ -38,7 +38,7 @@ Expand all Collapse all ========================================================== -Space view + 'box2d' data result Hide all +View + 'box2d' data result Hide all Remove Expand all @@ -49,7 +49,7 @@ Expand all Collapse all - Add to new space view + Add to new view ---------------------------------------------------------- + some component Hide all @@ -75,7 +75,7 @@ def blueprint() -> rrb.BlueprintLike: ) -def log_some_space_views() -> None: +def log_some_views() -> None: rr.set_time_sequence("frame_nr", 0) rr.log("boxes3d", rr.Boxes3D(centers=[[0, 0, 0], [1, 1.5, 1.15], [3, 2, 1]], half_sizes=[0.5, 1, 0.5] * 3)) @@ -86,7 +86,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4(), default_blueprint=blueprint()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": diff --git a/tests/python/release_checklist/check_context_menu_single_selection.py b/tests/python/release_checklist/check_context_menu_single_selection.py index f45872ae217f..8ff3f85dd682 100644 --- a/tests/python/release_checklist/check_context_menu_single_selection.py +++ b/tests/python/release_checklist/check_context_menu_single_selection.py @@ -24,7 +24,7 @@ 'group/' entity Expand all Collapse all - Add to new space view + Add to new view ------------------------------------------------- Component ================================================= @@ -32,9 +32,9 @@ #### Tile title UI -- Multi-select the 3D space view and the Vertical container in the Blueprint tree. -- Right-click on the 3D space view tab title: - - The selection is set to the space view _only_. +- Multi-select the 3D view and the Vertical container in the Blueprint tree. +- Right-click on the 3D view tab title: + - The selection is set to the view _only_. - The context menu content is as per the following table. @@ -42,7 +42,7 @@ ================================================= ITEM CONTEXT MENU CONTENT ================================================= -space view (tab title) Hide +view (tab title) Hide Remove Expand all @@ -58,7 +58,7 @@ #### Container selection panel child list - Select the Vertical container. -- In the selection panel, right-click on the 3D space view, and check that: +- In the selection panel, right-click on the 3D view, and check that: - The selection remains unchanged. - The context menu content is as per the following table. @@ -66,7 +66,7 @@ ================================================= ITEM CONTEXT MENU CONTENT ================================================= -space view (child list) Hide +view (child list) Hide Remove Expand all @@ -96,7 +96,7 @@ def blueprint() -> rrb.BlueprintLike: ) -def log_some_space_views() -> None: +def log_some_views() -> None: rr.set_time_sequence("frame_nr", 0) rr.log("group/boxes3d", rr.Boxes3D(centers=[[0, 0, 0], [1, 1.5, 1.15], [3, 2, 1]], half_sizes=[0.5, 1, 0.5] * 3)) @@ -106,7 +106,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4(), default_blueprint=blueprint()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": diff --git a/tests/python/release_checklist/check_context_menu_single_selection_blueprint_tree.py b/tests/python/release_checklist/check_context_menu_single_selection_blueprint_tree.py index 48e3c1b8b2bf..6eb133482d43 100644 --- a/tests/python/release_checklist/check_context_menu_single_selection_blueprint_tree.py +++ b/tests/python/release_checklist/check_context_menu_single_selection_blueprint_tree.py @@ -24,7 +24,7 @@ Collapse all Add container - Add space view + Add view ------------------------------------------------------------------ Container Hide (or Show, depending on visibility) Remove @@ -33,11 +33,11 @@ Collapse all Add container - Add space view + Add view Move to new container ------------------------------------------------------------------ -Space view Hide (or Show, depending on visibility) +View Hide (or Show, depending on visibility) Remove Expand all @@ -53,12 +53,12 @@ Expand all Collapse all - Add to new space view + Add to new view ------------------------------------------------------------------ 'boxes3d' data result Hide (or Show, depending on visibility) Remove - Add to new space view + Add to new view ``` """ @@ -75,7 +75,7 @@ def blueprint() -> rrb.BlueprintLike: ) -def log_some_space_views() -> None: +def log_some_views() -> None: rr.set_time_sequence("frame_nr", 0) rr.log("group/boxes3d", rr.Boxes3D(centers=[[0, 0, 0], [1, 1.5, 1.15], [3, 2, 1]], half_sizes=[0.5, 1, 0.5] * 3)) @@ -85,7 +85,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4(), default_blueprint=blueprint()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": diff --git a/tests/python/release_checklist/check_context_menu_suggested_origin.py b/tests/python/release_checklist/check_context_menu_suggested_origin.py index 5d531011f66d..02c120940bdb 100644 --- a/tests/python/release_checklist/check_context_menu_suggested_origin.py +++ b/tests/python/release_checklist/check_context_menu_suggested_origin.py @@ -12,14 +12,14 @@ README = """\ # Context Menu - Test the origin selection heuristics -Repeat these steps for each of the following entities and space view class: +Repeat these steps for each of the following entities and view class: - right-click the entity (either in the blueprint or streams tree) -- select "Add to new space view" and create the space view of the listed class -- check that the created space view has the expected origin -- delete the space view +- select "Add to new view" and create the view of the listed class +- check that the created view has the expected origin +- delete the view -check that for the given space view class, the resulting suggested origin is as expected. +check that for the given view class, the resulting suggested origin is as expected. ```plaintext =========================================================== @@ -52,7 +52,7 @@ def blueprint() -> rrb.BlueprintLike: ) -def log_some_space_views() -> None: +def log_some_views() -> None: rr.set_time_sequence("frame_nr", 0) rr.log("/", rr.Boxes3D(centers=[0, 0, 0], half_sizes=[1, 1, 1])) rr.log("/world", rr.ViewCoordinates.RIGHT_HAND_Y_DOWN, static=True) @@ -79,7 +79,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4(), default_blueprint=blueprint()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": diff --git a/tests/python/release_checklist/check_deselect_on_escape.py b/tests/python/release_checklist/check_deselect_on_escape.py index fcbb5ca1603e..e74698bc9656 100644 --- a/tests/python/release_checklist/check_deselect_on_escape.py +++ b/tests/python/release_checklist/check_deselect_on_escape.py @@ -18,7 +18,7 @@ In all the following cases, the 3D view should *remain selected*. * Select the 3D view, open the "Background Kind" dropdown in the selection panel, and hit ESC. -* Select the 3D view, open the "Add space view or container" modal, and hit ESC. +* Select the 3D view, open the "Add view or container" modal, and hit ESC. * Select the 3D view, right-click on it in the blueprint tree, and hit ESC. * Select the 3D view, open the Rerun menu, and hit ESC (KNOWN FAIL). """ diff --git a/tests/python/release_checklist/check_focus.py b/tests/python/release_checklist/check_focus.py index 6e2852b811c9..91c25335f0e7 100644 --- a/tests/python/release_checklist/check_focus.py +++ b/tests/python/release_checklist/check_focus.py @@ -10,10 +10,10 @@ README = """\ # Focus checks -- Double-click on a box in the first space view - - check ONLY the corresponding space view expands and scrolls +- Double-click on a box in the first view + - check ONLY the corresponding view expands and scrolls - check the streams view expands and scrolls -- Double-click on the leaf "boxes3d" entity in the streams view, check both space views expand (manual scrolling might be needed). +- Double-click on the leaf "boxes3d" entity in the streams view, check both views expand (manual scrolling might be needed). """ @@ -29,7 +29,7 @@ def blueprint() -> rrb.BlueprintLike: ) -def log_some_space_views() -> None: +def log_some_views() -> None: rr.set_time_sequence("frame_nr", 0) for i in range(500): @@ -45,7 +45,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4(), default_blueprint=blueprint()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": diff --git a/tests/python/release_checklist/check_heuristics_2d.py b/tests/python/release_checklist/check_heuristics_2d.py index d4037a460806..a951d05bec2f 100644 --- a/tests/python/release_checklist/check_heuristics_2d.py +++ b/tests/python/release_checklist/check_heuristics_2d.py @@ -15,10 +15,10 @@ Reset the blueprint to make sure you are viewing new heuristics and not a cached blueprint. ### Action -You should see 4 space-views. Depending on timing you may end up with a 5th space-view at the root. +You should see 4 views. Depending on timing you may end up with a 5th view at the root. This should go away when you reset. -The four remaining space-views should be: +The four remaining views should be: - `image1` with a red square - `image2` with a green square - `image3` with a green square, which when hovered shows two popups: diff --git a/tests/python/release_checklist/check_heuristics_mixed_2d_and_3d.py b/tests/python/release_checklist/check_heuristics_mixed_2d_and_3d.py index 1ec9903faddf..ba151b266d41 100644 --- a/tests/python/release_checklist/check_heuristics_mixed_2d_and_3d.py +++ b/tests/python/release_checklist/check_heuristics_mixed_2d_and_3d.py @@ -15,7 +15,7 @@ Reset the blueprint to make sure you are viewing new heuristics and not a cached blueprint. ### Action -You should see 5 space-views: +You should see 5 views: - 2D: `image1` with an all red image - 2D: `image2` with an all green image - 2D: `3D/camera` with an all blue image diff --git a/tests/python/release_checklist/check_heuristics_mixed_all_root.py b/tests/python/release_checklist/check_heuristics_mixed_all_root.py index 9e03d08a96c8..5b90b33e876a 100644 --- a/tests/python/release_checklist/check_heuristics_mixed_all_root.py +++ b/tests/python/release_checklist/check_heuristics_mixed_all_root.py @@ -12,7 +12,7 @@ This checks whether the heuristics do the right thing with mixed 2D, 3D and test data. ### Action -You should see 4 space-views: +You should see 4 views: - 2D: Boxes and points, `$origin` == `/` - 3D: 3D boxes, `$origin` == `/` - Text log: A single log line, `$origin` == `/` diff --git a/tests/python/release_checklist/check_mono_entity_views.py b/tests/python/release_checklist/check_mono_entity_views.py index 7c1ece1c53d6..90a45b40b821 100644 --- a/tests/python/release_checklist/check_mono_entity_views.py +++ b/tests/python/release_checklist/check_mono_entity_views.py @@ -14,7 +14,7 @@ This test checks that mono-entity views work as expected. - Reset the blueprint to default -- Check each space view: when titled `ERROR`, they should display an error, and when titled `OK`, they should display the tensor or text document correctly. +- Check each view: when titled `ERROR`, they should display an error, and when titled `OK`, they should display the tensor or text document correctly. """ diff --git a/tests/python/release_checklist/check_out_of_tree_data_results.py b/tests/python/release_checklist/check_out_of_tree_data_results.py index c212fb92bb7a..99f1edf440c7 100644 --- a/tests/python/release_checklist/check_out_of_tree_data_results.py +++ b/tests/python/release_checklist/check_out_of_tree_data_results.py @@ -12,7 +12,7 @@ [Background issue](https://github.com/rerun-io/rerun/issues/5742) -* Expand all the "TEST" space view. +* Expand all the "TEST" view. * Check that you can select each of its children. """ diff --git a/tests/python/release_checklist/check_plot_overrides.py b/tests/python/release_checklist/check_plot_overrides.py index 3437530dbde4..cc3a482bb3ce 100644 --- a/tests/python/release_checklist/check_plot_overrides.py +++ b/tests/python/release_checklist/check_plot_overrides.py @@ -18,19 +18,19 @@ * Remove all these overrides. ### Visible time range overrides -* Select the `plots` space view and confirm it shows: +* Select the `plots` view and confirm it shows: * "Default" selected * Showing "Entire timeline". * Select the `plots/cos` entity and confirm it shows: * "Default" selected * Showing "Entire timeline". -* Override the `plots` space view Visible time range +* Override the `plots` view Visible time range * Verify all 3 offset modes operate as expected * Override the `plots/cos` entity Visible time range * Verify all 3 offset modes operate as expected ### Overrides are cloned -* After overriding things on both the space-view and the entity, clone the space-view. +* After overriding things on both the view and the entity, clone the view. If nothing weird happens, you can close this recording. """ diff --git a/tests/python/release_checklist/check_static_components_ui.py b/tests/python/release_checklist/check_static_components_ui.py index 3fb809aa2d0e..61bb20845ee1 100644 --- a/tests/python/release_checklist/check_static_components_ui.py +++ b/tests/python/release_checklist/check_static_components_ui.py @@ -33,7 +33,7 @@ def log_readme() -> None: rr.log("readme", rr.TextDocument(README, media_type=rr.MediaType.MARKDOWN), static=True) -def log_some_space_views() -> None: +def log_some_views() -> None: rr.log("static", rr.Points2D([(0, 0), (1, 1), (2, 2)]), static=True) # override static component @@ -60,7 +60,7 @@ def run(args: Namespace) -> None: rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4()) log_readme() - log_some_space_views() + log_some_views() if __name__ == "__main__": From d62db9396ebbe012d7b1c0f373fda084d468227c Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Wed, 11 Dec 2024 09:23:36 +0100 Subject: [PATCH 22/71] Rust: more `impl` helpers (#8401) New release, new helpers, as is now customary. These only introduced two breaking changes in all of our examples and snippets, and they look pretty innocuous. Opinions? * Fixes #8398 --- crates/store/re_types_core/src/lib.rs | 108 ++++++++++++++++++ .../all/archetypes/image_send_columns.rs | 8 +- .../all/archetypes/mesh3d_partial_updates.rs | 2 +- 3 files changed, 116 insertions(+), 2 deletions(-) diff --git a/crates/store/re_types_core/src/lib.rs b/crates/store/re_types_core/src/lib.rs index 27a13bc63224..77ded5215d26 100644 --- a/crates/store/re_types_core/src/lib.rs +++ b/crates/store/re_types_core/src/lib.rs @@ -109,6 +109,15 @@ impl AsComponents for [&dyn ComponentBatch; N] { } } +impl AsComponents for [Box; N] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .map(|batch| ComponentBatchCowWithDescriptor::new(&**batch)) + .collect() + } +} + impl AsComponents for &[&dyn ComponentBatch] { #[inline] fn as_component_batches(&self) -> Vec> { @@ -118,6 +127,15 @@ impl AsComponents for &[&dyn ComponentBatch] { } } +impl AsComponents for &[Box] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .map(|batch| ComponentBatchCowWithDescriptor::new(&**batch)) + .collect() + } +} + impl AsComponents for Vec<&dyn ComponentBatch> { #[inline] fn as_component_batches(&self) -> Vec> { @@ -127,6 +145,96 @@ impl AsComponents for Vec<&dyn ComponentBatch> { } } +impl AsComponents for Vec> { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .map(|batch| ComponentBatchCowWithDescriptor::new(&**batch)) + .collect() + } +} + +impl AsComponents for [AS; N] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for [&dyn AsComponents; N] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for [Box; N] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for &[AS] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for &[&dyn AsComponents] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for &[Box] { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for Vec { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for Vec<&dyn AsComponents> { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + +impl AsComponents for Vec> { + #[inline] + fn as_component_batches(&self) -> Vec> { + self.iter() + .flat_map(|as_components| as_components.as_component_batches()) + .collect() + } +} + // --- mod archetype; diff --git a/docs/snippets/all/archetypes/image_send_columns.rs b/docs/snippets/all/archetypes/image_send_columns.rs index 5f0e2c991f81..73ed177259fd 100644 --- a/docs/snippets/all/archetypes/image_send_columns.rs +++ b/docs/snippets/all/archetypes/image_send_columns.rs @@ -23,7 +23,13 @@ fn main() -> Result<(), Box> { // Log the ImageFormat and indicator once, as static. let format = rerun::components::ImageFormat::rgb8([width as _, height as _]); - rec.log_static("images", &[&format as _, &rerun::Image::indicator() as _])?; + rec.log_static( + "images", + &[ + &format as &dyn rerun::ComponentBatch, + &rerun::Image::indicator(), + ], + )?; // Split up the image data into several components referencing the underlying data. let image_size_in_bytes = width * height * 3; diff --git a/docs/snippets/all/archetypes/mesh3d_partial_updates.rs b/docs/snippets/all/archetypes/mesh3d_partial_updates.rs index 1027b254a0bb..791428f62e52 100644 --- a/docs/snippets/all/archetypes/mesh3d_partial_updates.rs +++ b/docs/snippets/all/archetypes/mesh3d_partial_updates.rs @@ -26,7 +26,7 @@ fn main() -> Result<(), Box> { (glam::Vec3::from(vertex_positions[1]) * factor).into(), (glam::Vec3::from(vertex_positions[2]) * factor).into(), ]; - rec.log("triangle", &[&vertex_positions as _])?; + rec.log("triangle", &vertex_positions)?; } Ok(()) From 6972345c4069da3d20ac52b4554edcf6e71fb39d Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:20:08 +0100 Subject: [PATCH 23/71] Document legend interaction in the timeseries view help text (#8406) ### Related * Related: 8402 ### What Document the legend interactions in the timeseries view. image --- crates/viewer/re_view_time_series/src/view_class.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/viewer/re_view_time_series/src/view_class.rs b/crates/viewer/re_view_time_series/src/view_class.rs index b865b32fd716..a1447b57af81 100644 --- a/crates/viewer/re_view_time_series/src/view_class.rs +++ b/crates/viewer/re_view_time_series/src/view_class.rs @@ -112,12 +112,18 @@ Display time series data in a plot. - Scroll + {aspect_scroll_modifier} to zoom only the temporal axis while holding the y-range fixed. - Drag with the {selection_rect_zoom_button} to zoom in/out using a selection. - Click the {move_time_cursor_button} to move the time cursor. -- Double-click to reset the view.", +- Double-click to reset the view. + +## Legend interactions + +- Click on a series in the legend to show/hide it. +- {alt_modifier}-Click on a series to show/hide all other series.", horizontal_scroll_modifier = ModifiersMarkdown(HORIZONTAL_SCROLL_MODIFIER, egui_ctx), zoom_scroll_modifier = ModifiersMarkdown(ZOOM_SCROLL_MODIFIER, egui_ctx), aspect_scroll_modifier = ModifiersMarkdown(ASPECT_SCROLL_MODIFIER, egui_ctx), selection_rect_zoom_button = MouseButtonMarkdown(SELECTION_RECT_ZOOM_BUTTON), move_time_cursor_button = MouseButtonMarkdown(MOVE_TIME_CURSOR_BUTTON), + alt_modifier = ModifiersMarkdown(egui::Modifiers::ALT, egui_ctx), ) } From c739dd82d62d476e5b7c3ec2e978b2fac38129d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Wed, 11 Dec 2024 11:21:43 +0100 Subject: [PATCH 24/71] Add missing screenshots of graph view archetypes (#8371) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Related * Closes #8277 * Closes #8327 * Closes #8237 ### What This fixes many problems around the state of the graph view. Turns out the scene rect alone is not sufficient to store all of the viewer state (who would have thought 😇). --------- Co-authored-by: Andreas Reich --- .../rerun/archetypes/graph_edges.fbs | 6 ++-- .../rerun/archetypes/graph_nodes.fbs | 6 ++-- crates/viewer/re_view_graph/src/properties.rs | 10 ++++++- crates/viewer/re_view_graph/src/ui/state.rs | 4 ++- crates/viewer/re_view_graph/src/view.rs | 26 +++++++++++++---- .../reference/types/archetypes/graph_edges.md | 16 ++++++++-- .../reference/types/archetypes/graph_nodes.md | 16 ++++++++-- examples/rust/chess_robby_fischer/README.md | 6 ++-- examples/rust/graph_lattice/README.md | 29 +++++++++++++++++-- rerun_cpp/src/rerun/blueprint.hpp | 11 ------- rerun_py/docs/gen_common_index.py | 20 ++++++------- rerun_py/rerun_sdk/rerun/blueprint/api.py | 2 +- .../tests/unit/test_container_blueprint.py | 10 +++---- rerun_py/tests/unit/test_view_contents.py | 2 +- 14 files changed, 110 insertions(+), 54 deletions(-) delete mode 100644 rerun_cpp/src/rerun/blueprint.hpp diff --git a/crates/store/re_types/definitions/rerun/archetypes/graph_edges.fbs b/crates/store/re_types/definitions/rerun/archetypes/graph_edges.fbs index f4e6a7a5988d..a20ea2d39fa1 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/graph_edges.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/graph_edges.fbs @@ -2,14 +2,12 @@ namespace rerun.archetypes; // --- -// TODO(ab): Add images to snippets. - /// A list of edges in a graph. /// /// By default, edges are undirected. /// -/// \example archetypes/graph_undirected !api title="Simple undirected graph" image="" -/// \example archetypes/graph_directed !api title="Simple directed graph" image="" +/// \example archetypes/graph_undirected !api title="Simple undirected graph" image="https://static.rerun.io/graph_undirected/15f46bec77452a8c6220558e4403b99cac188e2e/1200w.png" +/// \example archetypes/graph_directed !api title="Simple directed graph" image="https://static.rerun.io/graph_directed/ca29a37b65e1e0b6482251dce401982a0bc568fa/1200w.png" table GraphEdges ( "attr.docs.category": "Graph", "attr.docs.unreleased", diff --git a/crates/store/re_types/definitions/rerun/archetypes/graph_nodes.fbs b/crates/store/re_types/definitions/rerun/archetypes/graph_nodes.fbs index bf31f6fe5efa..7e7ddb535164 100644 --- a/crates/store/re_types/definitions/rerun/archetypes/graph_nodes.fbs +++ b/crates/store/re_types/definitions/rerun/archetypes/graph_nodes.fbs @@ -2,12 +2,10 @@ namespace rerun.archetypes; // --- -// TODO(ab): Add images to snippets. - /// A list of nodes in a graph with optional labels, colors, etc. /// -/// \example archetypes/graph_undirected !api title="Simple undirected graph" image="" -/// \example archetypes/graph_directed !api title="Simple directed graph" image="" +/// \example archetypes/graph_undirected !api title="Simple undirected graph" image="https://static.rerun.io/graph_undirected/15f46bec77452a8c6220558e4403b99cac188e2e/1200w.png" +/// \example archetypes/graph_directed !api title="Simple directed graph" image="https://static.rerun.io/graph_directed/ca29a37b65e1e0b6482251dce401982a0bc568fa/1200w.png" table GraphNodes ( "attr.docs.category": "Graph", "attr.docs.unreleased", diff --git a/crates/viewer/re_view_graph/src/properties.rs b/crates/viewer/re_view_graph/src/properties.rs index bbad71903532..3a99d6c777f0 100644 --- a/crates/viewer/re_view_graph/src/properties.rs +++ b/crates/viewer/re_view_graph/src/properties.rs @@ -6,6 +6,7 @@ use re_types::{ components::Position2D, Archetype as _, }; +use re_ui::zoom_pan_area::fit_to_rect_in_scene; use re_viewer_context::{TypedComponentFallbackProvider, ViewStateExt as _}; use crate::{ui::GraphViewState, GraphView}; @@ -21,7 +22,14 @@ impl TypedComponentFallbackProvider for GraphView { }; match state.layout_state.bounding_rect() { - Some(rect) if valid_bound(&rect) => rect.into(), + Some(rect) if valid_bound(&rect) => { + if let Some(rect_in_ui) = state.rect_in_ui { + let ui_from_world = fit_to_rect_in_scene(rect_in_ui, rect); + (ui_from_world.inverse() * rect_in_ui).into() + } else { + rect.into() + } + } _ => VisualBounds2D::default(), } } diff --git a/crates/viewer/re_view_graph/src/ui/state.rs b/crates/viewer/re_view_graph/src/ui/state.rs index 89cc2d232e6a..05eff3718fbc 100644 --- a/crates/viewer/re_view_graph/src/ui/state.rs +++ b/crates/viewer/re_view_graph/src/ui/state.rs @@ -1,4 +1,4 @@ -use egui::Rect; +use egui::{emath::TSTransform, Rect}; use re_format::format_f32; use re_types::blueprint::components::VisualBounds2D; use re_ui::UiExt; @@ -16,6 +16,8 @@ pub struct GraphViewState { pub show_debug: bool, pub visual_bounds: Option, + pub ui_from_world: Option, + pub rect_in_ui: Option, } impl GraphViewState { diff --git a/crates/viewer/re_view_graph/src/view.rs b/crates/viewer/re_view_graph/src/view.rs index ff18e5fde607..eaf2068663ee 100644 --- a/crates/viewer/re_view_graph/src/view.rs +++ b/crates/viewer/re_view_graph/src/view.rs @@ -168,6 +168,8 @@ Display a graph of nodes and edges. let state = state.downcast_mut::()?; + let params = ForceLayoutParams::get(ctx, query, self, state)?; + let bounds_property = ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, @@ -176,17 +178,28 @@ Display a graph of nodes and edges. let rect_in_scene: blueprint::components::VisualBounds2D = bounds_property.component_or_fallback(ctx, self, state)?; - let params = ForceLayoutParams::get(ctx, query, self, state)?; - - let rect_in_ui = ui.max_rect(); - + // Perform all layout-related tasks. let request = LayoutRequest::from_graphs(graphs.iter()); let layout_was_empty = state.layout_state.is_none(); let layout = state.layout_state.get(request, params); - let mut ui_from_world = fit_to_rect_in_scene(rect_in_ui, rect_in_scene.into()); + // Prepare the view and the transformations. + let prev_rect_in_ui = state.rect_in_ui; + let rect_in_ui = *state.rect_in_ui.insert(ui.max_rect()); + + let ui_from_world = state + .ui_from_world + .get_or_insert_with(|| fit_to_rect_in_scene(rect_in_ui, rect_in_scene.into())); + + // We ensure that the view's center is kept during resizing. + if let Some(prev) = prev_rect_in_ui { + if prev != rect_in_ui { + let delta = rect_in_ui.center() - prev.center(); + ui_from_world.translation += delta; + } + } - let resp = zoom_pan_area(ui, rect_in_ui, &mut ui_from_world, |ui| { + let resp = zoom_pan_area(ui, rect_in_ui, ui_from_world, |ui| { let mut world_bounding_rect = egui::Rect::NOTHING; for graph in &graphs { @@ -205,6 +218,7 @@ Display a graph of nodes and edges. blueprint::components::VisualBounds2D::from(ui_from_world.inverse() * rect_in_ui); if resp.double_clicked() || layout_was_empty { bounds_property.reset_blueprint_component::(ctx); + state.ui_from_world = None; } else if rect_in_scene != updated_rect_in_scene { bounds_property.save_blueprint_component(ctx, &updated_rect_in_scene); } diff --git a/docs/content/reference/types/archetypes/graph_edges.md b/docs/content/reference/types/archetypes/graph_edges.md index 8a14d6c11d70..47dc62ca7791 100644 --- a/docs/content/reference/types/archetypes/graph_edges.md +++ b/docs/content/reference/types/archetypes/graph_edges.md @@ -31,11 +31,23 @@ By default, edges are undirected. snippet: archetypes/graph_undirected - + + + + + + + ### Simple directed graph snippet: archetypes/graph_directed - + + + + + + + diff --git a/docs/content/reference/types/archetypes/graph_nodes.md b/docs/content/reference/types/archetypes/graph_nodes.md index 1bc0f1589ff2..c5b6d38ebab0 100644 --- a/docs/content/reference/types/archetypes/graph_nodes.md +++ b/docs/content/reference/types/archetypes/graph_nodes.md @@ -29,11 +29,23 @@ A list of nodes in a graph with optional labels, colors, etc. snippet: archetypes/graph_undirected - + + + + + + + ### Simple directed graph snippet: archetypes/graph_directed - + + + + + + + diff --git a/examples/rust/chess_robby_fischer/README.md b/examples/rust/chess_robby_fischer/README.md index a1309eae90fd..cdefec85040c 100644 --- a/examples/rust/chess_robby_fischer/README.md +++ b/examples/rust/chess_robby_fischer/README.md @@ -279,7 +279,7 @@ import rerun as rr import rerun.blueprint as rrb import argparse -space_view_defaults = [ +view_defaults = [ rr.components.AxisLength(0.0), # To hide the axes of all the transformations. rr.components.ImagePlaneDistance(0.3), ] @@ -305,11 +305,11 @@ blueprint = rrb.Blueprint( rrb.Spatial3DView( origin="/arm.urdf/base_link/glid_platta_1/bas_1/gemensam_vagg_1/botten_snurr_1/kortarm_kopia_1/led_1/led_axel_1/lang_arm_1/mount_1/ram_1", contents="/**", - defaults=space_view_defaults + defaults=view_defaults ) ), rrb.Spatial3DView( - defaults=space_view_defaults + defaults=view_defaults ), column_shares=[2,2,3] ), diff --git a/examples/rust/graph_lattice/README.md b/examples/rust/graph_lattice/README.md index c714a94be6e1..a4ebaa3a477f 100644 --- a/examples/rust/graph_lattice/README.md +++ b/examples/rust/graph_lattice/README.md @@ -1,3 +1,28 @@ -# graph_lattice + -Demonstrates graph layout of a lattice without explicit positions. +This example shows different attributes that you can associate with nodes in a graph. +Since no explicit positions are passed for the nodes, Rerun will layout the graph automatically. + + + + + + + + + +## Used Rerun types +[`GraphNodes`](https://www.rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link), +[`GraphEdges`](https://www.rerun.io/docs/reference/types/archetypes/graph_edges?speculative-link) + +## Run the code + +```bash +cargo run --release +``` diff --git a/rerun_cpp/src/rerun/blueprint.hpp b/rerun_cpp/src/rerun/blueprint.hpp deleted file mode 100644 index 6bcce6fd744d..000000000000 --- a/rerun_cpp/src/rerun/blueprint.hpp +++ /dev/null @@ -1,11 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs - -#pragma once - -#include "blueprint/auto_views.hpp" -#include "blueprint/entity_properties_component.hpp" -#include "blueprint/panel_view.hpp" -#include "blueprint/query_expressions.hpp" -#include "blueprint/space_view_component.hpp" -#include "blueprint/space_view_maximized.hpp" -#include "blueprint/viewport_layout.hpp" diff --git a/rerun_py/docs/gen_common_index.py b/rerun_py/docs/gen_common_index.py index da8d9dc6c073..4c106a2e6ce4 100755 --- a/rerun_py/docs/gen_common_index.py +++ b/rerun_py/docs/gen_common_index.py @@ -380,17 +380,15 @@ class Section: mod_path="rerun.utilities", show_submodules=True, ), - Section( - title="Experimental", - func_list=[ - "add_space_view", - "new_blueprint", - "set_auto_views", - "set_panels", - ], - show_tables=False, - mod_path="rerun.experimental", - ), + # We don't have any experimental apis right now, but when you add one again, you should add this here: + # Section( + # title="Experimental", + # func_list=[ + # "my_experimental_function", + # ], + # show_tables=False, + # mod_path="rerun.experimental", + # ), ] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/api.py b/rerun_py/rerun_sdk/rerun/blueprint/api.py index 9727a50b19df..c40b442ef1d2 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/api.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/api.py @@ -98,7 +98,7 @@ def blueprint_path(self) -> str: Note that although this is an `EntityPath`, is scoped to the blueprint tree and not a part of the regular data hierarchy. """ - return f"space_view/{self.id}" + return f"view/{self.id}" def to_container(self) -> Container: """Convert this view to a container.""" diff --git a/rerun_py/tests/unit/test_container_blueprint.py b/rerun_py/tests/unit/test_container_blueprint.py index c034ce7b5a99..494644d7e970 100644 --- a/rerun_py/tests/unit/test_container_blueprint.py +++ b/rerun_py/tests/unit/test_container_blueprint.py @@ -36,8 +36,8 @@ def test_container_blueprint() -> None: contents_arrays: Sequence[Any] = [ None, [], - ["space_view/1234", "container/5678"], - [EntityPath("space_view/1234"), EntityPath("container/5678")], + ["view/1234", "container/5678"], + [EntityPath("view/1234"), EntityPath("container/5678")], ] col_shares_arrays = [ @@ -54,9 +54,9 @@ def test_container_blueprint() -> None: active_tab_arrays = [ None, - "space_view/1234", - ActiveTab("space_view/1234"), - ActiveTab(EntityPath("space_view/1234")), + "view/1234", + ActiveTab("view/1234"), + ActiveTab(EntityPath("view/1234")), ] visible_arrays = [ diff --git a/rerun_py/tests/unit/test_view_contents.py b/rerun_py/tests/unit/test_view_contents.py index 93aa0e4ba5c2..ee54d77b4d1a 100644 --- a/rerun_py/tests/unit/test_view_contents.py +++ b/rerun_py/tests/unit/test_view_contents.py @@ -8,7 +8,7 @@ from rerun.datatypes.utf8 import Utf8ArrayLike -def test_space_view_contents() -> None: +def test_view_contents() -> None: query_array = [ [ "+ /**", From 89851ee26b99c7ff8d89cdc1678fdc0ac942f53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Wed, 11 Dec 2024 11:27:01 +0100 Subject: [PATCH 25/71] Improve Bezier edge-drawing (#8379) ### What This fixes a bug where the Bezier-edges would flip and start to intersect instead of fanning out properly. It also removes the hardcoded `fan_amount` and makes it dependent on the distance of the nodes. --- .../re_view_graph/src/layout/provider.rs | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/crates/viewer/re_view_graph/src/layout/provider.rs b/crates/viewer/re_view_graph/src/layout/provider.rs index 72c6b7a31f17..6f84d1ff3f67 100644 --- a/crates/viewer/re_view_graph/src/layout/provider.rs +++ b/crates/viewer/re_view_graph/src/layout/provider.rs @@ -218,9 +218,6 @@ impl ForceLayoutProvider { // Multiple edges occupy the same space, so we fan them out. let num_edges = edges.len(); - // Controls the amount of space (in scene coordinates) that a slot can occupy. - let fan_amount = 20.0; - for (i, edge) in edges.iter().enumerate() { let source_rect = layout.nodes[slot_source]; let target_rect = layout.nodes[slot_target]; @@ -230,24 +227,22 @@ impl ForceLayoutProvider { let source_pos = source_rect.intersects_ray_from_center(d); let target_pos = target_rect.intersects_ray_from_center(-d); - // How far along the edge should the control points be? - let c1_base = source_pos + (target_pos - source_pos) * 0.25; - let c2_base = source_pos + (target_pos - source_pos) * 0.75; + let delta = target_pos - source_pos; - let c1_base_n = Vec2::new(-c1_base.y, c1_base.x).normalized(); - let mut c2_base_n = Vec2::new(-c2_base.y, c2_base.x).normalized(); + // Controls the amount of space (in scene coordinates) that a slot can occupy. + let fan_amount = (delta.length() * 0.3).min(40.); + + // How far along the edge should the control points be? + let c1_base = source_pos + delta * 0.25; + let c2_base = source_pos + delta * 0.75; - // Make sure both point to the same side of the edge. - if c1_base_n.dot(c2_base_n) < 0.0 { - // If they point in opposite directions, flip one of them. - c2_base_n = -c2_base_n; - } + let base_n = Vec2::new(-c1_base.y, c1_base.x).normalized(); - let c1_left = c1_base + c1_base_n * (fan_amount / 2.); - let c2_left = c2_base + c2_base_n * (fan_amount / 2.); + let c1_left = c1_base + base_n * (fan_amount / 2.); + let c2_left = c2_base + base_n * (fan_amount / 2.); - let c1_right = c1_base - c1_base_n * (fan_amount / 2.); - let c2_right = c2_base - c2_base_n * (fan_amount / 2.); + let c1_right = c1_base - base_n * (fan_amount / 2.); + let c2_right = c2_base - base_n * (fan_amount / 2.); // Calculate an offset for the control points based on index `i`, spreading points equidistantly. let t = (i as f32) / (num_edges - 1) as f32; From 91256d787594500c67c8edfde71bc29b2741d5d8 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 11 Dec 2024 11:40:06 +0100 Subject: [PATCH 26/71] Simplify zoom-and-pan area (#8390) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Simplify the zoom-pan-view * Fix the zoom-pan-view eating the viewport highlight rectangle --------- Co-authored-by: Jochen Görtler --- crates/store/re_chunk_store/src/writes.rs | 2 +- crates/viewer/re_ui/src/zoom_pan_area.rs | 67 ++++++++++---------- crates/viewer/re_viewport/src/viewport_ui.rs | 11 +++- 3 files changed, 42 insertions(+), 38 deletions(-) diff --git a/crates/store/re_chunk_store/src/writes.rs b/crates/store/re_chunk_store/src/writes.rs index eee187b16a4f..1b888e7d94eb 100644 --- a/crates/store/re_chunk_store/src/writes.rs +++ b/crates/store/re_chunk_store/src/writes.rs @@ -47,7 +47,7 @@ impl ChunkStore { for (component_name, per_desc) in chunk.components().iter() { assert!( per_desc.len() <= 1, - "Insert Chunk with multiple values for component named `{component_name}`: this is currently UB", + "[DEBUG ONLY] Insert Chunk with multiple values for component named `{component_name}`: this is currently UB", ); } } diff --git a/crates/viewer/re_ui/src/zoom_pan_area.rs b/crates/viewer/re_ui/src/zoom_pan_area.rs index e3c6114e99d2..9dac80ce4130 100644 --- a/crates/viewer/re_ui/src/zoom_pan_area.rs +++ b/crates/viewer/re_ui/src/zoom_pan_area.rs @@ -5,7 +5,7 @@ //! * `view`-space: The space where the pan-and-zoom area is drawn. //! * `scene`-space: The space where the actual content is drawn. -use egui::{emath::TSTransform, Area, Order, Rect, Response, Ui, UiKind}; +use egui::{emath::TSTransform, Rect, Response, Ui, UiBuilder}; /// Helper function to handle pan and zoom interactions on a response. fn register_pan_and_zoom(ui: &Ui, resp: &Response, ui_from_scene: &mut TSTransform) { @@ -58,45 +58,42 @@ pub fn fit_to_rect_in_scene(rect_in_ui: Rect, rect_in_scene: Rect) -> TSTransfor /// Provides a zoom-pan area for a given view. pub fn zoom_pan_area( - ui: &Ui, + ui: &mut Ui, view_bounds_in_ui: Rect, ui_from_scene: &mut TSTransform, draw_contents: impl FnOnce(&mut Ui), ) -> Response { - let area_resp = Area::new(ui.id().with("zoom_pan_area")) - .constrain_to(view_bounds_in_ui) - .order(Order::Middle) - .kind(UiKind::GenericArea) - .show(ui.ctx(), |ui| { - // Transform to the scene space: - let visible_rect_in_scene = ui_from_scene.inverse() * view_bounds_in_ui; - - // set proper clip-rect so we can interact with the background. - ui.set_clip_rect(visible_rect_in_scene); - - // A Ui for sensing drag-to-pan, scroll-to-zoom, etc - let mut drag_sense_ui = ui.new_child( - egui::UiBuilder::new() - .sense(egui::Sense::click_and_drag()) - .max_rect(visible_rect_in_scene), - ); - drag_sense_ui.set_min_size(visible_rect_in_scene.size()); - let pan_response = drag_sense_ui.response(); - - // Update the transform based on the interactions: - register_pan_and_zoom(ui, &pan_response, ui_from_scene); - - // Update the clip-rect with the new transform, to avoid frame-delays - ui.set_clip_rect(ui_from_scene.inverse() * view_bounds_in_ui); - - // Add the actual contents to the area: - draw_contents(ui); - - pan_response - }); + let zoom_pan_layer_id = egui::LayerId::new(ui.layer_id().order, ui.id().with("zoom_pan_area")); + + // Put the layer directly on-top of the main layer of the ui: + ui.ctx().set_sublayer(ui.layer_id(), zoom_pan_layer_id); + + let mut ui = ui.new_child( + UiBuilder::new() + .layer_id(zoom_pan_layer_id) + .max_rect(view_bounds_in_ui) + .sense(egui::Sense::click_and_drag()), + ); + + // Transform to the scene space: + let visible_rect_in_scene = ui_from_scene.inverse() * view_bounds_in_ui; + + // set proper clip-rect so we can interact with the background: + ui.set_clip_rect(visible_rect_in_scene); + + let pan_response = ui.response(); + + // Update the transform based on the interactions: + register_pan_and_zoom(&ui, &pan_response, ui_from_scene); + + // Update the clip-rect with the new transform, to avoid frame-delays + ui.set_clip_rect(ui_from_scene.inverse() * view_bounds_in_ui); + + // Add the actual contents to the area: + draw_contents(&mut ui); ui.ctx() - .set_transform_layer(area_resp.response.layer_id, *ui_from_scene); + .set_transform_layer(zoom_pan_layer_id, *ui_from_scene); - area_resp.inner + pan_response } diff --git a/crates/viewer/re_viewport/src/viewport_ui.rs b/crates/viewer/re_viewport/src/viewport_ui.rs index cecfb4978699..417c313f6e4c 100644 --- a/crates/viewer/re_viewport/src/viewport_ui.rs +++ b/crates/viewer/re_viewport/src/viewport_ui.rs @@ -125,8 +125,15 @@ impl ViewportUi { continue; }; - ui.painter() - .rect_stroke(rect.shrink(stroke.width / 2.0), 0.0, stroke); + // We want the rectangle to be on top of everything in the viewport, + // including stuff in "zoom-pan areas", like we use in the graph view. + let top_layer_id = egui::LayerId::new(ui.layer_id().order, ui.id().with("child_id")); + ui.ctx().set_sublayer(ui.layer_id(), top_layer_id); // Make sure it is directly on top of the ui layer + + // We need to shrink a bit so the panel-resize lines don't cover the highlight rectangle. + // This is hacky. + ui.painter().clone().with_layer_id(top_layer_id) + .rect_stroke(rect.shrink(stroke.width), 0.0, stroke); } } From a7f11977ee697dcfd183a312685257d4cb01e453 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 11 Dec 2024 11:45:25 +0100 Subject: [PATCH 27/71] Don't show transform arrows on all entities without any other visualizer (#8387) Today, we automatically enable the transform arrow visualization if it is possible and EITHER: 1) explicitly done via blueprint 2) someone logged `axis_length` on their transform 3) there's a pinhole camera at the same path 4) there's no other visualizer that would be active on that path This PR simple removes case (4). Which leads to a lot less arrows in some scenes. Very prevalent e.g. with what Revy does. Before (0.20 without setting arrows to 0 length workaround): ![image](https://github.com/user-attachments/assets/ce971376-ef9b-4b29-8869-bdde0c0e556a) After: ![image](https://github.com/user-attachments/assets/0e168c07-ba91-454f-980b-6e295bdff011) --- crates/viewer/re_view_spatial/src/view_3d.rs | 23 ++++++++----------- .../reference/migration/migration-0-21.md | 13 +++++++++++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/crates/viewer/re_view_spatial/src/view_3d.rs b/crates/viewer/re_view_spatial/src/view_3d.rs index 08761f932fc1..64f0ca7aaf23 100644 --- a/crates/viewer/re_view_spatial/src/view_3d.rs +++ b/crates/viewer/re_view_spatial/src/view_3d.rs @@ -240,26 +240,23 @@ impl ViewClass for SpatialView3D { .collect(); // Start with all the entities which are both indicated and visualizable. - let mut chosen: SmallVisualizerSet = indicated + let mut enabled_visualizers: SmallVisualizerSet = indicated .intersection(&visualizable) .copied() .copied() .collect(); - // There are three cases where we want to activate the [`Transform3DArrowVisualizer`]: - // - If we have no visualizers, but otherwise meet the criteria for Transform3DArrows. - // - If someone set an axis_length explicitly, so [`AxisLengthDetector`] is applicable. - // - If we already have the [`CamerasVisualizer`] active. - if !chosen.contains(&arrows_viz) - && visualizable.contains(&arrows_viz) - && ((chosen.is_empty() && visualizable.contains(&arrows_viz)) - || applicable.contains(&axis_detector) - || chosen.contains(&camera_viz)) - { - chosen.push(arrows_viz); + // Arrow visualizer is not enabled yet but we could… + if !enabled_visualizers.contains(&arrows_viz) && visualizable.contains(&arrows_viz) { + // … then we enable it if either: + // - If someone set an axis_length explicitly, so [`AxisLengthDetector`] is applicable. + // - If we already have the [`CamerasVisualizer`] active. + if applicable.contains(&axis_detector) || enabled_visualizers.contains(&camera_viz) { + enabled_visualizers.push(arrows_viz); + } } - chosen + enabled_visualizers } fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> re_viewer_context::ViewSpawnHeuristics { diff --git a/docs/content/reference/migration/migration-0-21.md b/docs/content/reference/migration/migration-0-21.md index 84533be9690d..71f9397f22fa 100644 --- a/docs/content/reference/migration/migration-0-21.md +++ b/docs/content/reference/migration/migration-0-21.md @@ -52,3 +52,16 @@ This exclusively affects the Python blueprint sdk: * `SpaceViewClass` -> `ViewClass` * `SpaceViewOrigin` -> `ViewOrigin` * `SpaceViewMaximized` -> `ViewMaximized` + + +### 3D transform arrow visualization show up less often by default + +Previously, the viewer would show 3 arrows for every logged transform if any of the following was true: +* enabled visualizer via `VisualizerOverrides` or ui +* `AxisLength` component is present as well +* there's a pinhole camera at the same path +* no other visualizer would be active by default on the path + +For many usecases this led to too many arrows being shown by default. +We therefore removed the last condition - arrows will no longer show by default if they're the only visualizer. +The easiest way to opt-in to transform arrows is to set `AxisLength` (`axis_length` field on the `Transform3D` archetype) on your transforms. From d5dc2e00be894eb2648d5924f6b4c4d7595d89ab Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 11 Dec 2024 11:46:13 +0100 Subject: [PATCH 28/71] Fix previously missed space view renames, fix blueprint logging from python broken (#8407) Followup to * https://github.com/rerun-io/rerun/pull/8396 This actually caused python blueprint logging to break because it logged views (and their properties) on the wrong path! Testing: * [x] manually tested a python example with blueprint doing the right thing From eae0c03da0105f7212a32d9c04dac73d7c358025 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Wed, 11 Dec 2024 13:59:13 +0100 Subject: [PATCH 29/71] Enforce blueprint data is always untagged during the interim (#8409) We're in a transition period during which the Rerun ecosystem is slowly moving over to tagged data. During that time, it is common to end up in situations where the blueprint intermixes both tagged and untagged components, which invariably leads to undefined behavior. To prevent that, we just always hot-patch it to untagged, for now. Examples: * An SDK logs a blueprint (tagged), which is then updated by the viewer (which uses untagged log calls). * Somebody loads an old .rbl from somewhere and starts logging new blueprint data to it. * Etc. This fixes all known blueprint bugs from the last couple days. In the future, we will want to make sure that the viewer logs blueprint data with appropriate tags, which is part of the `log(MyArchetype.my_component())` story. The sooner the better, so that the ecosystem can start to converge on always-tagged blueprint files. --- crates/store/re_chunk/src/chunk.rs | 26 ++++++++++++ crates/store/re_chunk_store/src/query.rs | 5 ++- crates/store/re_chunk_store/src/writes.rs | 51 +++++++++++++---------- 3 files changed, 60 insertions(+), 22 deletions(-) diff --git a/crates/store/re_chunk/src/chunk.rs b/crates/store/re_chunk/src/chunk.rs index 7aa43f243100..8be91a42be96 100644 --- a/crates/store/re_chunk/src/chunk.rs +++ b/crates/store/re_chunk/src/chunk.rs @@ -414,6 +414,32 @@ impl Chunk { self } + /// Clones the chunk into a new chunk where all descriptors are untagged. + /// + /// Only useful as a migration tool while the Rerun ecosystem slowly moves over + /// to always using tags for everything. + #[doc(hidden)] + #[inline] + pub fn clone_as_untagged(&self) -> Self { + let mut chunk = self.clone(); + + let per_component_name = &mut chunk.components; + for (component_name, per_desc) in per_component_name.iter_mut() { + if per_desc.len() != 1 { + // If there are more than one entry, then we're in the land of UB anyway (for now). + continue; + } + + let untagged_descriptor = ComponentDescriptor::new(*component_name); + *per_desc = std::mem::take(per_desc) + .into_values() + .map(|list_array| (untagged_descriptor.clone(), list_array)) + .collect(); + } + + chunk + } + /// Clones the chunk into a new chunk where all [`RowId`]s are [`RowId::ZERO`]. pub fn zeroed(self) -> Self { let row_ids = std::iter::repeat(RowId::ZERO) diff --git a/crates/store/re_chunk_store/src/query.rs b/crates/store/re_chunk_store/src/query.rs index 76056b17f4de..228e4c601b51 100644 --- a/crates/store/re_chunk_store/src/query.rs +++ b/crates/store/re_chunk_store/src/query.rs @@ -592,7 +592,10 @@ impl ChunkStore { }) .unwrap_or_default(); - debug_assert!(chunks.iter().map(|chunk| chunk.id()).all_unique()); + debug_assert!( + chunks.iter().map(|chunk| chunk.id()).all_unique(), + "{entity_path}:{component_name} @ {query:?}", + ); chunks } diff --git a/crates/store/re_chunk_store/src/writes.rs b/crates/store/re_chunk_store/src/writes.rs index 1b888e7d94eb..db7c2f7cf1c3 100644 --- a/crates/store/re_chunk_store/src/writes.rs +++ b/crates/store/re_chunk_store/src/writes.rs @@ -37,21 +37,6 @@ impl ChunkStore { return Ok(Vec::new()); } - // NOTE: It is very easy to end in a situation where one pulls an old blueprint from - // somewhere, and then modifies it at runtime, therefore ending with both tagged and - // untagged components in the data. - // I'd like to keep this debug assertion a tiny bit longer just in case, so for we just - // ignore blueprints. - #[cfg(debug_assertions)] - if self.id.kind == re_log_types::StoreKind::Recording { - for (component_name, per_desc) in chunk.components().iter() { - assert!( - per_desc.len() <= 1, - "[DEBUG ONLY] Insert Chunk with multiple values for component named `{component_name}`: this is currently UB", - ); - } - } - if !chunk.is_sorted() { return Err(ChunkStoreError::UnsortedChunk); } @@ -64,7 +49,31 @@ impl ChunkStore { self.insert_id += 1; - let non_compacted_chunk = Arc::clone(chunk); // we'll need it to create the store event + let mut chunk = Arc::clone(chunk); + + // We're in a transition period during which the Rerun ecosystem is slowly moving over to tagged data. + // + // During that time, it is common to end up in situations where the blueprint intermixes both tagged + // and untagged components, which invariably leads to undefined behavior. + // To prevent that, we just always hot-patch it to untagged, for now. + // + // Examples: + // * An SDK logs a blueprint (tagged), which is then updated by the viewer (which uses untagged log calls). + // * Somebody loads an old .rbl from somewhere and starts logging new blueprint data to it. + // * Etc. + if self.id.kind == re_log_types::StoreKind::Blueprint { + chunk = Arc::new(chunk.clone_as_untagged()); + } + + #[cfg(debug_assertions)] + for (component_name, per_desc) in chunk.components().iter() { + assert!( + per_desc.len() <= 1, + "[DEBUG ONLY] Insert Chunk with multiple values for component named `{component_name}`: this is currently UB", + ); + } + + let non_compacted_chunk = Arc::clone(&chunk); // we'll need it to create the store event let (chunk, diffs) = if chunk.is_static() { // Static data: make sure to keep the most recent chunk available for each component column. @@ -140,7 +149,7 @@ impl ChunkStore { .or_insert_with(|| chunk.id()); } - self.static_chunks_stats += ChunkStoreChunkStats::from_chunk(chunk); + self.static_chunks_stats += ChunkStoreChunkStats::from_chunk(&chunk); let mut diffs = vec![ChunkStoreDiff::addition( non_compacted_chunk, /* added */ @@ -194,7 +203,7 @@ impl ChunkStore { } } - (Arc::clone(chunk), diffs) + (Arc::clone(&chunk), diffs) } else { // Temporal data: just index the chunk on every dimension of interest. re_tracing::profile_scope!("temporal"); @@ -202,7 +211,7 @@ impl ChunkStore { let (elected_chunk, chunk_or_compacted) = { re_tracing::profile_scope!("election"); - let elected_chunk = self.find_and_elect_compaction_candidate(chunk); + let elected_chunk = self.find_and_elect_compaction_candidate(&chunk); let chunk_or_compacted = if let Some(elected_chunk) = &elected_chunk { let chunk_rowid_min = chunk.row_id_range().map(|(min, _)| min); @@ -210,7 +219,7 @@ impl ChunkStore { let mut compacted = if elected_rowid_min < chunk_rowid_min { re_tracing::profile_scope!("concat"); - elected_chunk.concatenated(chunk)? + elected_chunk.concatenated(&chunk)? } else { re_tracing::profile_scope!("concat"); chunk.concatenated(elected_chunk)? @@ -233,7 +242,7 @@ impl ChunkStore { Arc::new(compacted) } else { - Arc::clone(chunk) + Arc::clone(&chunk) }; (elected_chunk, chunk_or_compacted) From 4e3e24a320c841cb84f4f987bde3bef3972c50e2 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 11 Dec 2024 13:59:42 +0100 Subject: [PATCH 30/71] New `PerStoreStoreSubscriber` wrapper to remove store tracking boilerplate (#8400) Most store subscribers don't need a view over all stores. This removes this indirection from a whole bunch of store subscriber implementors and moves it into a utility. --- crates/store/re_chunk_store/src/lib.rs | 4 +- .../store/re_chunk_store/src/subscribers.rs | 131 +++++++++++ .../re_time_panel/src/data_density_graph.rs | 50 +++-- crates/viewer/re_time_panel/src/lib.rs | 4 +- ...ecursive_chunks_per_timeline_subscriber.rs | 205 ++++++++---------- .../src/contexts/transform_context.rs | 5 +- .../src/max_image_dimension_subscriber.rs | 52 ++--- .../src/transform_component_tracker.rs | 78 ++----- crates/viewer/re_view_spatial/src/view_2d.rs | 11 +- 9 files changed, 298 insertions(+), 242 deletions(-) diff --git a/crates/store/re_chunk_store/src/lib.rs b/crates/store/re_chunk_store/src/lib.rs index 061a07818d4b..14921f45157c 100644 --- a/crates/store/re_chunk_store/src/lib.rs +++ b/crates/store/re_chunk_store/src/lib.rs @@ -39,7 +39,9 @@ pub use self::stats::{ChunkStoreChunkStats, ChunkStoreStats}; pub use self::store::{ ChunkStore, ChunkStoreConfig, ChunkStoreGeneration, ChunkStoreHandle, ColumnMetadata, }; -pub use self::subscribers::{ChunkStoreSubscriber, ChunkStoreSubscriberHandle}; +pub use self::subscribers::{ + ChunkStoreSubscriber, ChunkStoreSubscriberHandle, PerStoreChunkSubscriber, +}; pub(crate) use self::store::ColumnMetadataState; diff --git a/crates/store/re_chunk_store/src/subscribers.rs b/crates/store/re_chunk_store/src/subscribers.rs index 1d375bd58912..46bd5bac5fa2 100644 --- a/crates/store/re_chunk_store/src/subscribers.rs +++ b/crates/store/re_chunk_store/src/subscribers.rs @@ -1,4 +1,7 @@ +use ahash::HashMap; +use itertools::Itertools as _; use parking_lot::RwLock; +use re_log_types::StoreId; use crate::{ChunkStore, ChunkStoreEvent}; @@ -57,6 +60,20 @@ pub trait ChunkStoreSubscriber: std::any::Any + Send + Sync { fn on_events(&mut self, events: &[ChunkStoreEvent]); } +/// A [`ChunkStoreSubscriber`] that is instantiated for each unique [`StoreId`]. +pub trait PerStoreChunkSubscriber: Send + Sync + Default { + /// Arbitrary name for the subscriber. + /// + /// Does not need to be unique. + fn name() -> String; + + /// Get notified of changes happening in a [`ChunkStore`], see [`ChunkStoreSubscriber::on_events`]. + /// + /// Unlike [`ChunkStoreSubscriber::on_events`], all items are guaranteed to have the same [`StoreId`] + /// which does not change per invocation. + fn on_events<'a>(&mut self, events: impl Iterator); +} + /// All registered [`ChunkStoreSubscriber`]s. static SUBSCRIBERS: once_cell::sync::Lazy>> = once_cell::sync::Lazy::new(|| RwLock::new(Vec::new())); @@ -143,6 +160,79 @@ impl ChunkStore { }) } + /// Registers a [`PerStoreChunkSubscriber`] type so it gets automatically notified when data gets added and/or + /// removed to/from a [`ChunkStore`]. + pub fn register_per_store_subscriber( + ) -> ChunkStoreSubscriberHandle { + let mut subscribers = SUBSCRIBERS.write(); + subscribers.push(RwLock::new(Box::new( + PerStoreStoreSubscriberWrapper::::default(), + ))); + ChunkStoreSubscriberHandle(subscribers.len() as u32 - 1) + } + + /// Passes a reference to the downcasted per-store subscriber to the given `FnMut` callback. + /// + /// Returns `None` if the subscriber doesn't exist or downcasting failed. + pub fn with_per_store_subscriber T>( + ChunkStoreSubscriberHandle(handle): ChunkStoreSubscriberHandle, + store_id: &StoreId, + mut f: F, + ) -> Option { + let subscribers = SUBSCRIBERS.read(); + subscribers.get(handle as usize).and_then(|subscriber| { + let subscriber = subscriber.read(); + subscriber + .as_any() + .downcast_ref::>() + .and_then(|wrapper| wrapper.get(store_id).map(&mut f)) + }) + } + + /// Passes a reference to the downcasted per-store subscriber to the given `FnOnce` callback. + /// + /// Returns `None` if the subscriber doesn't exist or downcasting failed. + pub fn with_per_store_subscriber_once< + S: PerStoreChunkSubscriber + 'static, + T, + F: FnOnce(&S) -> T, + >( + ChunkStoreSubscriberHandle(handle): ChunkStoreSubscriberHandle, + store_id: &StoreId, + f: F, + ) -> Option { + let subscribers = SUBSCRIBERS.read(); + subscribers.get(handle as usize).and_then(|subscriber| { + let subscriber = subscriber.read(); + subscriber + .as_any() + .downcast_ref::>() + .and_then(|wrapper| wrapper.get(store_id).map(f)) + }) + } + + /// Passes a mutable reference to the downcasted per-store subscriber to the given callback. + /// + /// Returns `None` if the subscriber doesn't exist or downcasting failed. + pub fn with_per_store_subscriber_mut< + S: PerStoreChunkSubscriber + 'static, + T, + F: FnMut(&mut S) -> T, + >( + ChunkStoreSubscriberHandle(handle): ChunkStoreSubscriberHandle, + store_id: &StoreId, + mut f: F, + ) -> Option { + let subscribers = SUBSCRIBERS.read(); + subscribers.get(handle as usize).and_then(|subscriber| { + let mut subscriber = subscriber.write(); + subscriber + .as_any_mut() + .downcast_mut::>() + .and_then(|wrapper| wrapper.get_mut(store_id).map(&mut f)) + }) + } + /// Called by [`ChunkStore`]'s mutating methods to notify subscriber subscribers of upcoming events. pub(crate) fn on_events(events: &[ChunkStoreEvent]) { re_tracing::profile_function!(); @@ -154,6 +244,47 @@ impl ChunkStore { } } +/// Utility that makes a [`PerStoreChunkSubscriber`] a [`ChunkStoreSubscriber`]. +#[derive(Default)] +struct PerStoreStoreSubscriberWrapper { + subscribers: HashMap>, +} + +impl PerStoreStoreSubscriberWrapper { + fn get(&self, store_id: &StoreId) -> Option<&S> { + self.subscribers.get(store_id).map(|s| s.as_ref()) + } + + fn get_mut(&mut self, store_id: &StoreId) -> Option<&mut S> { + self.subscribers.get_mut(store_id).map(|s| s.as_mut()) + } +} + +impl ChunkStoreSubscriber + for PerStoreStoreSubscriberWrapper +{ + fn name(&self) -> String { + S::name() + } + + fn as_any(&self) -> &dyn std::any::Any { + self + } + + fn as_any_mut(&mut self) -> &mut dyn std::any::Any { + self + } + + fn on_events(&mut self, events: &[ChunkStoreEvent]) { + for (store_id, events) in &events.iter().chunk_by(|e| e.store_id.clone()) { + self.subscribers + .entry(store_id) + .or_default() + .on_events(events); + } + } +} + #[cfg(test)] mod tests { use std::sync::Arc; diff --git a/crates/viewer/re_time_panel/src/data_density_graph.rs b/crates/viewer/re_time_panel/src/data_density_graph.rs index 4988384ca621..89a7487c99b5 100644 --- a/crates/viewer/re_time_panel/src/data_density_graph.rs +++ b/crates/viewer/re_time_panel/src/data_density_graph.rs @@ -14,7 +14,7 @@ use re_chunk_store::RangeQuery; use re_log_types::{ComponentPath, ResolvedTimeRange, TimeInt, Timeline}; use re_viewer_context::{Item, TimeControl, UiLayout, ViewerContext}; -use crate::recursive_chunks_per_timeline_subscriber::PathRecursiveChunksPerTimeline; +use crate::recursive_chunks_per_timeline_subscriber::PathRecursiveChunksPerTimelineStoreSubscriber; use crate::TimePanelItem; use super::time_ranges_ui::TimeRangesUi; @@ -472,27 +472,33 @@ pub fn build_density_graph<'a>( total_num_events, ) } else { - PathRecursiveChunksPerTimeline::access(&store.id(), |chunks_per_timeline| { - let Some(info) = chunks_per_timeline - .path_recursive_chunks_for_entity_and_timeline(&item.entity_path, &timeline) - else { - return Default::default(); - }; - - ( - info.recursive_chunks_info - .values() - .map(|info| { - ( - info.chunk.clone(), - info.resolved_time_range, - info.num_events, - ) - }) - .collect(), - info.total_num_events, - ) - }) + PathRecursiveChunksPerTimelineStoreSubscriber::access( + &store.id(), + |chunks_per_timeline| { + let Some(info) = chunks_per_timeline + .path_recursive_chunks_for_entity_and_timeline( + &item.entity_path, + &timeline, + ) + else { + return Default::default(); + }; + + ( + info.recursive_chunks_info + .values() + .map(|info| { + ( + info.chunk.clone(), + info.resolved_time_range, + info.num_events, + ) + }) + .collect(), + info.total_num_events, + ) + }, + ) .unwrap_or_default() } }; diff --git a/crates/viewer/re_time_panel/src/lib.rs b/crates/viewer/re_time_panel/src/lib.rs index 9393b2b01db2..f10c0e9e420c 100644 --- a/crates/viewer/re_time_panel/src/lib.rs +++ b/crates/viewer/re_time_panel/src/lib.rs @@ -33,7 +33,7 @@ use re_viewer_context::{ }; use re_viewport_blueprint::ViewportBlueprint; -use recursive_chunks_per_timeline_subscriber::PathRecursiveChunksPerTimeline; +use recursive_chunks_per_timeline_subscriber::PathRecursiveChunksPerTimelineStoreSubscriber; use time_axis::TimelineAxis; use time_control_ui::TimeControlUi; use time_ranges_ui::TimeRangesUi; @@ -147,7 +147,7 @@ impl TimePanel { /// This is implicitly called by [`Self::default`], but may need to be explicitly called in, /// e.g., testing context. pub fn ensure_registered_subscribers() { - PathRecursiveChunksPerTimeline::ensure_registered(); + PathRecursiveChunksPerTimelineStoreSubscriber::ensure_registered(); } pub fn new_blueprint_panel() -> Self { diff --git a/crates/viewer/re_time_panel/src/recursive_chunks_per_timeline_subscriber.rs b/crates/viewer/re_time_panel/src/recursive_chunks_per_timeline_subscriber.rs index 6cd5020118f3..ab5fa472e52b 100644 --- a/crates/viewer/re_time_panel/src/recursive_chunks_per_timeline_subscriber.rs +++ b/crates/viewer/re_time_panel/src/recursive_chunks_per_timeline_subscriber.rs @@ -5,7 +5,8 @@ use nohash_hasher::IntMap; use once_cell::sync::OnceCell; use re_chunk_store::{ - Chunk, ChunkId, ChunkStore, ChunkStoreEvent, ChunkStoreSubscriber, ChunkStoreSubscriberHandle, + Chunk, ChunkId, ChunkStore, ChunkStoreEvent, ChunkStoreSubscriberHandle, + PerStoreChunkSubscriber, }; use re_log_types::{EntityPath, EntityPathHash, ResolvedTimeRange, StoreId, Timeline}; @@ -40,25 +41,27 @@ pub struct EntityTimelineChunks { /// For each entity & timeline, keeps track of all its chunks and chunks of its children. #[derive(Default)] -pub struct PathRecursiveChunksPerTimeline { +pub struct PathRecursiveChunksPerTimelineStoreSubscriber { chunks_per_timeline_per_entity: IntMap>, } -impl PathRecursiveChunksPerTimeline { +impl PathRecursiveChunksPerTimelineStoreSubscriber { pub fn ensure_registered() { - PathRecursiveChunksPerTimelineStoreSubscriber::subscription_handle(); + Self::subscription_handle(); + } + + /// Accesses the global store subscriber. + /// + /// Lazily registers the subscriber if it hasn't been registered yet. + pub fn subscription_handle() -> ChunkStoreSubscriberHandle { + static SUBSCRIPTION: OnceCell = OnceCell::new(); + *SUBSCRIPTION.get_or_init(ChunkStore::register_per_store_subscriber::) } /// Accesses the chunk #[inline] pub fn access(store_id: &StoreId, f: impl FnOnce(&Self) -> T) -> Option { - ChunkStore::with_subscriber_once( - PathRecursiveChunksPerTimelineStoreSubscriber::subscription_handle(), - move |subscriber: &PathRecursiveChunksPerTimelineStoreSubscriber| { - subscriber.per_store.get(store_id).map(f) - }, - ) - .flatten() + ChunkStore::with_per_store_subscriber_once(Self::subscription_handle(), store_id, f) } pub fn path_recursive_chunks_for_entity_and_timeline( @@ -70,132 +73,103 @@ impl PathRecursiveChunksPerTimeline { .get(timeline)? .get(&entity_path.hash()) } -} -#[derive(Default)] -struct PathRecursiveChunksPerTimelineStoreSubscriber { - per_store: HashMap, -} + fn add_chunk(&mut self, chunk: &Arc) { + re_tracing::profile_function!(); -impl PathRecursiveChunksPerTimelineStoreSubscriber { - /// Accesses the global store subscriber. - /// - /// Lazily registers the subscriber if it hasn't been registered yet. - pub fn subscription_handle() -> ChunkStoreSubscriberHandle { - static SUBSCRIPTION: OnceCell = OnceCell::new(); - *SUBSCRIPTION.get_or_init(|| ChunkStore::register_subscriber(Box::::default())) - } -} + for (timeline, time_column) in chunk.timelines() { + let chunks_per_entities = self + .chunks_per_timeline_per_entity + .entry(*timeline) + .or_default(); -impl ChunkStoreSubscriber for PathRecursiveChunksPerTimelineStoreSubscriber { - #[inline] - fn name(&self) -> String { - "rerun.store_subscriber.PathRecursiveChunksPerTimeline".into() + let chunk_info = ChunkTimelineInfo { + chunk: chunk.clone(), + num_events: chunk.num_events_cumulative(), // TODO(andreas): Would `num_events_cumulative_per_unique_time` be more appropriate? + resolved_time_range: time_column.time_range(), + }; + + // Recursively add chunks. + let mut next_path = Some(chunk.entity_path().clone()); + while let Some(path) = next_path { + let chunks_per_entity = chunks_per_entities.entry(path.hash()).or_default(); + + chunks_per_entity + .recursive_chunks_info + .insert(chunk.id(), chunk_info.clone()); + chunks_per_entity.total_num_events += chunk_info.num_events; + next_path = path.parent(); + } + } } - #[inline] - fn as_any(&self) -> &dyn std::any::Any { - self + fn remove_chunk(&mut self, chunk: &Chunk) { + re_tracing::profile_function!(); + + for timeline in chunk.timelines().keys() { + let Some(chunks_per_entities) = self.chunks_per_timeline_per_entity.get_mut(timeline) + else { + continue; + }; + + // Recursively remove chunks. + let mut next_path = Some(chunk.entity_path().clone()); + while let Some(path) = next_path { + if let Some(chunks_per_entity) = chunks_per_entities.get_mut(&path.hash()) { + if chunks_per_entity + .recursive_chunks_info + .remove(&chunk.id()) + .is_some() + { + if let Some(new_total_num_events) = chunks_per_entity + .total_num_events + .checked_sub(chunk.num_events_cumulative()) + { + chunks_per_entity.total_num_events = new_total_num_events; + } else { + re_log::error_once!( + "Total number of recursive events for {:?} for went negative", + path + ); + } + } + } + next_path = path.parent(); + } + } } +} +impl PerStoreChunkSubscriber for PathRecursiveChunksPerTimelineStoreSubscriber { #[inline] - fn as_any_mut(&mut self) -> &mut dyn std::any::Any { - self + fn name() -> String { + "rerun.store_subscriber.PathRecursiveChunksPerTimeline".into() } #[inline] - fn on_events(&mut self, events: &[ChunkStoreEvent]) { + fn on_events<'a>(&mut self, events: impl Iterator) { re_tracing::profile_function!(); for event in events { - let path_recursive_chunks = self.per_store.entry(event.store_id.clone()).or_default(); - if let Some(re_chunk_store::ChunkCompactionReport { srcs: compacted_chunks, new_chunk, }) = &event.diff.compacted { for removed_chunk in compacted_chunks.values() { - remove_chunk(path_recursive_chunks, removed_chunk); + self.remove_chunk(removed_chunk); } - add_chunk(path_recursive_chunks, new_chunk); + self.add_chunk(new_chunk); } else { match event.diff.kind { re_chunk_store::ChunkStoreDiffKind::Addition => { - add_chunk(path_recursive_chunks, &event.chunk); + self.add_chunk(&event.chunk); } re_chunk_store::ChunkStoreDiffKind::Deletion => { - remove_chunk(path_recursive_chunks, &event.chunk); - } - } - } - } - } -} - -fn add_chunk(path_recursive_chunks: &mut PathRecursiveChunksPerTimeline, chunk: &Arc) { - re_tracing::profile_function!(); - - for (timeline, time_column) in chunk.timelines() { - let chunks_per_entities = path_recursive_chunks - .chunks_per_timeline_per_entity - .entry(*timeline) - .or_default(); - - let chunk_info = ChunkTimelineInfo { - chunk: chunk.clone(), - num_events: chunk.num_events_cumulative(), // TODO(andreas): Would `num_events_cumulative_per_unique_time` be more appropriate? - resolved_time_range: time_column.time_range(), - }; - - // Recursively add chunks. - let mut next_path = Some(chunk.entity_path().clone()); - while let Some(path) = next_path { - let chunks_per_entity = chunks_per_entities.entry(path.hash()).or_default(); - - chunks_per_entity - .recursive_chunks_info - .insert(chunk.id(), chunk_info.clone()); - chunks_per_entity.total_num_events += chunk_info.num_events; - next_path = path.parent(); - } - } -} - -fn remove_chunk(path_recursive_chunks: &mut PathRecursiveChunksPerTimeline, chunk: &Chunk) { - re_tracing::profile_function!(); - - for timeline in chunk.timelines().keys() { - let Some(chunks_per_entities) = path_recursive_chunks - .chunks_per_timeline_per_entity - .get_mut(timeline) - else { - continue; - }; - - // Recursively remove chunks. - let mut next_path = Some(chunk.entity_path().clone()); - while let Some(path) = next_path { - if let Some(chunks_per_entity) = chunks_per_entities.get_mut(&path.hash()) { - if chunks_per_entity - .recursive_chunks_info - .remove(&chunk.id()) - .is_some() - { - if let Some(new_total_num_events) = chunks_per_entity - .total_num_events - .checked_sub(chunk.num_events_cumulative()) - { - chunks_per_entity.total_num_events = new_total_num_events; - } else { - re_log::error_once!( - "Total number of recursive events for {:?} for went negative", - path - ); + self.remove_chunk(&event.chunk); } } } - next_path = path.parent(); } } } @@ -209,10 +183,7 @@ mod tests { example_components::MyPoint, ResolvedTimeRange, StoreId, TimeInt, Timeline, }; - use super::{ - EntityTimelineChunks, PathRecursiveChunksPerTimeline, - PathRecursiveChunksPerTimelineStoreSubscriber, - }; + use super::{EntityTimelineChunks, PathRecursiveChunksPerTimelineStoreSubscriber}; #[test] fn path_recursive_chunks_per_timeline() -> anyhow::Result<()> { @@ -258,7 +229,7 @@ mod tests { ))?; assert_eq!( - PathRecursiveChunksPerTimeline::access(&store.id(), |subs| { + PathRecursiveChunksPerTimelineStoreSubscriber::access(&store.id(), |subs| { test_subscriber_status_before_removal(subs, t0, t1) }), Some(Some(())) @@ -276,7 +247,7 @@ mod tests { }); assert_eq!( - PathRecursiveChunksPerTimeline::access(&store.id(), |subs| { + PathRecursiveChunksPerTimelineStoreSubscriber::access(&store.id(), |subs| { test_subscriber_status_after_t0_child_chunk_removal(subs, t0, t1) }), Some(Some(())) @@ -286,7 +257,7 @@ mod tests { } fn test_subscriber_status_before_removal( - subs: &PathRecursiveChunksPerTimeline, + subs: &PathRecursiveChunksPerTimelineStoreSubscriber, t0: Timeline, t1: Timeline, ) -> Option<()> { @@ -313,7 +284,7 @@ mod tests { } fn test_subscriber_status_after_t0_child_chunk_removal( - subs: &PathRecursiveChunksPerTimeline, + subs: &PathRecursiveChunksPerTimelineStoreSubscriber, t0: Timeline, t1: Timeline, ) -> Option<()> { @@ -340,7 +311,7 @@ mod tests { } fn test_paths_without_chunks( - subs: &PathRecursiveChunksPerTimeline, + subs: &PathRecursiveChunksPerTimelineStoreSubscriber, child_t0: &EntityTimelineChunks, child_t1: &EntityTimelineChunks, t0: Timeline, diff --git a/crates/viewer/re_view_spatial/src/contexts/transform_context.rs b/crates/viewer/re_view_spatial/src/contexts/transform_context.rs index 2c088526cf2d..20122a8313ed 100644 --- a/crates/viewer/re_view_spatial/src/contexts/transform_context.rs +++ b/crates/viewer/re_view_spatial/src/contexts/transform_context.rs @@ -17,7 +17,8 @@ use re_viewer_context::{IdentifiedViewSystem, ViewContext, ViewContextSystem}; use vec1::smallvec_v1::SmallVec1; use crate::{ - transform_component_tracker::TransformComponentTracker, visualizers::image_view_coordinates, + transform_component_tracker::TransformComponentTrackerStoreSubscriber, + visualizers::image_view_coordinates, }; #[derive(Clone, Debug)] @@ -736,7 +737,7 @@ fn transforms_at( re_tracing::profile_function!(); let potential_transform_components = - TransformComponentTracker::access(&entity_db.store_id(), |tracker| { + TransformComponentTrackerStoreSubscriber::access(&entity_db.store_id(), |tracker| { tracker.potential_transform_components(entity_path).cloned() }) .flatten() diff --git a/crates/viewer/re_view_spatial/src/max_image_dimension_subscriber.rs b/crates/viewer/re_view_spatial/src/max_image_dimension_subscriber.rs index 26485456d7c5..735cba3f50ff 100644 --- a/crates/viewer/re_view_spatial/src/max_image_dimension_subscriber.rs +++ b/crates/viewer/re_view_spatial/src/max_image_dimension_subscriber.rs @@ -1,9 +1,8 @@ -use ahash::HashMap; use arrow2::array::Array; use nohash_hasher::IntMap; use once_cell::sync::OnceCell; -use re_chunk_store::{ChunkStore, ChunkStoreSubscriber, ChunkStoreSubscriberHandle}; +use re_chunk_store::{ChunkStore, ChunkStoreSubscriberHandle, PerStoreChunkSubscriber}; use re_log_types::{EntityPath, StoreId}; use re_types::{ components::{Blob, ImageFormat, MediaType}, @@ -18,57 +17,42 @@ pub struct MaxDimensions { } /// The size of the largest image and/or video at a given entity path. -#[derive(Default, Debug, Clone)] -pub struct MaxImageDimensions(IntMap); +#[derive(Default, Clone)] +pub struct MaxImageDimensionsStoreSubscriber { + max_dimensions: IntMap, +} -impl MaxImageDimensions { +impl MaxImageDimensionsStoreSubscriber { /// Accesses the image/video dimension information for a given store pub fn access( store_id: &StoreId, f: impl FnOnce(&IntMap) -> T, ) -> Option { - ChunkStore::with_subscriber_once( - MaxImageDimensionSubscriber::subscription_handle(), - move |subscriber: &MaxImageDimensionSubscriber| { - subscriber.max_dimensions.get(store_id).map(|v| &v.0).map(f) - }, + ChunkStore::with_per_store_subscriber_once( + Self::subscription_handle(), + store_id, + move |subscriber: &Self| f(&subscriber.max_dimensions), ) - .flatten() } } -#[derive(Default)] -pub struct MaxImageDimensionSubscriber { - max_dimensions: HashMap, -} - -impl MaxImageDimensionSubscriber { +impl MaxImageDimensionsStoreSubscriber { /// Accesses the global store subscriber. /// /// Lazily registers the subscriber if it hasn't been registered yet. pub fn subscription_handle() -> ChunkStoreSubscriberHandle { static SUBSCRIPTION: OnceCell = OnceCell::new(); - *SUBSCRIPTION.get_or_init(|| ChunkStore::register_subscriber(Box::::default())) + *SUBSCRIPTION.get_or_init(ChunkStore::register_per_store_subscriber::) } } -impl ChunkStoreSubscriber for MaxImageDimensionSubscriber { +impl PerStoreChunkSubscriber for MaxImageDimensionsStoreSubscriber { #[inline] - fn name(&self) -> String { + fn name() -> String { "MaxImageDimensionStoreSubscriber".to_owned() } - #[inline] - fn as_any(&self) -> &dyn std::any::Any { - self - } - - #[inline] - fn as_any_mut(&mut self) -> &mut dyn std::any::Any { - self - } - - fn on_events(&mut self, events: &[re_chunk_store::ChunkStoreEvent]) { + fn on_events<'a>(&mut self, events: impl Iterator) { re_tracing::profile_function!(); for event in events { @@ -92,9 +76,6 @@ impl ChunkStoreSubscriber for MaxImageDimensionSubscriber { }) { let max_dim = self .max_dimensions - .entry(event.store_id.clone()) - .or_default() - .0 .entry(event.diff.chunk.entity_path().clone()) .or_default(); @@ -113,9 +94,6 @@ impl ChunkStoreSubscriber for MaxImageDimensionSubscriber { { let max_dim = self .max_dimensions - .entry(event.store_id.clone()) - .or_default() - .0 .entry(event.diff.chunk.entity_path().clone()) .or_default(); max_dim.width = max_dim.width.max(width); diff --git a/crates/viewer/re_view_spatial/src/transform_component_tracker.rs b/crates/viewer/re_view_spatial/src/transform_component_tracker.rs index 316dd56db713..bd46be0560cd 100644 --- a/crates/viewer/re_view_spatial/src/transform_component_tracker.rs +++ b/crates/viewer/re_view_spatial/src/transform_component_tracker.rs @@ -1,10 +1,9 @@ -use ahash::HashMap; use once_cell::sync::OnceCell; use nohash_hasher::{IntMap, IntSet}; use re_chunk_store::{ - ChunkStore, ChunkStoreDiffKind, ChunkStoreEvent, ChunkStoreSubscriber, - ChunkStoreSubscriberHandle, + ChunkStore, ChunkStoreDiffKind, ChunkStoreEvent, ChunkStoreSubscriberHandle, + PerStoreChunkSubscriber, }; use re_log_types::{EntityPath, EntityPathHash, StoreId}; use re_types::{Component as _, ComponentName}; @@ -34,40 +33,12 @@ pub struct PotentialTransformComponentSet { /// for the fixed overhead of all the query layers when we know for a fact that there won't be any /// data there. /// This is a huge performance improvement in practice, especially in recordings with many entities. -#[derive(Default)] -pub struct TransformComponentTracker { - components_per_entity: IntMap, -} - -impl TransformComponentTracker { - /// Accesses the transform component tracking data for a given store. - #[inline] - pub fn access(store_id: &StoreId, f: impl FnOnce(&Self) -> T) -> Option { - ChunkStore::with_subscriber_once( - TransformComponentTrackerStoreSubscriber::subscription_handle(), - move |subscriber: &TransformComponentTrackerStoreSubscriber| { - subscriber.per_store.get(store_id).map(f) - }, - ) - .flatten() - } - - pub fn potential_transform_components( - &self, - entity_path: &EntityPath, - ) -> Option<&PotentialTransformComponentSet> { - self.components_per_entity.get(&entity_path.hash()) - } -} - -// --- - pub struct TransformComponentTrackerStoreSubscriber { /// The components of interest. transform_components: IntSet, pose_components: IntSet, - per_store: HashMap, + components_per_entity: IntMap, } impl Default for TransformComponentTrackerStoreSubscriber { @@ -83,7 +54,7 @@ impl Default for TransformComponentTrackerStoreSubscriber { .iter() .map(|descr| descr.component_name) .collect(), - per_store: Default::default(), + components_per_entity: Default::default(), } } } @@ -94,37 +65,36 @@ impl TransformComponentTrackerStoreSubscriber { /// Lazily registers the subscriber if it hasn't been registered yet. pub fn subscription_handle() -> ChunkStoreSubscriberHandle { static SUBSCRIPTION: OnceCell = OnceCell::new(); - *SUBSCRIPTION.get_or_init(|| ChunkStore::register_subscriber(Box::::default())) + *SUBSCRIPTION.get_or_init(ChunkStore::register_per_store_subscriber::) } -} -impl ChunkStoreSubscriber for TransformComponentTrackerStoreSubscriber { + /// Accesses the transform component tracking data for a given store. #[inline] - fn name(&self) -> String { - "rerun.store_subscriber.TransformComponentTracker".into() + pub fn access(store_id: &StoreId, f: impl FnOnce(&Self) -> T) -> Option { + ChunkStore::with_per_store_subscriber_once(Self::subscription_handle(), store_id, f) } - #[inline] - fn as_any(&self) -> &dyn std::any::Any { - self + pub fn potential_transform_components( + &self, + entity_path: &EntityPath, + ) -> Option<&PotentialTransformComponentSet> { + self.components_per_entity.get(&entity_path.hash()) } +} +impl PerStoreChunkSubscriber for TransformComponentTrackerStoreSubscriber { #[inline] - fn as_any_mut(&mut self) -> &mut dyn std::any::Any { - self + fn name() -> String { + "rerun.store_subscriber.TransformComponentTracker".into() } - fn on_events(&mut self, events: &[ChunkStoreEvent]) { + fn on_events<'a>(&mut self, events: impl Iterator) { re_tracing::profile_function!(); for event in events - .iter() // This is only additive, don't care about removals. .filter(|e| e.kind == ChunkStoreDiffKind::Addition) { - let transform_component_tracker = - self.per_store.entry(event.store_id.clone()).or_default(); - let entity_path_hash = event.chunk.entity_path().hash(); let contains_non_zero_component_array = |component_name| { @@ -143,8 +113,7 @@ impl ChunkStoreSubscriber for TransformComponentTrackerStoreSubscriber { if self.transform_components.contains(&component_name) && contains_non_zero_component_array(component_name) { - transform_component_tracker - .components_per_entity + self.components_per_entity .entry(entity_path_hash) .or_default() .transform3d @@ -153,8 +122,7 @@ impl ChunkStoreSubscriber for TransformComponentTrackerStoreSubscriber { if self.pose_components.contains(&component_name) && contains_non_zero_component_array(component_name) { - transform_component_tracker - .components_per_entity + self.components_per_entity .entry(entity_path_hash) .or_default() .pose3d @@ -163,8 +131,7 @@ impl ChunkStoreSubscriber for TransformComponentTrackerStoreSubscriber { if component_name == re_types::components::PinholeProjection::name() && contains_non_zero_component_array(component_name) { - transform_component_tracker - .components_per_entity + self.components_per_entity .entry(entity_path_hash) .or_default() .pinhole = true; @@ -172,8 +139,7 @@ impl ChunkStoreSubscriber for TransformComponentTrackerStoreSubscriber { if component_name == re_types::components::DisconnectedSpace::name() && contains_non_zero_component_array(component_name) { - transform_component_tracker - .components_per_entity + self.components_per_entity .entry(entity_path_hash) .or_default() .disconnected_space = true; diff --git a/crates/viewer/re_view_spatial/src/view_2d.rs b/crates/viewer/re_view_spatial/src/view_2d.rs index 7a8afd046f8e..89fb14ea39a3 100644 --- a/crates/viewer/re_view_spatial/src/view_2d.rs +++ b/crates/viewer/re_view_spatial/src/view_2d.rs @@ -20,7 +20,7 @@ use re_viewer_context::{ use crate::{ contexts::register_spatial_contexts, heuristics::default_visualized_entities_for_visualizer_kind, - max_image_dimension_subscriber::{MaxDimensions, MaxImageDimensions}, + max_image_dimension_subscriber::MaxDimensions, spatial_topology::{SpatialTopology, SubSpaceConnectionFlags}, ui::SpatialViewState, view_kind::SpatialViewKind, @@ -69,7 +69,7 @@ impl ViewClass for SpatialView2D { // Ensure spatial topology & max image dimension is registered. crate::spatial_topology::SpatialTopologyStoreSubscriber::subscription_handle(); crate::transform_component_tracker::TransformComponentTrackerStoreSubscriber::subscription_handle(); - crate::max_image_dimension_subscriber::MaxImageDimensionSubscriber::subscription_handle(); + crate::max_image_dimension_subscriber::MaxImageDimensionsStoreSubscriber::subscription_handle(); register_spatial_contexts(system_registry)?; register_2d_spatial_visualizers(system_registry)?; @@ -177,9 +177,10 @@ impl ViewClass for SpatialView2D { ); let image_dimensions = - MaxImageDimensions::access(&ctx.recording_id(), |image_dimensions| { - image_dimensions.clone() - }) + crate::max_image_dimension_subscriber::MaxImageDimensionsStoreSubscriber::access( + &ctx.recording_id(), + |image_dimensions| image_dimensions.clone(), + ) .unwrap_or_default(); // Spawn a view at each subspace that has any potential 2D content. From 867ec9ea793dad977066c48bf5f3aefa8a9397b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Wed, 11 Dec 2024 14:11:38 +0100 Subject: [PATCH 31/71] Fix node selection not working on graph node text labels (#8394) ### What This fixes a bug where specifically, selecting nodes via text labels was not working. We encountered this bug during our work on #8390. ### How to test To test open the `+main` manifest in the web viewer (link in bot message below), select the graph lattice example and try clicking on nodes. --- crates/viewer/re_view_graph/src/ui/draw.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/crates/viewer/re_view_graph/src/ui/draw.rs b/crates/viewer/re_view_graph/src/ui/draw.rs index a9a6b68aedc4..db9566f9778d 100644 --- a/crates/viewer/re_view_graph/src/ui/draw.rs +++ b/crates/viewer/re_view_graph/src/ui/draw.rs @@ -94,7 +94,7 @@ fn draw_circle_label( let &CircleLabel { radius, color } = label; let visuals = &ui.style().visuals.clone(); - let (resp, painter) = ui.allocate_painter(Vec2::splat(radius * 2.0), Sense::click()); + let (resp, painter) = ui.allocate_painter(Vec2::splat(radius * 2.0), Sense::hover()); painter.circle( resp.rect.center(), radius, @@ -132,13 +132,9 @@ fn draw_text_label(ui: &mut Ui, label: &TextLabel, highlight: InteractionHighlig .stroke(stroke) .fill(bg) .show(ui, |ui| { - ui.add( - egui::Label::new(galley.clone()) - .selectable(false) - .sense(Sense::click()), - ) + ui.add(egui::Label::new(galley.clone()).selectable(false)) }) - .response + .inner } /// Draws a node at the given position. @@ -148,15 +144,18 @@ fn draw_node( node: &DrawableLabel, highlight: InteractionHighlight, ) -> Response { - let builder = UiBuilder::new().max_rect(Rect::from_center_size(center, node.size())); - let mut node_ui = ui.new_child(builder); + let builder = UiBuilder::new() + .max_rect(Rect::from_center_size(center, node.size())) + .sense(Sense::click()); - // TODO(grtlr): handle highlights + let mut node_ui = ui.new_child(builder); match node { DrawableLabel::Circle(label) => draw_circle_label(&mut node_ui, label, highlight), DrawableLabel::Text(label) => draw_text_label(&mut node_ui, label, highlight), - } + }; + + node_ui.response() } /// Draws a bounding box, as well as a basic coordinate system. From 9b83a1f7e11f9cb48888c1fd910aaefc4ef34a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Wed, 11 Dec 2024 15:03:39 +0100 Subject: [PATCH 32/71] Bump `fjadra` to `v0.2.1` (#8410) ### What This provides a temporary "fix" to the integer overflows that can happen in very rare cases in `fjadra`. --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b97742aa8bf..297e7636b886 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2455,9 +2455,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "fjadra" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8d17b174735bd1464bc491c49570fc824466e9140617c371de9a6d86ebd33ec" +checksum = "c1671b620ba6e60c11c62b0ea5fec4f8621991e7b1229fa13c010a2cd04e4342" [[package]] name = "flatbuffers" diff --git a/Cargo.toml b/Cargo.toml index 1cfd5e77a724..7e6a16ea007a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -190,7 +190,7 @@ enumset = "1.0.12" env_logger = { version = "0.10", default-features = false } ffmpeg-sidecar = { version = "2.0.2", default-features = false } fixed = { version = "1.28", default-features = false } -fjadra = "0.2" +fjadra = "0.2.1" flatbuffers = "23.0" futures-channel = "0.3" futures-util = { version = "0.3", default-features = false } From 51a30623165fb592d5335b3b0359443f4344084e Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 11 Dec 2024 15:23:33 +0100 Subject: [PATCH 33/71] Remove some too frequent profile scopes (causing profiler slowdown for many-entities) (#8414) The usual whack-a-mole: profiler scopes themselves cause as more overhead than what they're profiling, causing puffing traces to be a lot less useful: recording of revy's `alien_cake_addict` Before (main): image After: image Puffing no longer warns but there's still quite some overhead: It makes the reported cpu time go up from ~52ms to ~57ms Well, time to call less methods - afaik a lot is caused by blueprint queries that we _know_ will turn up empty! (one of the next things I'm looking into) --- crates/store/re_query/src/latest_at.rs | 4 +--- crates/viewer/re_view/src/query.rs | 2 +- crates/viewer/re_view/src/results_ext.rs | 2 +- .../viewer/re_view_spatial/src/contexts/transform_context.rs | 2 +- crates/viewer/re_view_spatial/src/mesh_cache.rs | 2 -- crates/viewer/re_viewport_blueprint/src/view_contents.rs | 4 +--- 6 files changed, 5 insertions(+), 11 deletions(-) diff --git a/crates/store/re_query/src/latest_at.rs b/crates/store/re_query/src/latest_at.rs index e4f641665dd6..02a42649a4cb 100644 --- a/crates/store/re_query/src/latest_at.rs +++ b/crates/store/re_query/src/latest_at.rs @@ -48,7 +48,7 @@ impl QueryCache { entity_path: &EntityPath, component_descrs: impl IntoIterator>>, ) -> LatestAtResults { - re_tracing::profile_function!(entity_path.to_string()); + // This is called very frequently, don't put a profile scope here. let store = self.store.read(); @@ -87,8 +87,6 @@ impl QueryCache { // the data. let mut max_clear_index = (TimeInt::MIN, RowId::ZERO); { - re_tracing::profile_scope!("clears"); - let potential_clears = self.might_require_clearing.read(); let mut clear_entity_path = entity_path.clone(); diff --git a/crates/viewer/re_view/src/query.rs b/crates/viewer/re_view/src/query.rs index e554f4d07fef..98f3bcdd2ab5 100644 --- a/crates/viewer/re_view/src/query.rs +++ b/crates/viewer/re_view/src/query.rs @@ -85,7 +85,7 @@ pub fn latest_at_with_blueprint_resolved_data<'a>( component_names: impl IntoIterator, query_shadowed_defaults: bool, ) -> HybridLatestAtResults<'a> { - re_tracing::profile_function!(data_result.entity_path.to_string()); + // This is called very frequently, don't put a profile scope here. let mut component_set = component_names.into_iter().collect::>(); diff --git a/crates/viewer/re_view/src/results_ext.rs b/crates/viewer/re_view/src/results_ext.rs index 71eca73654c3..8e9300a4d508 100644 --- a/crates/viewer/re_view/src/results_ext.rs +++ b/crates/viewer/re_view/src/results_ext.rs @@ -135,7 +135,7 @@ pub enum HybridResults<'a> { impl HybridResults<'_> { pub fn query_result_hash(&self) -> Hash64 { - re_tracing::profile_function!(); + // This is called very frequently, don't put a profile scope here. // TODO(andreas): We should be able to do better than this and determine hashes for queries on the fly. match self { diff --git a/crates/viewer/re_view_spatial/src/contexts/transform_context.rs b/crates/viewer/re_view_spatial/src/contexts/transform_context.rs index 20122a8313ed..82a596ea58b6 100644 --- a/crates/viewer/re_view_spatial/src/contexts/transform_context.rs +++ b/crates/viewer/re_view_spatial/src/contexts/transform_context.rs @@ -734,7 +734,7 @@ fn transforms_at( pinhole_image_plane_distance: impl Fn(&EntityPath) -> f32, encountered_pinhole: &mut Option, ) -> Result { - re_tracing::profile_function!(); + // This is called very frequently, don't put a profile scope here. let potential_transform_components = TransformComponentTrackerStoreSubscriber::access(&entity_db.store_id(), |tracker| { diff --git a/crates/viewer/re_view_spatial/src/mesh_cache.rs b/crates/viewer/re_view_spatial/src/mesh_cache.rs index ff95fa76859b..9da0b806a3b5 100644 --- a/crates/viewer/re_view_spatial/src/mesh_cache.rs +++ b/crates/viewer/re_view_spatial/src/mesh_cache.rs @@ -56,8 +56,6 @@ impl MeshCache { mesh: AnyMesh<'_>, render_ctx: &RenderContext, ) -> Option> { - re_tracing::profile_function!(); - self.0 .entry(key.versioned_instance_path_hash.row_id) .or_default() diff --git a/crates/viewer/re_viewport_blueprint/src/view_contents.rs b/crates/viewer/re_viewport_blueprint/src/view_contents.rs index 720be6c9ccec..06fd584df7b8 100644 --- a/crates/viewer/re_viewport_blueprint/src/view_contents.rs +++ b/crates/viewer/re_viewport_blueprint/src/view_contents.rs @@ -393,8 +393,6 @@ impl DataQueryPropertyResolver<'_> { // Update visualizers from overrides. if !node.data_result.visualizers.is_empty() { - re_tracing::profile_scope!("Update visualizers from overrides"); - // If the user has overridden the visualizers, update which visualizers are used. if let Some(viz_override) = blueprint .latest_at_component::( @@ -524,7 +522,7 @@ impl DataQueryPropertyResolver<'_> { query_result: &mut DataQueryResult, view_states: &mut ViewStates, ) { - re_tracing::profile_function!(); + // This is called very frequently, don't put a profile scope here. if let Some(root) = query_result.tree.root_handle() { let recursive_property_overrides = Default::default(); From 388c8aae45f024a00d473fd90ba92043c7fd6e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Wed, 11 Dec 2024 15:32:24 +0100 Subject: [PATCH 34/71] Partial revert #8390: removal of `Area` in `zoom_pan_area` (#8416) ### Related * #8390 (partial revert) ### What We encountered some problems with this implementation. Discussion: https://rerunio.slack.com/archives/C04MTSM2U91/p1733921898485069 --- crates/viewer/re_ui/src/zoom_pan_area.rs | 67 +++++++++++++----------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/crates/viewer/re_ui/src/zoom_pan_area.rs b/crates/viewer/re_ui/src/zoom_pan_area.rs index 9dac80ce4130..46020aa15c34 100644 --- a/crates/viewer/re_ui/src/zoom_pan_area.rs +++ b/crates/viewer/re_ui/src/zoom_pan_area.rs @@ -5,7 +5,7 @@ //! * `view`-space: The space where the pan-and-zoom area is drawn. //! * `scene`-space: The space where the actual content is drawn. -use egui::{emath::TSTransform, Rect, Response, Ui, UiBuilder}; +use egui::{emath::TSTransform, Area, Rect, Response, Ui, UiKind}; /// Helper function to handle pan and zoom interactions on a response. fn register_pan_and_zoom(ui: &Ui, resp: &Response, ui_from_scene: &mut TSTransform) { @@ -58,42 +58,45 @@ pub fn fit_to_rect_in_scene(rect_in_ui: Rect, rect_in_scene: Rect) -> TSTransfor /// Provides a zoom-pan area for a given view. pub fn zoom_pan_area( - ui: &mut Ui, + ui: &Ui, view_bounds_in_ui: Rect, ui_from_scene: &mut TSTransform, draw_contents: impl FnOnce(&mut Ui), ) -> Response { - let zoom_pan_layer_id = egui::LayerId::new(ui.layer_id().order, ui.id().with("zoom_pan_area")); - - // Put the layer directly on-top of the main layer of the ui: - ui.ctx().set_sublayer(ui.layer_id(), zoom_pan_layer_id); - - let mut ui = ui.new_child( - UiBuilder::new() - .layer_id(zoom_pan_layer_id) - .max_rect(view_bounds_in_ui) - .sense(egui::Sense::click_and_drag()), - ); - - // Transform to the scene space: - let visible_rect_in_scene = ui_from_scene.inverse() * view_bounds_in_ui; - - // set proper clip-rect so we can interact with the background: - ui.set_clip_rect(visible_rect_in_scene); - - let pan_response = ui.response(); - - // Update the transform based on the interactions: - register_pan_and_zoom(&ui, &pan_response, ui_from_scene); - - // Update the clip-rect with the new transform, to avoid frame-delays - ui.set_clip_rect(ui_from_scene.inverse() * view_bounds_in_ui); - - // Add the actual contents to the area: - draw_contents(&mut ui); + let area_resp = Area::new(ui.id().with("zoom_pan_area")) + .constrain_to(view_bounds_in_ui) + .order(ui.layer_id().order) + .kind(UiKind::GenericArea) + .show(ui.ctx(), |ui| { + // Transform to the scene space: + let visible_rect_in_scene = ui_from_scene.inverse() * view_bounds_in_ui; + + // set proper clip-rect so we can interact with the background. + ui.set_clip_rect(visible_rect_in_scene); + + // A Ui for sensing drag-to-pan, scroll-to-zoom, etc + let mut drag_sense_ui = ui.new_child( + egui::UiBuilder::new() + .sense(egui::Sense::click_and_drag()) + .max_rect(visible_rect_in_scene), + ); + + drag_sense_ui.set_min_size(visible_rect_in_scene.size()); + let pan_response = drag_sense_ui.response(); + + // Update the transform based on the interactions: + register_pan_and_zoom(ui, &pan_response, ui_from_scene); + + // Update the clip-rect with the new transform, to avoid frame-delays + ui.set_clip_rect(ui_from_scene.inverse() * view_bounds_in_ui); + + // Add the actual contents to the area: + draw_contents(ui); + pan_response + }); ui.ctx() - .set_transform_layer(zoom_pan_layer_id, *ui_from_scene); + .set_transform_layer(area_resp.response.layer_id, *ui_from_scene); - pan_response + area_resp.inner } From 704438fbbcf71702d1f0577422387d86895a5eae Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:57:20 +0100 Subject: [PATCH 35/71] Allow drag-and-dropping multiple containers and views in the blueprint tree (#8334) ### Related * Closes #8276 * Closes #8275 * Part of #8266 * Part of #8267 * Related to #7108 ### What This PR makes it possible to drag multi-selection of views and containers within the blueprint tree. It lays the foundation of a system that will be extended to other drag payload and UI sections. Specifically: - `ctx.handle_select_hover_drag_interactions()` (formerly `ctx.select_hovered_on_click()`) is now able to initiate drag interactions. This is opt-in for now, as dragging from most place isn't supported yet (to implemented in follow-up PRs). - Introduce a new `DragAndDropPayload` type to interoperate between various part of the UI. This type also enforce the grouping of items that can meaningfully be dragged together (e.g. it's ok to drag a view and a container together, because there exist somewhere they can be dropped to, but it's not ok to drag a view and an entity together). - When a drag is successfully initiated, a "pill" is displayed along the cursor which indicates the content of what's being dragged. - Introduces a _very_ hack mechanism for a black list of undraggable items (aka the root container). - Update blueprint tree to support multiple selection and the new drag and drop payload type. - Updates egui to latest `master`. --------- Co-authored-by: Emil Ernerfeldt --- Cargo.lock | 22 +-- Cargo.toml | 14 +- .../re_blueprint_tree/src/blueprint_tree.rs | 96 +++++----- crates/viewer/re_data_ui/src/instance_path.rs | 2 +- crates/viewer/re_data_ui/src/item_ui.rs | 2 +- .../re_selection_panel/src/selection_panel.rs | 4 +- crates/viewer/re_time_panel/src/lib.rs | 4 +- .../viewer/re_ui/data/icons/dnd_add_new.png | Bin 0 -> 430 bytes .../re_ui/data/icons/dnd_add_to_existing.png | Bin 0 -> 557 bytes crates/viewer/re_ui/data/icons/dnd_move.png | Bin 0 -> 450 bytes crates/viewer/re_ui/src/design_tokens.rs | 2 +- crates/viewer/re_ui/src/icons.rs | 5 + crates/viewer/re_ui/src/ui_ext.rs | 15 ++ .../re_view_bar_chart/src/view_class.rs | 3 +- .../re_view_dataframe/src/dataframe_ui.rs | 6 +- crates/viewer/re_view_graph/src/ui/draw.rs | 8 +- crates/viewer/re_view_map/src/map_view.rs | 3 +- .../viewer/re_view_spatial/src/picking_ui.rs | 2 +- .../re_view_time_series/src/view_class.rs | 2 +- crates/viewer/re_viewer/src/app_state.rs | 13 +- .../re_viewer/src/ui/recordings_panel.rs | 2 +- .../viewer/re_viewer_context/src/contents.rs | 10 +- .../re_viewer_context/src/drag_and_drop.rs | 178 ++++++++++++++++++ crates/viewer/re_viewer_context/src/lib.rs | 2 + .../re_viewer_context/src/selection_state.rs | 14 ++ .../re_viewer_context/src/test_context.rs | 3 + .../src/view/view_context.rs | 10 - .../re_viewer_context/src/viewer_context.rs | 55 +++++- crates/viewer/re_viewport/src/viewport_ui.rs | 25 ++- .../src/viewport_blueprint.rs | 4 +- .../src/viewport_command.rs | 2 +- .../custom_view/src/color_coordinates_view.rs | 6 +- 32 files changed, 403 insertions(+), 111 deletions(-) create mode 100644 crates/viewer/re_ui/data/icons/dnd_add_new.png create mode 100644 crates/viewer/re_ui/data/icons/dnd_add_to_existing.png create mode 100644 crates/viewer/re_ui/data/icons/dnd_move.png create mode 100644 crates/viewer/re_viewer_context/src/drag_and_drop.rs diff --git a/Cargo.lock b/Cargo.lock index 297e7636b886..4a5eee7bfb59 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1934,7 +1934,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "ecolor" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" dependencies = [ "bytemuck", "color-hex", @@ -1951,7 +1951,7 @@ checksum = "18aade80d5e09429040243ce1143ddc08a92d7a22820ac512610410a4dd5214f" [[package]] name = "eframe" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" dependencies = [ "ahash", "bytemuck", @@ -1990,7 +1990,7 @@ dependencies = [ [[package]] name = "egui" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" dependencies = [ "accesskit", "ahash", @@ -2007,7 +2007,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" dependencies = [ "ahash", "bytemuck", @@ -2026,7 +2026,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" dependencies = [ "accesskit_winit", "ahash", @@ -2068,7 +2068,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" dependencies = [ "ahash", "egui", @@ -2085,7 +2085,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" dependencies = [ "ahash", "bytemuck", @@ -2103,7 +2103,7 @@ dependencies = [ [[package]] name = "egui_kittest" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" dependencies = [ "dify", "egui", @@ -2172,7 +2172,7 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "emath" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" dependencies = [ "bytemuck", "serde", @@ -2288,7 +2288,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" dependencies = [ "ab_glyph", "ahash", @@ -2307,7 +2307,7 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.29.1" -source = "git+https://github.com/emilk/egui.git?rev=577ee8d22810752540636febac5660a5119c6550#577ee8d22810752540636febac5660a5119c6550" +source = "git+https://github.com/emilk/egui.git?rev=13352d606496d7b1c5fd6fcfbe3c85baae39c040#13352d606496d7b1c5fd6fcfbe3c85baae39c040" [[package]] name = "equivalent" diff --git a/Cargo.toml b/Cargo.toml index 7e6a16ea007a..7eacba039f5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -560,13 +560,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 = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04 -eframe = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04 -egui = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04 -egui_extras = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04 -egui_kittest = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04 -egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04 -emath = { git = "https://github.com/emilk/egui.git", rev = "577ee8d22810752540636febac5660a5119c6550" } # egui master 2024-12-04 +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 # Useful while developing: # ecolor = { path = "../../egui/crates/ecolor" } diff --git a/crates/viewer/re_blueprint_tree/src/blueprint_tree.rs b/crates/viewer/re_blueprint_tree/src/blueprint_tree.rs index 434ab4795640..d22b70d8c987 100644 --- a/crates/viewer/re_blueprint_tree/src/blueprint_tree.rs +++ b/crates/viewer/re_blueprint_tree/src/blueprint_tree.rs @@ -10,7 +10,7 @@ use re_types::blueprint::components::Visible; use re_ui::{drag_and_drop::DropTarget, list_item, ContextExt as _, DesignTokens, UiExt as _}; use re_viewer_context::{ contents_name_style, icon_for_container_kind, CollapseScope, Contents, DataResultNodeOrPath, - SystemCommandSender, + DragAndDropPayload, SystemCommandSender, }; use re_viewer_context::{ ContainerId, DataQueryResult, DataResultNode, HoverHighlight, Item, ViewId, ViewerContext, @@ -168,7 +168,7 @@ impl BlueprintTree { let item_response = ui .list_item() .selected(ctx.selection().contains_item(&item)) - .draggable(false) + .draggable(true) // allowed for consistency but results in an invalid drag .drop_target_style(self.is_candidate_drop_parent_container(&container_id)) .show_flat( ui, @@ -189,7 +189,7 @@ impl BlueprintTree { SelectionUpdateBehavior::UseSelection, ); self.scroll_to_me_if_needed(ui, &item, &item_response); - ctx.select_hovered_on_click(&item_response, item); + ctx.handle_select_hover_drag_interactions(&item_response, item, true); self.handle_root_container_drag_and_drop_interaction( viewport, @@ -270,12 +270,11 @@ impl BlueprintTree { SelectionUpdateBehavior::UseSelection, ); self.scroll_to_me_if_needed(ui, &item, &response); - ctx.select_hovered_on_click(&response, item); + ctx.handle_select_hover_drag_interactions(&response, item, true); viewport.set_content_visibility(ctx, &content, visible); self.handle_drag_and_drop_interaction( - ctx, viewport, ui, content, @@ -406,13 +405,12 @@ impl BlueprintTree { SelectionUpdateBehavior::UseSelection, ); self.scroll_to_me_if_needed(ui, &item, &response); - ctx.select_hovered_on_click(&response, item); + ctx.handle_select_hover_drag_interactions(&response, item, true); let content = Contents::View(*view_id); viewport.set_content_visibility(ctx, &content, visible); self.handle_drag_and_drop_interaction( - ctx, viewport, ui, content, @@ -494,6 +492,7 @@ impl BlueprintTree { let list_item = ui .list_item() + .draggable(true) .selected(is_selected) .force_hovered(is_item_hovered); @@ -596,7 +595,7 @@ impl BlueprintTree { SelectionUpdateBehavior::UseSelection, ); self.scroll_to_me_if_needed(ui, &item, &response); - ctx.select_hovered_on_click(&response, item); + ctx.handle_select_hover_drag_interactions(&response, item, true); } /// Add a button to trigger the addition of a new view or container. @@ -636,16 +635,21 @@ impl BlueprintTree { response: &egui::Response, ) { // - // check if a drag is in progress and set the cursor accordingly + // check if a drag with acceptable content is in progress // - let Some(dragged_item_id) = egui::DragAndDrop::payload(ui.ctx()).map(|payload| *payload) + let Some(dragged_payload) = egui::DragAndDrop::payload::(ui.ctx()) else { - // nothing is being dragged, so nothing to do return; }; - ui.ctx().set_cursor_icon(egui::CursorIcon::Grabbing); + let DragAndDropPayload::Contents { + contents: dragged_contents, + } = dragged_payload.as_ref() + else { + // nothing we care about is being dragged + return; + }; // // find the drop target @@ -668,13 +672,12 @@ impl BlueprintTree { ); if let Some(drop_target) = drop_target { - self.handle_drop_target(viewport, ui, dragged_item_id, &drop_target); + self.handle_contents_drop_target(viewport, ui, dragged_contents, &drop_target); } } fn handle_drag_and_drop_interaction( &mut self, - ctx: &ViewerContext<'_>, viewport: &ViewportBlueprint, ui: &egui::Ui, contents: Contents, @@ -682,25 +685,21 @@ impl BlueprintTree { body_response: Option<&egui::Response>, ) { // - // initiate drag and force single-selection - // - - if response.drag_started() { - ctx.selection_state().set_selection(contents.as_item()); - egui::DragAndDrop::set_payload(ui.ctx(), contents); - } - - // - // check if a drag is in progress and set the cursor accordingly + // check if a drag with acceptable content is in progress // - let Some(dragged_item_id) = egui::DragAndDrop::payload(ui.ctx()).map(|payload| *payload) + let Some(dragged_payload) = egui::DragAndDrop::payload::(ui.ctx()) else { - // nothing is being dragged, so nothing to do return; }; - ui.ctx().set_cursor_icon(egui::CursorIcon::Grabbing); + let DragAndDropPayload::Contents { + contents: dragged_contents, + } = dragged_payload.as_ref() + else { + // nothing we care about is being dragged + return; + }; // // find our parent, our position within parent, and the previous container (if any) @@ -752,7 +751,7 @@ impl BlueprintTree { ); if let Some(drop_target) = drop_target { - self.handle_drop_target(viewport, ui, dragged_item_id, &drop_target); + self.handle_contents_drop_target(viewport, ui, dragged_contents, &drop_target); } } @@ -763,16 +762,21 @@ impl BlueprintTree { empty_space: egui::Rect, ) { // - // check if a drag is in progress and set the cursor accordingly + // check if a drag with acceptable content is in progress // - let Some(dragged_item_id) = egui::DragAndDrop::payload(ui.ctx()).map(|payload| *payload) + let Some(dragged_payload) = egui::DragAndDrop::payload::(ui.ctx()) else { - // nothing is being dragged, so nothing to do return; }; - ui.ctx().set_cursor_icon(egui::CursorIcon::Grabbing); + let DragAndDropPayload::Contents { + contents: dragged_contents, + } = dragged_payload.as_ref() + else { + // nothing we care about is being dragged + return; + }; // // prepare a drop target corresponding to "insert last in root container" @@ -788,25 +792,31 @@ impl BlueprintTree { usize::MAX, ); - self.handle_drop_target(viewport, ui, dragged_item_id, &drop_target); + self.handle_contents_drop_target(viewport, ui, dragged_contents, &drop_target); } } - fn handle_drop_target( + fn handle_contents_drop_target( &mut self, viewport: &ViewportBlueprint, ui: &Ui, - dragged_item_id: Contents, + dragged_contents: &[Contents], drop_target: &DropTarget, ) { - // We cannot allow the target location to be "inside" the dragged item, because that would amount moving - // myself inside of me. - if let Contents::Container(dragged_container_id) = &dragged_item_id { - if viewport - .is_contents_in_container(&drop_target.target_parent_id, dragged_container_id) - { - return; + // We cannot allow the target location to be "inside" any of the dragged items, because that + // would amount to moving myself inside of me. + let parent_contains_dragged_content = |content: &Contents| { + if let Contents::Container(dragged_container_id) = content { + if viewport + .is_contents_in_container(&drop_target.target_parent_id, dragged_container_id) + { + return true; + } } + false + }; + if dragged_contents.iter().any(parent_contains_dragged_content) { + return; } ui.painter().hline( @@ -822,7 +832,7 @@ impl BlueprintTree { if ui.input(|i| i.pointer.any_released()) { viewport.move_contents( - dragged_item_id, + dragged_contents.to_vec(), target_container_id, drop_target.target_position_index, ); diff --git a/crates/viewer/re_data_ui/src/instance_path.rs b/crates/viewer/re_data_ui/src/instance_path.rs index ace0423c66ae..c0b271a9b91c 100644 --- a/crates/viewer/re_data_ui/src/instance_path.rs +++ b/crates/viewer/re_data_ui/src/instance_path.rs @@ -243,7 +243,7 @@ fn component_list_ui( }); if interactive { - ctx.select_hovered_on_click(&response, item); + ctx.handle_select_hover_drag_interactions(&response, item, false); } } }); diff --git a/crates/viewer/re_data_ui/src/item_ui.rs b/crates/viewer/re_data_ui/src/item_ui.rs index ca1ead6183e7..6526276ab9ec 100644 --- a/crates/viewer/re_data_ui/src/item_ui.rs +++ b/crates/viewer/re_data_ui/src/item_ui.rs @@ -596,7 +596,7 @@ pub fn cursor_interact_with_selectable( let is_item_hovered = ctx.selection_state().highlight_for_ui_element(&item) == HoverHighlight::Hovered; - ctx.select_hovered_on_click(&response, item); + ctx.handle_select_hover_drag_interactions(&response, item, false); // TODO(andreas): How to deal with shift click for selecting ranges? if is_item_hovered { diff --git a/crates/viewer/re_selection_panel/src/selection_panel.rs b/crates/viewer/re_selection_panel/src/selection_panel.rs index 79f5d17b2e19..9d2cf9e3209c 100644 --- a/crates/viewer/re_selection_panel/src/selection_panel.rs +++ b/crates/viewer/re_selection_panel/src/selection_panel.rs @@ -675,7 +675,7 @@ fn list_existing_data_blueprints( // We don't use item_ui::cursor_interact_with_selectable here because the forced // hover background is distracting and not useful. - ctx.select_hovered_on_click(&response, item); + ctx.handle_select_hover_drag_interactions(&response, item, false); } } } @@ -926,7 +926,7 @@ fn show_list_item_for_container_child( &response, SelectionUpdateBehavior::Ignore, ); - ctx.select_hovered_on_click(&response, item); + ctx.handle_select_hover_drag_interactions(&response, item, false); if remove_contents { viewport.mark_user_interaction(ctx); diff --git a/crates/viewer/re_time_panel/src/lib.rs b/crates/viewer/re_time_panel/src/lib.rs index f10c0e9e420c..39e67101dc4d 100644 --- a/crates/viewer/re_time_panel/src/lib.rs +++ b/crates/viewer/re_time_panel/src/lib.rs @@ -726,7 +726,7 @@ impl TimePanel { &response, SelectionUpdateBehavior::UseSelection, ); - ctx.select_hovered_on_click(&response, item.to_item()); + ctx.handle_select_hover_drag_interactions(&response, item.to_item(), false); let is_closed = body_response.is_none(); let response_rect = response.rect; @@ -854,7 +854,7 @@ impl TimePanel { &response, SelectionUpdateBehavior::UseSelection, ); - ctx.select_hovered_on_click(&response, item.to_item()); + ctx.handle_select_hover_drag_interactions(&response, item.to_item(), false); let response_rect = response.rect; diff --git a/crates/viewer/re_ui/data/icons/dnd_add_new.png b/crates/viewer/re_ui/data/icons/dnd_add_new.png new file mode 100644 index 0000000000000000000000000000000000000000..ae2caea2210872e2935c9992651373d10e150ccf GIT binary patch literal 430 zcmV;f0a5;mP)c=iRF+qfCsC~sW7kUkqC24#bfeqs% zn3vV${%JOb1I{}X0!MIQKT^6^f`QH9p?tj~P}ngNr+UcC*~IkElH(D41nH|b4R|rz zvFbmR1*>3|#J?ieWuZlv&DrQr>23%Tr1fyD!g^?yah{x9!jbK!l$qaDzS2Tnp73Pa ztih3#cyHS~mD}_)k_+`(e?RW1z*VV+1E#orp?7wudyfz0z@+;bg6A{V{meSLhn_$A Y1n>CaR2}S07*qoM6N<$f?Yea>;M1& literal 0 HcmV?d00001 diff --git a/crates/viewer/re_ui/data/icons/dnd_add_to_existing.png b/crates/viewer/re_ui/data/icons/dnd_add_to_existing.png new file mode 100644 index 0000000000000000000000000000000000000000..815fd872b22a319f96b4500aefb8c5b1b7f75879 GIT binary patch literal 557 zcmV+|0@D47P)IvWmlpEj)=n>!q;7X|`ETKlIo5J{SZAgg0XlhBWpg6!a(5vHiUsu)iEyFQSE5)tK^5@t*_4-r0EI>FKlPhzIPt05CW(* zN~3@L{5#)_Eh8fi%_jga5^EZ;%6`@lI`vC=B{TPDZ;#!c91-QbI)wmuH5AfvZf_@y zpC!do)BHA>Ad)@(1g=#L8>uIt-k>*vrPhr*s|gZspa-zS`v(RJ8Q{HX8#esOz!ci~ zGVOa`N|ccD>*wL^b3UeoWMqs7)>aE>D4)fB*pG514*aplV=%$#@pplpMWdZiT9V zP1x;dn1|mn573ut_NZCwLUWSr=C3CAbT=9nyMF=t`Z2>T?k{CEpOn@2gc4$|(zZE0 z5KXNufJ50Qhb>@eYIZcBmf^bQSj%KhSgiC@b8~fB#QHSr0~XTk(*WhQu0&O^hiWCJ zYyYi1pXeSR=;aJey}Ed?>|V{-kW~Yl!7S8` pub const BREADCRUMBS_SEPARATOR: Icon = icon_from_path!("../data/icons/breadcrumbs_separator.png"); diff --git a/crates/viewer/re_ui/src/ui_ext.rs b/crates/viewer/re_ui/src/ui_ext.rs index d791d2edb20f..210814ac99c6 100644 --- a/crates/viewer/re_ui/src/ui_ext.rs +++ b/crates/viewer/re_ui/src/ui_ext.rs @@ -131,6 +131,21 @@ pub trait UiExt { ) } + /// Adds a non-interactive, optionally tinted small icon. + /// + /// Uses [`DesignTokens::small_icon_size`]. Returns the rect where the icon was painted. + fn small_icon(&mut self, icon: &Icon, tint: Option) -> egui::Rect { + let ui = self.ui_mut(); + let (_, rect) = ui.allocate_space(DesignTokens::small_icon_size()); + let mut image = icon.as_image(); + if let Some(tint) = tint { + image = image.tint(tint); + } + image.paint_at(ui, rect); + + rect + } + fn medium_icon_toggle_button(&mut self, icon: &Icon, selected: &mut bool) -> egui::Response { let size_points = egui::Vec2::splat(16.0); // TODO(emilk): get from design tokens diff --git a/crates/viewer/re_view_bar_chart/src/view_class.rs b/crates/viewer/re_view_bar_chart/src/view_class.rs index baa7b8eee48d..eb56be3fd3e7 100644 --- a/crates/viewer/re_view_bar_chart/src/view_class.rs +++ b/crates/viewer/re_view_bar_chart/src/view_class.rs @@ -238,9 +238,10 @@ Display a 1D tensor as a bar chart. if let Some(entity_path) = hovered_plot_item .and_then(|hovered_plot_item| plot_item_id_to_entity_path.get(&hovered_plot_item)) { - ctx.select_hovered_on_click( + ctx.handle_select_hover_drag_interactions( &response, re_viewer_context::Item::DataResult(query.view_id, entity_path.clone().into()), + false, ); } }); diff --git a/crates/viewer/re_view_dataframe/src/dataframe_ui.rs b/crates/viewer/re_view_dataframe/src/dataframe_ui.rs index 3c01daa5ddd4..056e131d3f03 100644 --- a/crates/viewer/re_view_dataframe/src/dataframe_ui.rs +++ b/crates/viewer/re_view_dataframe/src/dataframe_ui.rs @@ -261,7 +261,8 @@ impl egui_table::TableDelegate for DataframeTableDelegate<'_> { egui::Rect::from_min_size(pos, size), egui::SelectableLabel::new(is_selected, galley), ); - self.ctx.select_hovered_on_click(&response, item); + self.ctx + .handle_select_hover_drag_interactions(&response, item, false); // TODO(emilk): expand column(s) to make sure the text fits (requires egui_table fix). } @@ -319,11 +320,12 @@ impl egui_table::TableDelegate for DataframeTableDelegate<'_> { } } ColumnDescriptor::Component(component_column_descriptor) => { - self.ctx.select_hovered_on_click( + self.ctx.handle_select_hover_drag_interactions( &response, re_viewer_context::Item::ComponentPath( component_column_descriptor.component_path(), ), + false, ); } } diff --git a/crates/viewer/re_view_graph/src/ui/draw.rs b/crates/viewer/re_view_graph/src/ui/draw.rs index db9566f9778d..0916e1026372 100644 --- a/crates/viewer/re_view_graph/src/ui/draw.rs +++ b/crates/viewer/re_view_graph/src/ui/draw.rs @@ -298,9 +298,10 @@ pub fn draw_graph( let instance_path = InstancePath::instance(entity_path.clone(), instance.instance_index); - ctx.select_hovered_on_click( + ctx.handle_select_hover_drag_interactions( &response, Item::DataResult(query.view_id, instance_path.clone()), + false, ); response = response.on_hover_ui_at_pointer(|ui| { @@ -345,9 +346,10 @@ pub fn draw_graph( let resp = draw_entity_rect(ui, *rect, entity_path, &query.highlights); current_rect = current_rect.union(resp.rect); let instance_path = InstancePath::entity_all(entity_path.clone()); - ctx.select_hovered_on_click( + ctx.handle_select_hover_drag_interactions( &resp, - vec![(Item::DataResult(query.view_id, instance_path), None)].into_iter(), + Item::DataResult(query.view_id, instance_path), + false, ); } } diff --git a/crates/viewer/re_view_map/src/map_view.rs b/crates/viewer/re_view_map/src/map_view.rs index 9d98b0811be4..7db8ad45dcf8 100644 --- a/crates/viewer/re_view_map/src/map_view.rs +++ b/crates/viewer/re_view_map/src/map_view.rs @@ -481,9 +481,10 @@ fn handle_ui_interactions( }); }); - ctx.select_hovered_on_click( + ctx.handle_select_hover_drag_interactions( &map_response, Item::DataResult(query.view_id, instance_path.clone()), + false, ); // double click selects the entire entity diff --git a/crates/viewer/re_view_spatial/src/picking_ui.rs b/crates/viewer/re_view_spatial/src/picking_ui.rs index b91ebcdf5c7f..a52cf4bff691 100644 --- a/crates/viewer/re_view_spatial/src/picking_ui.rs +++ b/crates/viewer/re_view_spatial/src/picking_ui.rs @@ -209,7 +209,7 @@ pub fn picking( }); }; - ctx.select_hovered_on_click(&response, hovered_items.into_iter()); + ctx.handle_select_hover_drag_interactions(&response, hovered_items.into_iter(), false); Ok(response) } diff --git a/crates/viewer/re_view_time_series/src/view_class.rs b/crates/viewer/re_view_time_series/src/view_class.rs index a1447b57af81..f53cd3ed58d2 100644 --- a/crates/viewer/re_view_time_series/src/view_class.rs +++ b/crates/viewer/re_view_time_series/src/view_class.rs @@ -539,7 +539,7 @@ Display time series data in a plot. } }) { - ctx.select_hovered_on_click(&response, hovered); + ctx.handle_select_hover_drag_interactions(&response, hovered, false); } } diff --git a/crates/viewer/re_viewer/src/app_state.rs b/crates/viewer/re_viewer/src/app_state.rs index 08a0050fd739..8e07b53d6c7c 100644 --- a/crates/viewer/re_viewer/src/app_state.rs +++ b/crates/viewer/re_viewer/src/app_state.rs @@ -8,9 +8,9 @@ use re_smart_channel::ReceiveSet; use re_types::blueprint::components::PanelState; use re_ui::{ContextExt as _, DesignTokens}; use re_viewer_context::{ - AppOptions, ApplicationSelectionState, BlueprintUndoState, CommandSender, ComponentUiRegistry, - PlayState, RecordingConfig, StoreContext, StoreHub, SystemCommandSender as _, - ViewClassExt as _, ViewClassRegistry, ViewStates, ViewerContext, + drag_and_drop_payload_cursor_ui, AppOptions, ApplicationSelectionState, BlueprintUndoState, + CommandSender, ComponentUiRegistry, PlayState, RecordingConfig, StoreContext, StoreHub, + SystemCommandSender as _, ViewClassExt as _, ViewClassRegistry, ViewStates, ViewerContext, }; use re_viewport::ViewportUi; use re_viewport_blueprint::ui::add_view_or_container_modal_ui; @@ -214,6 +214,10 @@ impl AppState { )), ); + // The root container cannot be dragged. + let undraggable_items = + re_viewer_context::Item::Container(viewport_ui.blueprint.root_container).into(); + let applicable_entities_per_visualizer = view_class_registry.applicable_entities_for_visualizer_systems(&recording.store_id()); let indicated_entities_per_visualizer = @@ -269,6 +273,7 @@ impl AppState { render_ctx: Some(render_ctx), command_sender, focused_item, + undraggable_items: &undraggable_items, }; // We move the time at the very start of the frame, @@ -340,6 +345,7 @@ impl AppState { render_ctx: Some(render_ctx), command_sender, focused_item, + undraggable_items: &undraggable_items, }; if *show_settings_ui { @@ -506,6 +512,7 @@ impl AppState { // add_view_or_container_modal_ui(&ctx, &viewport_ui.blueprint, ui); + drag_and_drop_payload_cursor_ui(ctx.egui_ctx); // Process deferred layout operations and apply updates back to blueprint: viewport_ui.save_to_blueprint_store(&ctx, view_class_registry); diff --git a/crates/viewer/re_viewer/src/ui/recordings_panel.rs b/crates/viewer/re_viewer/src/ui/recordings_panel.rs index 49457eda91a4..378d0c34f9fa 100644 --- a/crates/viewer/re_viewer/src/ui/recordings_panel.rs +++ b/crates/viewer/re_viewer/src/ui/recordings_panel.rs @@ -222,7 +222,7 @@ fn app_and_its_recordings_ui( app_id.data_ui_recording(ctx, ui, UiLayout::Tooltip); }); - ctx.select_hovered_on_click(&item_response, app_item); + ctx.handle_select_hover_drag_interactions(&item_response, app_item, false); if item_response.clicked() { // Switch to this application: diff --git a/crates/viewer/re_viewer_context/src/contents.rs b/crates/viewer/re_viewer_context/src/contents.rs index 558fbe8ad941..38149f711a25 100644 --- a/crates/viewer/re_viewer_context/src/contents.rs +++ b/crates/viewer/re_viewer_context/src/contents.rs @@ -5,7 +5,7 @@ use egui_tiles::TileId; use re_log_types::EntityPath; use crate::item::Item; -use crate::{BlueprintId, BlueprintIdRegistry, ContainerId, ViewId}; +use crate::{BlueprintId, BlueprintIdRegistry, ContainerId, ItemCollection, ViewId}; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Contents { @@ -65,6 +65,14 @@ impl Contents { } } +impl TryFrom<&ItemCollection> for Vec { + type Error = (); + + fn try_from(value: &ItemCollection) -> Result { + value.iter().map(|(item, _)| item.try_into()).collect() + } +} + impl TryFrom for Contents { type Error = (); diff --git a/crates/viewer/re_viewer_context/src/drag_and_drop.rs b/crates/viewer/re_viewer_context/src/drag_and_drop.rs new file mode 100644 index 000000000000..bec7e7e43a5f --- /dev/null +++ b/crates/viewer/re_viewer_context/src/drag_and_drop.rs @@ -0,0 +1,178 @@ +//! Implement a global drag-and-drop payload type that enable dragging from various parts of the UI +//! (e.g., from the streams tree to the viewport, etc.). + +use std::fmt::Formatter; + +use itertools::Itertools; + +use re_ui::{ + ColorToken, Hue, + Scale::{S325, S375}, + UiExt, +}; + +use crate::{Contents, Item, ItemCollection}; + +//TODO(ab): add more type of things we can drag, in particular entity paths +#[derive(Debug)] +pub enum DragAndDropPayload { + /// The dragged content is made only of [`Contents`]. + Contents { contents: Vec }, + + /// The dragged content is made of a collection of [`Item`]s we do know how to handle. + Invalid, +} + +impl DragAndDropPayload { + pub fn from_items(selected_items: &ItemCollection) -> Self { + if let Ok(contents) = selected_items.try_into() { + Self::Contents { contents } + } else { + Self::Invalid + } + } +} + +impl std::fmt::Display for DragAndDropPayload { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Self::Contents { contents } => items_to_string( + contents + .iter() + .map(|content| content.as_item()) + .collect_vec() + .iter(), + ) + .fmt(f), + + // this is not used in the UI + Self::Invalid => "invalid selection".fmt(f), + } + } +} + +/// Display the currently dragged payload as a pill in the UI. +/// +/// This should be called once per frame. +pub fn drag_and_drop_payload_cursor_ui(ctx: &egui::Context) { + if let Some(payload) = egui::DragAndDrop::payload::(ctx) { + if let Some(pointer_pos) = ctx.pointer_interact_pos() { + let icon = match payload.as_ref() { + DragAndDropPayload::Contents { .. } => &re_ui::icons::DND_MOVE, + // don't draw anything for invalid selection + DragAndDropPayload::Invalid => return, + }; + + let layer_id = egui::LayerId::new( + egui::Order::Tooltip, + egui::Id::new("drag_and_drop_payload_layer"), + ); + + let mut ui = egui::Ui::new( + ctx.clone(), + egui::Id::new("rerun_drag_and_drop_payload_ui"), + egui::UiBuilder::new().layer_id(layer_id), + ); + + ui.set_opacity(0.7); + + let response = drag_pill_frame(matches!( + payload.as_ref(), + &DragAndDropPayload::Invalid { .. } + )) + .show(&mut ui, |ui| { + let text_color = ui.visuals().widgets.inactive.text_color(); + + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 2.0; + + ui.small_icon(icon, Some(text_color)); + ui.label(egui::RichText::new(payload.to_string()).color(text_color)); + }); + }) + .response; + + let delta = pointer_pos - response.rect.right_bottom(); + ctx.transform_layer_shapes(layer_id, emath::TSTransform::from_translation(delta)); + } + } +} + +fn drag_pill_frame(error_state: bool) -> egui::Frame { + let hue = if error_state { Hue::Red } else { Hue::Blue }; + + egui::Frame { + fill: re_ui::design_tokens().color(ColorToken::new(hue, S325)), + stroke: egui::Stroke::new( + 1.0, + re_ui::design_tokens().color(ColorToken::new(hue, S375)), + ), + rounding: (2.0).into(), + inner_margin: egui::Margin { + left: 6.0, + right: 9.0, + top: 5.0, + bottom: 4.0, + }, + ..Default::default() + } +} + +fn items_to_string<'a>(items: impl Iterator) -> String { + let mut container_cnt = 0u32; + let mut view_cnt = 0u32; + let mut app_cnt = 0u32; + let mut data_source_cnt = 0u32; + let mut store_cnt = 0u32; + let mut entity_cnt = 0u32; + let mut instance_cnt = 0u32; + let mut component_cnt = 0u32; + + for item in items { + match item { + Item::Container(_) => container_cnt += 1, + Item::View(_) => view_cnt += 1, + Item::AppId(_) => app_cnt += 1, + Item::DataSource(_) => data_source_cnt += 1, + Item::StoreId(_) => store_cnt += 1, + Item::InstancePath(instance_path) | Item::DataResult(_, instance_path) => { + if instance_path.is_all() { + entity_cnt += 1; + } else { + instance_cnt += 1; + } + } + Item::ComponentPath(_) => component_cnt += 1, + } + } + + let count_and_names = [ + (container_cnt, "container", "containers"), + (view_cnt, "view", "views"), + (app_cnt, "app", "apps"), + (data_source_cnt, "data source", "data sources"), + (store_cnt, "store", "stores"), + (entity_cnt, "entity", "entities"), + (instance_cnt, "instance", "instances"), + (component_cnt, "component", "components"), + ]; + + count_and_names + .into_iter() + .filter_map(|(count, name_singular, name_plural)| { + if count > 0 { + Some(format!( + "{} {}", + re_format::format_uint(count), + if count == 1 { + name_singular + } else { + name_plural + }, + )) + } else { + None + } + }) + .join(", ") +} diff --git a/crates/viewer/re_viewer_context/src/lib.rs b/crates/viewer/re_viewer_context/src/lib.rs index 2a1c89fde387..d276cb4b793b 100644 --- a/crates/viewer/re_viewer_context/src/lib.rs +++ b/crates/viewer/re_viewer_context/src/lib.rs @@ -13,6 +13,7 @@ mod component_fallbacks; mod component_ui_registry; mod contents; mod data_result_node_or_path; +mod drag_and_drop; mod file_dialog; mod image_info; mod item; @@ -52,6 +53,7 @@ pub use self::{ component_ui_registry::{ComponentUiRegistry, ComponentUiTypes, UiLayout}, contents::{blueprint_id_to_tile_id, Contents, ContentsName}, data_result_node_or_path::DataResultNodeOrPath, + drag_and_drop::{drag_and_drop_payload_cursor_ui, DragAndDropPayload}, file_dialog::santitize_file_name, image_info::{ColormapWithRange, ImageInfo}, item::Item, diff --git a/crates/viewer/re_viewer_context/src/selection_state.rs b/crates/viewer/re_viewer_context/src/selection_state.rs index e99457d9ad13..ec10c4833dcb 100644 --- a/crates/viewer/re_viewer_context/src/selection_state.rs +++ b/crates/viewer/re_viewer_context/src/selection_state.rs @@ -104,6 +104,15 @@ where } } +impl IntoIterator for ItemCollection { + type Item = (Item, Option); + type IntoIter = indexmap::map::IntoIter>; + + fn into_iter(self) -> Self::IntoIter { + self.0.into_iter() + } +} + impl ItemCollection { /// For each item in this selection, if it refers to the first element of an instance with a /// single element, resolve it to a unindexed entity path. @@ -261,6 +270,11 @@ impl ApplicationSelectionState { *self.selection_this_frame.lock() = items.into(); } + /// Extend the selection with the provided items. + pub fn extend_selection(&self, items: impl Into) { + self.selection_this_frame.lock().extend(items.into()); + } + /// Returns the current selection. pub fn selected_items(&self) -> &ItemCollection { &self.selection_previous_frame diff --git a/crates/viewer/re_viewer_context/src/test_context.rs b/crates/viewer/re_viewer_context/src/test_context.rs index 6784ebf54657..0ce951bf7c85 100644 --- a/crates/viewer/re_viewer_context/src/test_context.rs +++ b/crates/viewer/re_viewer_context/src/test_context.rs @@ -90,6 +90,8 @@ impl TestContext { hub: &Default::default(), }; + let undraggable_items = Default::default(); + let ctx = ViewerContext { app_options: &Default::default(), cache: &Default::default(), @@ -108,6 +110,7 @@ impl TestContext { render_ctx: None, command_sender: &self.command_sender, focused_item: &None, + undraggable_items: &undraggable_items, }; func(&ctx); diff --git a/crates/viewer/re_viewer_context/src/view/view_context.rs b/crates/viewer/re_viewer_context/src/view/view_context.rs index fafa901710dd..6667a893fc67 100644 --- a/crates/viewer/re_viewer_context/src/view/view_context.rs +++ b/crates/viewer/re_viewer_context/src/view/view_context.rs @@ -87,16 +87,6 @@ impl<'a> ViewContext<'a> { self.viewer_ctx.current_query() } - /// Set hover/select/focus for a given selection based on an egui response. - #[inline] - pub fn select_hovered_on_click( - &self, - response: &egui::Response, - selection: impl Into, - ) { - self.viewer_ctx.select_hovered_on_click(response, selection); - } - #[inline] pub fn lookup_query_result(&self, id: ViewId) -> &DataQueryResult { self.viewer_ctx.lookup_query_result(id) diff --git a/crates/viewer/re_viewer_context/src/viewer_context.rs b/crates/viewer/re_viewer_context/src/viewer_context.rs index 024f7fa91893..1b1d470dc7c5 100644 --- a/crates/viewer/re_viewer_context/src/viewer_context.rs +++ b/crates/viewer/re_viewer_context/src/viewer_context.rs @@ -5,6 +5,7 @@ use re_chunk_store::LatestAtQuery; use re_entity_db::entity_db::EntityDb; use re_query::StorageEngineReadGuard; +use crate::drag_and_drop::DragAndDropPayload; use crate::{ query_context::DataQueryResult, AppOptions, ApplicableEntities, ApplicationSelectionState, Caches, CommandSender, ComponentUiRegistry, IndicatedEntities, ItemCollection, PerVisualizer, @@ -79,6 +80,13 @@ pub struct ViewerContext<'a> { /// The focused item is cleared every frame, but views may react with side-effects /// that last several frames. pub focused_item: &'a Option, + + /// If a selection contains any `undraggable_items`, it may not be dragged. + /// + /// This is a rather ugly workaround to handle the case of the root container not being + /// draggable, but also being unknown to the drag-and-drop machinery in `re_viewer_context`. + //TODO(ab): figure out a way to deal with that in a cleaner way. + pub undraggable_items: &'a ItemCollection, } impl ViewerContext<'_> { @@ -131,11 +139,22 @@ impl ViewerContext<'_> { self.rec_cfg.time_ctrl.read().current_query() } - /// Set hover/select/focus for a given selection based on an egui response. - pub fn select_hovered_on_click( + /// Consistently handle the selection, hover, drag start interactions for a given set of items. + /// + /// The `draggable` parameter controls whether a drag can be initiated from this item. When a UI + /// element represents an [`crate::Item`], one must make the call whether this element should be + /// meaningfully draggable by the users. This is ultimately a subjective decision, but some here + /// are some guidelines: + /// - Is there a meaningful destination for the dragged payload? For example, dragging stuff out + /// of a modal dialog is by definition meaningless. + /// - Even if a drag destination exists, would that be obvious for the user? + /// - Is it expected for that kind of UI element to be draggable? For example, buttons aren't + /// typically draggable. + pub fn handle_select_hover_drag_interactions( &self, response: &egui::Response, selection: impl Into, + draggable: bool, ) { re_tracing::profile_function!(); @@ -146,14 +165,38 @@ impl ViewerContext<'_> { selection_state.set_hovered(selection.clone()); } - if response.double_clicked() { + if draggable && response.drag_started() { + let mut selected_items = selection_state.selected_items().clone(); + let is_already_selected = selection + .iter() + .all(|(item, _)| selected_items.contains_item(item)); + if !is_already_selected { + if response.ctx.input(|i| i.modifiers.command) { + selected_items.extend(selection); + } else { + selected_items = selection; + } + selection_state.set_selection(selected_items.clone()); + } + + let selection_may_be_dragged = self + .undraggable_items + .iter_items() + .all(|item| !selected_items.contains_item(item)); + + let payload = if selection_may_be_dragged { + DragAndDropPayload::from_items(&selected_items) + } else { + DragAndDropPayload::Invalid + }; + + egui::DragAndDrop::set_payload(&response.ctx, payload); + } else if response.double_clicked() { if let Some(item) = selection.first_item() { self.command_sender .send_system(crate::SystemCommand::SetFocus(item.clone())); } - } - - if response.clicked() { + } else if response.clicked() { if response.ctx.input(|i| i.modifiers.command) { selection_state.toggle_selection(selection); } else { diff --git a/crates/viewer/re_viewport/src/viewport_ui.rs b/crates/viewer/re_viewport/src/viewport_ui.rs index 417c313f6e4c..96382c59bd12 100644 --- a/crates/viewer/re_viewport/src/viewport_ui.rs +++ b/crates/viewer/re_viewport/src/viewport_ui.rs @@ -385,15 +385,21 @@ fn apply_viewport_command( {target_position_in_container}" ); - let contents_tile_id = contents_to_move.as_tile_id(); - let target_container_tile_id = blueprint_id_to_tile_id(&target_container); + // TODO(ab): the `rev()` is better preserve ordering when moving a group of items. There + // remains some ordering (and possibly insertion point error) edge cases when dragging + // multiple item within the same container. This should be addressed by egui_tiles: + // https://github.com/rerun-io/egui_tiles/issues/90 + for contents in contents_to_move.iter().rev() { + let contents_tile_id = contents.as_tile_id(); + let target_container_tile_id = blueprint_id_to_tile_id(&target_container); - bp.tree.move_tile_to_container( - contents_tile_id, - target_container_tile_id, - target_position_in_container, - true, - ); + bp.tree.move_tile_to_container( + contents_tile_id, + target_container_tile_id, + target_position_in_container, + true, + ); + } } ViewportCommand::MoveContentsToNewContainer { @@ -600,7 +606,8 @@ impl<'a> egui_tiles::Behavior for TilesDelegate<'a, '_> { &response, SelectionUpdateBehavior::OverrideSelection, ); - self.ctx.select_hovered_on_click(&response, item); + self.ctx + .handle_select_hover_drag_interactions(&response, item, false); } response diff --git a/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs b/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs index 7e235c0508c7..911e53bc3956 100644 --- a/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs +++ b/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs @@ -572,12 +572,12 @@ impl ViewportBlueprint { /// Move the `contents` container or view to the specified target container and position. pub fn move_contents( &self, - contents: Contents, + contents_to_move: Vec, target_container: ContainerId, target_position_in_container: usize, ) { self.enqueue_command(ViewportCommand::MoveContents { - contents_to_move: contents, + contents_to_move, target_container, target_position_in_container, }); diff --git a/crates/viewer/re_viewport_blueprint/src/viewport_command.rs b/crates/viewer/re_viewport_blueprint/src/viewport_command.rs index 75faddedd3bf..8ab43a976c3c 100644 --- a/crates/viewer/re_viewport_blueprint/src/viewport_command.rs +++ b/crates/viewer/re_viewport_blueprint/src/viewport_command.rs @@ -40,7 +40,7 @@ pub enum ViewportCommand { /// Move some contents to a different container MoveContents { - contents_to_move: Contents, + contents_to_move: Vec, target_container: ContainerId, target_position_in_container: usize, }, diff --git a/examples/rust/custom_view/src/color_coordinates_view.rs b/examples/rust/custom_view/src/color_coordinates_view.rs index f01a3ff02b32..2098da981cce 100644 --- a/examples/rust/custom_view/src/color_coordinates_view.rs +++ b/examples/rust/custom_view/src/color_coordinates_view.rs @@ -278,7 +278,11 @@ fn color_space_ui( ctx.recording(), ); }); - ctx.select_hovered_on_click(&interact, Item::DataResult(query.view_id, instance)); + ctx.handle_select_hover_drag_interactions( + &interact, + Item::DataResult(query.view_id, instance), + false, + ); } } From 07b8825f9eb2b43c93b4c85e5af3ba04a79eaf4f Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 11 Dec 2024 18:28:17 +0100 Subject: [PATCH 36/71] Improve picking in 2D views (#8404) ### Related * Closes https://github.com/rerun-io/rerun/issues/6761 ### What When clicking on a geometric primitive (e.g. a point or a box) you will now only select that primitive, and no images below it. Hovering acts the same as before. --- .../viewer/re_view_spatial/src/picking_ui.rs | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/crates/viewer/re_view_spatial/src/picking_ui.rs b/crates/viewer/re_view_spatial/src/picking_ui.rs index a52cf4bff691..b14282fa9d13 100644 --- a/crates/viewer/re_view_spatial/src/picking_ui.rs +++ b/crates/viewer/re_view_spatial/src/picking_ui.rs @@ -77,11 +77,13 @@ pub fn picking( ); state.previous_picking_result = Some(picking_result.clone()); - let mut hovered_items = Vec::new(); + let mut hovered_image_items = Vec::new(); + let mut hovered_non_image_items = Vec::new(); // Depth at pointer used for projecting rays from a hovered 2D view to corresponding 3D view(s). // TODO(#1818): Depth at pointer only works for depth images so far. let mut depth_at_pointer = None; + for (hit_idx, hit) in picking_result.hits.iter().enumerate() { let Some(mut instance_path) = hit.instance_path_hash.resolve(ctx.recording()) else { // Entity no longer exists in db. @@ -161,14 +163,35 @@ pub fn picking( }) }; - hovered_items.push(Item::DataResult(query.view_id, instance_path.clone())); - } + let item = Item::DataResult(query.view_id, instance_path.clone()); - if hovered_items.is_empty() { - // If we hover nothing, we are hovering the view itself. - hovered_items.push(Item::View(query.view_id)); + if hit.hit_type == PickingHitType::TexturedRect { + hovered_image_items.push(item); + } else { + hovered_non_image_items.push(item); + } } + let hovered_items: Vec = { + // Due to how our picking works, if we are hovering a point on top of an RGB and segmentation image, + // we are actually hovering all three things (RGB, segmentation, point). + // For the hovering preview (handled above) this is desierable: we want to zoom in on the + // underlying image(s), even if the mouse slips over a point or some other geometric primitive. + // However, when clicking we assume the users wants to only select the top-most thing. + // + // So we apply the following logic: if the hovered items are a mix of images and non-images, + // then we only select the non-images on click. + + if !hovered_non_image_items.is_empty() { + hovered_non_image_items + } else if !hovered_image_items.is_empty() { + hovered_image_items + } else { + // If we aren't hovering anything, we are hovering the view itself. + vec![Item::View(query.view_id)] + } + }; + // Associate the hovered space with the first item in the hovered item list. // If we were to add several, views might render unnecessary additional hints. // TODO(andreas): Should there be context if no item is hovered at all? There's no usecase for that today it seems. From 2046397e178a0745942c55c691ca196fca999798 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Thu, 12 Dec 2024 09:26:34 +0100 Subject: [PATCH 37/71] Fix applicability filters for bar chart & images (#8425) ### Related * Fixes https://github.com/rerun-io/rerun/issues/8423 ### What bar chart & image applicability filters were the only callers of `diff_component_filter` which broke. Couldn't find any related breakages on a quick search --------- Co-authored-by: Clement Rey --- crates/store/re_chunk/src/chunk.rs | 14 ++++++++++++++ crates/viewer/re_view/src/lib.rs | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/store/re_chunk/src/chunk.rs b/crates/store/re_chunk/src/chunk.rs index 8be91a42be96..b7ddcda62982 100644 --- a/crates/store/re_chunk/src/chunk.rs +++ b/crates/store/re_chunk/src/chunk.rs @@ -73,6 +73,20 @@ impl ChunkComponents { .insert(component_desc, list_array); } + /// Returns all list arrays for the given component name. + /// + /// I.e semantically equivalent to `get("MyComponent:*.*")` + #[inline] + pub fn get_by_component_name<'a>( + &'a self, + component_name: &ComponentName, + ) -> impl Iterator> { + self.get(component_name).map_or_else( + || itertools::Either::Left(std::iter::empty()), + |per_desc| itertools::Either::Right(per_desc.values()), + ) + } + #[inline] pub fn get_by_descriptor( &self, diff --git a/crates/viewer/re_view/src/lib.rs b/crates/viewer/re_view/src/lib.rs index a6507629f525..06580f057a12 100644 --- a/crates/viewer/re_view/src/lib.rs +++ b/crates/viewer/re_view/src/lib.rs @@ -51,8 +51,8 @@ pub fn diff_component_filter( .diff .chunk .components() - .get_by_descriptor(&T::descriptor()) - .map_or(false, |list_array| { + .get_by_component_name(&T::descriptor().component_name) + .any(|list_array| { list_array .iter() .filter_map(|array| array.and_then(|array| T::from_arrow2(&*array).ok())) From 71afae75d8907647b77b6f117e0a1fc135d07f2f Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Thu, 12 Dec 2024 09:39:47 +0100 Subject: [PATCH 38/71] Do query for default components only once per view (#8424) Moves query of default components to the "execute query" stage which we perform for every view at the start of the frame. Previously, we've done this as part of blueprint resolve on every Gives me about 2ms cpu frame time in the 2h airtraffic demo on my windows machine running with single thread (since it's easier to profile, `pixi run rerun-release --threads 1`) with the 3d view maximized and the timline minimized. Change is expected to have high impact for: * many entities * no or few transforms (because the transform cost shadows this win too much and adds a lot of noise) profile snapshots for said scenario: before ![image](https://github.com/user-attachments/assets/009c00f9-d48b-4754-8cab-2539be87a2c1) after: ![image](https://github.com/user-attachments/assets/3e5eb488-caec-49b4-937f-7bdea59a7b17) Related future work: * need short circuiting for overrides as well - we can just know when there's none (and that's naturally very common!!) * short circuit when there's no (fitting) default components? * reduce the amount of query objects being passed around, we have too many of those at this point! --- crates/store/re_query/src/latest_at.rs | 2 +- .../re_selection_panel/src/visualizer_ui.rs | 12 ++--- crates/viewer/re_view/src/query.rs | 36 ++++---------- crates/viewer/re_view/src/results_ext.rs | 24 +++++----- crates/viewer/re_viewer/src/app_state.rs | 9 +++- .../re_viewer_context/src/query_context.rs | 25 ++++++++-- .../re_viewer_context/src/test_context.rs | 2 +- .../src/view/view_context.rs | 2 +- .../viewer/re_viewport_blueprint/src/view.rs | 16 +++++-- .../src/view_contents.rs | 47 +++++++++++++++++-- 10 files changed, 110 insertions(+), 65 deletions(-) diff --git a/crates/store/re_query/src/latest_at.rs b/crates/store/re_query/src/latest_at.rs index 02a42649a4cb..a9b61bcaa627 100644 --- a/crates/store/re_query/src/latest_at.rs +++ b/crates/store/re_query/src/latest_at.rs @@ -208,7 +208,7 @@ impl QueryCache { /// /// Use [`LatestAtResults::get`] and/or [`LatestAtResults::get_required`] in order to access /// the results for each individual component. -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct LatestAtResults { /// The associated [`EntityPath`]. pub entity_path: EntityPath, diff --git a/crates/viewer/re_selection_panel/src/visualizer_ui.rs b/crates/viewer/re_selection_panel/src/visualizer_ui.rs index e6554a0cbc9d..d1645afff8df 100644 --- a/crates/viewer/re_selection_panel/src/visualizer_ui.rs +++ b/crates/viewer/re_selection_panel/src/visualizer_ui.rs @@ -246,19 +246,19 @@ fn visualizer_components( ValueSource::Override => ( ctx.viewer_ctx.blueprint_query, ctx.blueprint_db(), - override_path, + override_path.clone(), result_override.unwrap(), ), ValueSource::Store => ( &store_query, ctx.recording(), - &data_result.entity_path, + data_result.entity_path.clone(), result_store.unwrap(), ), ValueSource::Default => ( ctx.viewer_ctx.blueprint_query, ctx.blueprint_db(), - ctx.defaults_path, + ViewBlueprint::defaults_path(ctx.view_id), result_default.unwrap(), ), ValueSource::FallbackOrPlaceholder => { @@ -280,7 +280,7 @@ fn visualizer_components( }; re_data_ui::ComponentPathLatestAtResults { - component_path: ComponentPath::new(entity_path.clone(), component_name), + component_path: ComponentPath::new(entity_path, component_name), unit: latest_at_unit, } .data_ui(ctx.viewer_ctx, ui, UiLayout::List, query, db); @@ -340,7 +340,7 @@ fn visualizer_components( &query_ctx, ui, "Default", - ctx.defaults_path, + &ViewBlueprint::defaults_path(ctx.view_id), component_name, *row_id, raw_default.as_ref(), @@ -501,7 +501,7 @@ fn menu_more( if ui.button("Make default for current view").clicked() { ctx.save_blueprint_array( - ctx.defaults_path, + &ViewBlueprint::defaults_path(ctx.view_id), component_name, raw_current_value.to_boxed(), ); diff --git a/crates/viewer/re_view/src/query.rs b/crates/viewer/re_view/src/query.rs index 98f3bcdd2ab5..173a6e453831 100644 --- a/crates/viewer/re_view/src/query.rs +++ b/crates/viewer/re_view/src/query.rs @@ -25,13 +25,13 @@ use re_viewer_context::{ /// /// Data should be accessed via the [`crate::RangeResultsExt`] trait which is implemented for /// [`crate::HybridResults`]. -pub fn range_with_blueprint_resolved_data( - ctx: &ViewContext<'_>, +pub fn range_with_blueprint_resolved_data<'a>( + ctx: &ViewContext<'a>, _annotations: Option<&re_viewer_context::Annotations>, range_query: &RangeQuery, data_result: &re_viewer_context::DataResult, component_names: impl IntoIterator, -) -> HybridRangeResults { +) -> HybridRangeResults<'a> { re_tracing::profile_function!(data_result.entity_path.to_string()); let mut component_name_set = component_names.into_iter().collect::>(); @@ -47,20 +47,10 @@ pub fn range_with_blueprint_resolved_data( component_name_set.iter(), ); - // TODO(jleibs): This doesn't work when the component set contains empty results. - // This means we over-query for defaults that will never be used. - // component_set.retain(|component| !results.components.contains_key(component)); - - let defaults = ctx.viewer_ctx.blueprint_engine().cache().latest_at( - ctx.viewer_ctx.blueprint_query, - ctx.defaults_path, - component_name_set.iter().copied(), - ); - HybridRangeResults { overrides, results, - defaults, + defaults: &ctx.query_result.component_defaults, } } @@ -76,14 +66,14 @@ pub fn range_with_blueprint_resolved_data( /// Data should be accessed via the [`crate::RangeResultsExt`] trait which is implemented for /// [`crate::HybridResults`]. /// -/// If `query_shadowed_defaults` is true, all defaults will be queried, even if they are not used. +/// If `query_shadowed_components` is true, store components will be queried, even if they are not used. pub fn latest_at_with_blueprint_resolved_data<'a>( ctx: &'a ViewContext<'a>, _annotations: Option<&'a re_viewer_context::Annotations>, latest_at_query: &LatestAtQuery, data_result: &'a re_viewer_context::DataResult, component_names: impl IntoIterator, - query_shadowed_defaults: bool, + query_shadowed_components: bool, ) -> HybridLatestAtResults<'a> { // This is called very frequently, don't put a profile scope here. @@ -92,7 +82,7 @@ pub fn latest_at_with_blueprint_resolved_data<'a>( let overrides = query_overrides(ctx.viewer_ctx, data_result, component_set.iter()); // No need to query for components that have overrides unless opted in! - if !query_shadowed_defaults { + if !query_shadowed_components { component_set.retain(|component| !overrides.components.contains_key(component)); } @@ -102,20 +92,10 @@ pub fn latest_at_with_blueprint_resolved_data<'a>( component_set.iter().copied(), ); - // TODO(jleibs): This doesn't work when the component set contains empty results. - // This means we over-query for defaults that will never be used. - // component_set.retain(|component| !results.components.contains_key(component)); - - let defaults = ctx.viewer_ctx.blueprint_engine().cache().latest_at( - ctx.viewer_ctx.blueprint_query, - ctx.defaults_path, - component_set.iter().copied(), - ); - HybridLatestAtResults { overrides, results, - defaults, + defaults: &ctx.query_result.component_defaults, ctx, query: latest_at_query.clone(), data_result, diff --git a/crates/viewer/re_view/src/results_ext.rs b/crates/viewer/re_view/src/results_ext.rs index 8e9300a4d508..e69e764482f0 100644 --- a/crates/viewer/re_view/src/results_ext.rs +++ b/crates/viewer/re_view/src/results_ext.rs @@ -21,7 +21,7 @@ use crate::DataResultQuery as _; pub struct HybridLatestAtResults<'a> { pub overrides: LatestAtResults, pub results: LatestAtResults, - pub defaults: LatestAtResults, + pub defaults: &'a LatestAtResults, pub ctx: &'a ViewContext<'a>, pub query: LatestAtQuery, @@ -33,10 +33,10 @@ pub struct HybridLatestAtResults<'a> { /// Although overrides are never temporal, when accessed via the [`crate::RangeResultsExt`] trait /// they will be merged into the results appropriately. #[derive(Debug)] -pub struct HybridRangeResults { +pub struct HybridRangeResults<'a> { pub(crate) overrides: LatestAtResults, pub(crate) results: RangeResults, - pub(crate) defaults: LatestAtResults, + pub(crate) defaults: &'a LatestAtResults, } impl HybridLatestAtResults<'_> { @@ -130,7 +130,7 @@ pub enum HybridResults<'a> { LatestAt(LatestAtQuery, HybridLatestAtResults<'a>), // Boxed because of size difference between variants - Range(RangeQuery, Box), + Range(RangeQuery, Box>), } impl HybridResults<'_> { @@ -141,9 +141,8 @@ impl HybridResults<'_> { match self { Self::LatestAt(_, r) => { let mut indices = Vec::with_capacity( - r.defaults.components.len() - + r.overrides.components.len() - + r.results.components.len(), + // Don't add defaults component count because that's defaults for the entire view. + r.overrides.components.len() + r.results.components.len(), ); indices.extend( @@ -170,9 +169,8 @@ impl HybridResults<'_> { Self::Range(_, r) => { let mut indices = Vec::with_capacity( - r.defaults.components.len() - + r.overrides.components.len() - + r.results.components.len(), // Don't know how many results per component. + // Don't add defaults component count because that's defaults for the entire view. + r.overrides.components.len() + r.results.components.len(), ); indices.extend( @@ -213,9 +211,9 @@ impl<'a> From<(LatestAtQuery, HybridLatestAtResults<'a>)> for HybridResults<'a> } } -impl From<(RangeQuery, HybridRangeResults)> for HybridResults<'_> { +impl<'a> From<(RangeQuery, HybridRangeResults<'a>)> for HybridResults<'a> { #[inline] - fn from((query, results): (RangeQuery, HybridRangeResults)) -> Self { + fn from((query, results): (RangeQuery, HybridRangeResults<'a>)) -> Self { Self::Range(query, Box::new(results)) } } @@ -288,7 +286,7 @@ impl RangeResultsExt for RangeResults { } } -impl RangeResultsExt for HybridRangeResults { +impl<'a> RangeResultsExt for HybridRangeResults<'a> { #[inline] fn get_required_chunks(&self, component_name: &ComponentName) -> Option> { if let Some(unit) = self.overrides.get(component_name) { diff --git a/crates/viewer/re_viewer/src/app_state.rs b/crates/viewer/re_viewer/src/app_state.rs index 8e07b53d6c7c..1d0a1559b13f 100644 --- a/crates/viewer/re_viewer/src/app_state.rs +++ b/crates/viewer/re_viewer/src/app_state.rs @@ -245,8 +245,13 @@ impl AppState { ( view.id, - view.contents - .execute_query(store_context, &visualizable_entities), + view.contents.execute_query( + store_context, + view_class_registry, + &blueprint_query, + view.id, + &visualizable_entities, + ), ) }) .collect::<_>() diff --git a/crates/viewer/re_viewer_context/src/query_context.rs b/crates/viewer/re_viewer_context/src/query_context.rs index 77202194cf30..67cc7e76fe7f 100644 --- a/crates/viewer/re_viewer_context/src/query_context.rs +++ b/crates/viewer/re_viewer_context/src/query_context.rs @@ -5,7 +5,7 @@ use smallvec::SmallVec; use re_log_types::{EntityPath, EntityPathHash}; -use crate::{DataResult, ViewContext, ViewId, ViewState, ViewerContext}; +use crate::{blueprint_timeline, DataResult, ViewContext, ViewId, ViewState, ViewerContext}; slotmap::new_key_type! { /// Identifier for a [`DataResultNode`] @@ -48,8 +48,7 @@ impl QueryContext<'_> { } } -/// The result of executing a single data query -#[derive(Default)] +/// The result of executing a single data query for a specific view. pub struct DataQueryResult { /// The [`DataResultTree`] for the query pub tree: DataResultTree, @@ -62,6 +61,25 @@ pub struct DataQueryResult { /// This does *not* take into account the actual selection of visualizers /// which may be an explicit none for any given entity. pub num_visualized_entities: usize, + + /// Latest-at results for all component defaults in this view. + pub component_defaults: re_query::LatestAtResults, +} + +impl Default for DataQueryResult { + fn default() -> Self { + Self { + tree: Default::default(), + num_matching_entities: 0, + num_visualized_entities: 0, + component_defaults: re_query::LatestAtResults { + entity_path: "".into(), + query: re_chunk_store::LatestAtQuery::latest(blueprint_timeline()), + compound_index: (re_chunk::TimeInt::STATIC, re_chunk::RowId::ZERO), + components: Default::default(), + }, + } + } } impl DataQueryResult { @@ -85,6 +103,7 @@ impl Clone for DataQueryResult { tree: self.tree.clone(), num_matching_entities: self.num_matching_entities, num_visualized_entities: self.num_visualized_entities, + component_defaults: self.component_defaults.clone(), } } } diff --git a/crates/viewer/re_viewer_context/src/test_context.rs b/crates/viewer/re_viewer_context/src/test_context.rs index 0ce951bf7c85..70fae8e9238e 100644 --- a/crates/viewer/re_viewer_context/src/test_context.rs +++ b/crates/viewer/re_viewer_context/src/test_context.rs @@ -29,7 +29,7 @@ pub struct TestContext { pub selection_state: ApplicationSelectionState, pub recording_config: RecordingConfig, - blueprint_query: LatestAtQuery, + pub blueprint_query: LatestAtQuery, component_ui_registry: ComponentUiRegistry, command_sender: CommandSender, diff --git a/crates/viewer/re_viewer_context/src/view/view_context.rs b/crates/viewer/re_viewer_context/src/view/view_context.rs index 6667a893fc67..9f8104552328 100644 --- a/crates/viewer/re_viewer_context/src/view/view_context.rs +++ b/crates/viewer/re_viewer_context/src/view/view_context.rs @@ -19,8 +19,8 @@ pub struct ViewContext<'a> { pub viewer_ctx: &'a crate::ViewerContext<'a>, pub view_id: ViewId, pub view_state: &'a dyn crate::ViewState, - pub defaults_path: &'a EntityPath, pub visualizer_collection: Arc, + pub query_result: &'a DataQueryResult, } impl<'a> ViewContext<'a> { diff --git a/crates/viewer/re_viewport_blueprint/src/view.rs b/crates/viewer/re_viewport_blueprint/src/view.rs index be3648446e80..3177beae78da 100644 --- a/crates/viewer/re_viewport_blueprint/src/view.rs +++ b/crates/viewer/re_viewport_blueprint/src/view.rs @@ -400,8 +400,8 @@ impl ViewBlueprint { viewer_ctx: ctx, view_id: self.id, view_state, - defaults_path: &self.defaults_path, visualizer_collection: self.visualizer_collection(ctx), + query_result: ctx.lookup_query_result(self.id), } } @@ -414,8 +414,8 @@ impl ViewBlueprint { viewer_ctx: ctx, view_id: self.id, view_state, - defaults_path: &self.defaults_path, visualizer_collection: self.visualizer_collection(ctx), + query_result: ctx.lookup_query_result(self.id), } } @@ -715,7 +715,7 @@ mod tests { // Set up a store query and update the overrides. let query_result = - update_overrides(&test_ctx, &view.contents, &visualizable_entities, &resolver); + update_overrides(&test_ctx, &view, &visualizable_entities, &resolver); // Extract component overrides for testing. let mut visited: HashMap> = @@ -745,7 +745,7 @@ mod tests { fn update_overrides( test_ctx: &TestContext, - contents: &ViewContents, + view: &ViewBlueprint, visualizable_entities: &PerVisualizer, resolver: &DataQueryPropertyResolver<'_>, ) -> re_viewer_context::DataQueryResult { @@ -759,7 +759,13 @@ mod tests { hub: &re_viewer_context::StoreHub::test_hub(), }; - let mut query_result = contents.execute_query(&store_ctx, visualizable_entities); + let mut query_result = view.contents.execute_query( + &store_ctx, + &test_ctx.view_class_registry, + &test_ctx.blueprint_query, + view.id, + visualizable_entities, + ); let mut view_states = ViewStates::default(); test_ctx.run_in_egui_central_panel(|ctx, _ui| { diff --git a/crates/viewer/re_viewport_blueprint/src/view_contents.rs b/crates/viewer/re_viewport_blueprint/src/view_contents.rs index 06fd584df7b8..2351767c15da 100644 --- a/crates/viewer/re_viewport_blueprint/src/view_contents.rs +++ b/crates/viewer/re_viewport_blueprint/src/view_contents.rs @@ -1,4 +1,4 @@ -use nohash_hasher::IntMap; +use nohash_hasher::{IntMap, IntSet}; use slotmap::SlotMap; use smallvec::SmallVec; @@ -232,6 +232,9 @@ impl ViewContents { pub fn execute_query( &self, ctx: &re_viewer_context::StoreContext<'_>, + view_class_registry: &re_viewer_context::ViewClassRegistry, + blueprint_query: &LatestAtQuery, + view_id: ViewId, visualizable_entities_for_visualizer_systems: &PerVisualizer, ) -> DataQueryResult { re_tracing::profile_function!(); @@ -261,10 +264,37 @@ impl ViewContents { ) }; + // Query defaults for all the components that any visualizer in this view is interested in. + let component_defaults = { + re_tracing::profile_scope!("component_defaults"); + + let visualizer_collection = + view_class_registry.new_visualizer_collection(self.view_class_identifier); + + // Figure out which components are relevant. + let mut components_for_defaults = IntSet::default(); + for (visualizer, entities) in visualizable_entities_for_visualizer_systems.iter() { + if entities.is_empty() { + continue; + } + let Ok(visualizer) = visualizer_collection.get_by_identifier(*visualizer) else { + continue; + }; + components_for_defaults.extend(visualizer.visualizer_query_info().queried.iter()); + } + + ctx.blueprint.latest_at( + blueprint_query, + &ViewBlueprint::defaults_path(view_id), + components_for_defaults, + ) + }; + DataQueryResult { tree: DataResultTree::new(data_results, root_handle), num_matching_entities, num_visualized_entities, + component_defaults, } } } @@ -558,7 +588,7 @@ mod tests { use re_chunk::{Chunk, RowId}; use re_entity_db::EntityDb; use re_log_types::{example_components::MyPoint, StoreId, TimePoint, Timeline}; - use re_viewer_context::{StoreContext, StoreHub, VisualizableEntities}; + use re_viewer_context::{blueprint_timeline, StoreContext, StoreHub, VisualizableEntities}; use super::*; @@ -571,6 +601,7 @@ mod tests { let timeline_frame = Timeline::new_sequence("frame"); let timepoint = TimePoint::from_iter([(timeline_frame, 10)]); + let view_class_registry = ViewClassRegistry::default(); // Set up a store DB with some entities for entity_path in ["parent", "parent/skipped/child1", "parent/skipped/child2"] { @@ -696,14 +727,20 @@ mod tests { ]; for (i, Scenario { filter, outputs }) in scenarios.into_iter().enumerate() { + let view_id = ViewId::random(); let contents = ViewContents::new( - ViewId::random(), + view_id, "3D".into(), EntityPathFilter::parse_forgiving(filter, &space_env), ); - let query_result = - contents.execute_query(&ctx, &visualizable_entities_for_visualizer_systems); + let query_result = contents.execute_query( + &ctx, + &view_class_registry, + &LatestAtQuery::latest(blueprint_timeline()), + view_id, + &visualizable_entities_for_visualizer_systems, + ); let mut visited = vec![]; query_result.tree.visit(&mut |node| { From 1a9135db865bc863cd4370eac4150438e421839d Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Thu, 12 Dec 2024 10:18:51 +0100 Subject: [PATCH 39/71] `re_types_blueprint` -> `re_types::blueprint` (#8419) Having blueprint types in a separate crate makes everything more complicated, for little to no benefits as far as I can tell. It is particularly bad when reflection is involved, as it introduces unavoidable dependency cycles. This PR merges them. --- ARCHITECTURE.md | 11 +- Cargo.lock | 17 --- Cargo.toml | 1 - .../archetypes/container_blueprint.fbs | 3 +- .../blueprint/archetypes/panel_blueprint.fbs | 5 +- .../archetypes/viewport_blueprint.fbs | 3 +- .../blueprint/components/auto_layout.fbs | 3 +- .../rerun/blueprint/components/auto_views.fbs | 1 - .../blueprint/components/container_kind.fbs | 3 +- .../blueprint/components/grid_columns.fbs | 3 +- .../blueprint/components/root_container.fbs | 4 +- .../blueprint/components/view_maximized.fbs | 4 +- .../components/visualizer_overrides.fbs | 3 +- .../rerun/blueprint/datatypes/utf8_list.fbs | 3 +- .../src/blueprint/archetypes/.gitattributes | 3 + .../archetypes/container_blueprint.rs | 0 .../re_types/src/blueprint/archetypes/mod.rs | 6 + .../blueprint/archetypes/panel_blueprint.rs | 2 + .../archetypes/viewport_blueprint.rs | 0 .../src/blueprint/components/.gitattributes | 7 + .../src/blueprint/components/auto_layout.rs | 0 .../blueprint/components/auto_layout_ext.rs | 2 +- .../src/blueprint/components/auto_views.rs | 0 .../blueprint/components/container_kind.rs | 0 .../src/blueprint/components/grid_columns.rs | 0 .../re_types/src/blueprint/components/mod.rs | 15 ++ .../blueprint/components/root_container.rs | 1 - .../blueprint/components/view_maximized.rs | 1 - .../components/visualizer_overrides.rs | 0 .../src/blueprint/datatypes/.gitattributes | 1 + .../re_types/src/blueprint/datatypes/mod.rs | 3 + .../src/blueprint/datatypes/utf8list.rs | 0 .../src/blueprint/datatypes/utf8list_ext.rs | 0 .../store/re_types_blueprint/.gitattributes | 129 ------------------ crates/store/re_types_blueprint/Cargo.toml | 41 ------ crates/store/re_types_blueprint/README.md | 10 -- .../src/blueprint/archetypes/.gitattributes | 7 - .../src/blueprint/archetypes/mod.rs | 9 -- .../src/blueprint/components/.gitattributes | 11 -- .../src/blueprint/components/mod.rs | 18 --- .../src/blueprint/datatypes/.gitattributes | 5 - .../src/blueprint/datatypes/mod.rs | 6 - .../re_types_blueprint/src/blueprint/mod.rs | 12 -- crates/store/re_types_blueprint/src/lib.rs | 14 -- crates/store/re_types_core/src/reflection.rs | 2 +- crates/viewer/re_component_ui/Cargo.toml | 1 - crates/viewer/re_component_ui/src/lib.rs | 2 +- crates/viewer/re_selection_panel/Cargo.toml | 1 - .../re_selection_panel/src/visualizer_ui.rs | 2 +- crates/viewer/re_viewer/Cargo.toml | 1 - .../src/blueprint/validation_gen/mod.rs | 14 +- crates/viewer/re_viewer/src/reflection/mod.rs | 4 +- crates/viewer/re_viewport/Cargo.toml | 1 - crates/viewer/re_viewport/src/lib.rs | 2 +- .../viewer/re_viewport_blueprint/Cargo.toml | 1 - .../re_viewport_blueprint/src/container.rs | 17 ++- .../viewer/re_viewport_blueprint/src/lib.rs | 16 +-- .../src/view_contents.rs | 2 +- .../src/viewport_blueprint.rs | 8 +- .../blueprint/archetypes/panel_blueprint.hpp | 2 + .../blueprint/archetypes/panel_blueprint.py | 14 +- 61 files changed, 104 insertions(+), 353 deletions(-) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/archetypes/container_blueprint.rs (100%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/archetypes/panel_blueprint.rs (98%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/archetypes/viewport_blueprint.rs (100%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/components/auto_layout.rs (100%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/components/auto_layout_ext.rs (80%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/components/auto_views.rs (100%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/components/container_kind.rs (100%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/components/grid_columns.rs (100%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/components/root_container.rs (99%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/components/view_maximized.rs (99%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/components/visualizer_overrides.rs (100%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/datatypes/utf8list.rs (100%) rename crates/store/{re_types_blueprint => re_types}/src/blueprint/datatypes/utf8list_ext.rs (100%) delete mode 100644 crates/store/re_types_blueprint/.gitattributes delete mode 100644 crates/store/re_types_blueprint/Cargo.toml delete mode 100644 crates/store/re_types_blueprint/README.md delete mode 100644 crates/store/re_types_blueprint/src/blueprint/archetypes/.gitattributes delete mode 100644 crates/store/re_types_blueprint/src/blueprint/archetypes/mod.rs delete mode 100644 crates/store/re_types_blueprint/src/blueprint/components/.gitattributes delete mode 100644 crates/store/re_types_blueprint/src/blueprint/components/mod.rs delete mode 100644 crates/store/re_types_blueprint/src/blueprint/datatypes/.gitattributes delete mode 100644 crates/store/re_types_blueprint/src/blueprint/datatypes/mod.rs delete mode 100644 crates/store/re_types_blueprint/src/blueprint/mod.rs delete mode 100644 crates/store/re_types_blueprint/src/lib.rs diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index f1713242422f..7ac2edc0cfa9 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -88,11 +88,11 @@ Of course, this will only take us so far. In the future we plan on caching queri Here is an overview of the crates included in the project: - - - - - + + + + + @@ -168,7 +168,6 @@ Update instructions: | re_protos | Rerun remote store gRPC API types | | re_query | Querying data in the re_chunk_store | | re_types | The built-in Rerun data types, component types, and archetypes. | -| re_types_blueprint | The core traits and types that power Rerun's Blueprint sub-system. | ### Low-level store diff --git a/Cargo.lock b/Cargo.lock index 4a5eee7bfb59..8f3a411f3fb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5698,7 +5698,6 @@ dependencies = [ "re_log_types", "re_tracing", "re_types", - "re_types_blueprint", "re_types_core", "re_ui", "re_viewer_context", @@ -6295,7 +6294,6 @@ dependencies = [ "re_log_types", "re_tracing", "re_types", - "re_types_blueprint", "re_types_core", "re_ui", "re_view", @@ -6423,18 +6421,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "re_types_blueprint" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "arrow", - "once_cell", - "re_arrow2", - "re_tracing", - "re_types", - "re_types_core", -] - [[package]] name = "re_types_builder" version = "0.21.0-alpha.1+dev" @@ -6828,7 +6814,6 @@ dependencies = [ "re_time_panel", "re_tracing", "re_types", - "re_types_blueprint", "re_types_core", "re_ui", "re_video", @@ -6932,7 +6917,6 @@ dependencies = [ "re_renderer", "re_tracing", "re_types", - "re_types_blueprint", "re_ui", "re_view", "re_viewer_context", @@ -6957,7 +6941,6 @@ dependencies = [ "re_log_types", "re_tracing", "re_types", - "re_types_blueprint", "re_types_core", "re_ui", "re_viewer_context", diff --git a/Cargo.toml b/Cargo.toml index 7eacba039f5c..73d17d1b009f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,6 @@ re_log_types = { path = "crates/store/re_log_types", version = "=0.21.0-alpha.1" re_query = { path = "crates/store/re_query", version = "=0.21.0-alpha.1", default-features = false } re_sdk_comms = { path = "crates/store/re_sdk_comms", version = "=0.21.0-alpha.1", default-features = false } re_types = { path = "crates/store/re_types", version = "=0.21.0-alpha.1", default-features = false } -re_types_blueprint = { path = "crates/store/re_types_blueprint", version = "=0.21.0-alpha.1", default-features = false } re_types_core = { path = "crates/store/re_types_core", version = "=0.21.0-alpha.1", default-features = false } re_ws_comms = { path = "crates/store/re_ws_comms", version = "=0.21.0-alpha.1", default-features = false } diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs index a1b95850a063..454ab1f93ff0 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs @@ -4,8 +4,7 @@ namespace rerun.blueprint.archetypes; /// The description of a container. table ContainerBlueprint ( - "attr.rerun.scope": "blueprint", - "attr.rust.override_crate": "re_types_blueprint" + "attr.rerun.scope": "blueprint" ) { // --- Required --- diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/panel_blueprint.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/panel_blueprint.fbs index 4fa6a08e5a2e..28660dc25330 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/panel_blueprint.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/panel_blueprint.fbs @@ -5,12 +5,13 @@ namespace rerun.blueprint.archetypes; /// Shared state for the 3 collapsible panels. table PanelBlueprint ( "attr.rerun.scope": "blueprint", - "attr.rust.derive": "Default", - "attr.rust.override_crate": "re_types_blueprint" + "attr.rust.derive": "Default" ) { // --- Required --- // --- Optional --- + + /// Current state of the panels. state: rerun.blueprint.components.PanelState ("attr.rerun.component_optional", nullable, order: 1000); // TODO(jleibs): Add a float to track how expanded the panel is. diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/viewport_blueprint.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/viewport_blueprint.fbs index 8b1d46d6e9a1..dc0cfff65e0f 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/viewport_blueprint.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/viewport_blueprint.fbs @@ -5,8 +5,7 @@ namespace rerun.blueprint.archetypes; /// The top-level description of the viewport. table ViewportBlueprint ( "attr.rerun.scope": "blueprint", - "attr.rust.derive": "Default", - "attr.rust.override_crate": "re_types_blueprint" + "attr.rust.derive": "Default" ) { // --- Required --- diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/auto_layout.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/auto_layout.fbs index ebe3e7a437e6..025913652bd1 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/auto_layout.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/auto_layout.fbs @@ -6,10 +6,9 @@ namespace rerun.blueprint.components; /// Whether the viewport layout is determined automatically. struct AutoLayout ( "attr.arrow.transparent", - "attr.rerun.scope": "blueprint", "attr.python.aliases": "bool", + "attr.rerun.scope": "blueprint", "attr.rust.derive": "Copy", - "attr.rust.override_crate": "re_types_blueprint", "attr.rust.repr": "transparent", "attr.rust.tuple_struct" ) { diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/auto_views.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/auto_views.fbs index ce4a452dd4c3..ad17a39f9225 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/auto_views.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/auto_views.fbs @@ -7,7 +7,6 @@ struct AutoViews ( "attr.rerun.scope": "blueprint", "attr.python.aliases": "bool", "attr.rust.derive": "Copy, Default, PartialEq, Eq, PartialOrd, Ord", - "attr.rust.override_crate": "re_types_blueprint", "attr.rust.repr": "transparent", "attr.rust.tuple_struct" ) { diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/container_kind.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/container_kind.fbs index d4339e9221a7..043da7f771cf 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/container_kind.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/container_kind.fbs @@ -3,8 +3,7 @@ namespace rerun.blueprint.components; /// The kind of a blueprint container (tabs, grid, …). enum ContainerKind: ubyte ( - "attr.rerun.scope": "blueprint", - "attr.rust.override_crate": "re_types_blueprint" + "attr.rerun.scope": "blueprint" ) { /// Invalid value. Won't show up in generated types. Invalid = 0, diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/grid_columns.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/grid_columns.fbs index eed5b34e013e..16659fef59d0 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/grid_columns.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/grid_columns.fbs @@ -5,8 +5,7 @@ namespace rerun.blueprint.components; table GridColumns ( "attr.rerun.scope": "blueprint", "attr.python.aliases": "int", - "attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord", - "attr.rust.override_crate": "re_types_blueprint" + "attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord" ) { /// The number of columns. columns: rerun.datatypes.UInt32 (order: 100); diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/root_container.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/root_container.fbs index ee6348f84cfe..2eb333c6f891 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/root_container.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/root_container.fbs @@ -7,9 +7,7 @@ namespace rerun.blueprint.components; table RootContainer ( "attr.rerun.scope": "blueprint", "attr.python.aliases": "npt.NDArray[np.uint8], npt.ArrayLike, Sequence[int], bytes", - "attr.rust.derive": "Default", - "attr.rust.override_crate": "re_types_blueprint", - "attr.rust.repr": "transparent" + "attr.rust.derive": "Default" ) { /// `ContainerId` for the root. id: rerun.datatypes.Uuid (order: 100); diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/view_maximized.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/view_maximized.fbs index 405e62cbcbc7..6bf29a4de998 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/view_maximized.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/view_maximized.fbs @@ -4,9 +4,7 @@ namespace rerun.blueprint.components; table ViewMaximized ( "attr.rerun.scope": "blueprint", "attr.python.aliases": "npt.NDArray[np.uint8], npt.ArrayLike, Sequence[int], bytes", - "attr.rust.derive": "Default", - "attr.rust.override_crate": "re_types_blueprint", - "attr.rust.repr": "transparent" + "attr.rust.derive": "Default" ) { view_id: rerun.datatypes.Uuid (order: 100); } diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/visualizer_overrides.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/visualizer_overrides.fbs index fedd2980d452..dc07e47ccb0a 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components/visualizer_overrides.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components/visualizer_overrides.fbs @@ -17,8 +17,7 @@ table VisualizerOverrides ( "attr.python.array_aliases": "str", "attr.rerun.scope": "blueprint", "attr.rust.derive": "PartialEq, Eq, PartialOrd, Ord, Default", - "attr.rust.repr": "transparent", - "attr.rust.override_crate": "re_types_blueprint" + "attr.rust.repr": "transparent" ) { /// Names of the visualizers that should be active. visualizers: rerun.blueprint.datatypes.Utf8List (order: 100); diff --git a/crates/store/re_types/definitions/rerun/blueprint/datatypes/utf8_list.fbs b/crates/store/re_types/definitions/rerun/blueprint/datatypes/utf8_list.fbs index febfb90d4d2b..cf030552acfd 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/datatypes/utf8_list.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/datatypes/utf8_list.fbs @@ -9,8 +9,7 @@ table Utf8List ( "attr.rerun.scope": "blueprint", "attr.rust.derive": "PartialEq, Eq, PartialOrd, Ord, Default, Hash", "attr.rust.repr": "transparent", - "attr.rust.tuple_struct", - "attr.rust.override_crate": "re_types_blueprint" + "attr.rust.tuple_struct" ) { value: [string] (order: 100); } diff --git a/crates/store/re_types/src/blueprint/archetypes/.gitattributes b/crates/store/re_types/src/blueprint/archetypes/.gitattributes index 1065a18b6415..e8331953aab0 100644 --- a/crates/store/re_types/src/blueprint/archetypes/.gitattributes +++ b/crates/store/re_types/src/blueprint/archetypes/.gitattributes @@ -2,6 +2,7 @@ .gitattributes linguist-generated=true background.rs linguist-generated=true +container_blueprint.rs linguist-generated=true dataframe_query.rs linguist-generated=true force_center.rs linguist-generated=true force_collision_radius.rs linguist-generated=true @@ -12,6 +13,7 @@ line_grid3d.rs linguist-generated=true map_background.rs linguist-generated=true map_zoom.rs linguist-generated=true mod.rs linguist-generated=true +panel_blueprint.rs linguist-generated=true plot_legend.rs linguist-generated=true scalar_axis.rs linguist-generated=true tensor_scalar_mapping.rs linguist-generated=true @@ -19,5 +21,6 @@ tensor_slice_selection.rs linguist-generated=true tensor_view_fit.rs linguist-generated=true view_blueprint.rs linguist-generated=true view_contents.rs linguist-generated=true +viewport_blueprint.rs linguist-generated=true visible_time_ranges.rs linguist-generated=true visual_bounds2d.rs linguist-generated=true diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs b/crates/store/re_types/src/blueprint/archetypes/container_blueprint.rs similarity index 100% rename from crates/store/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs rename to crates/store/re_types/src/blueprint/archetypes/container_blueprint.rs diff --git a/crates/store/re_types/src/blueprint/archetypes/mod.rs b/crates/store/re_types/src/blueprint/archetypes/mod.rs index 3590029048a5..c0b54d19a91d 100644 --- a/crates/store/re_types/src/blueprint/archetypes/mod.rs +++ b/crates/store/re_types/src/blueprint/archetypes/mod.rs @@ -1,6 +1,7 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs mod background; +mod container_blueprint; mod dataframe_query; mod force_center; mod force_collision_radius; @@ -10,6 +11,7 @@ mod force_position; mod line_grid3d; mod map_background; mod map_zoom; +mod panel_blueprint; mod plot_legend; mod scalar_axis; mod tensor_scalar_mapping; @@ -17,11 +19,13 @@ mod tensor_slice_selection; mod tensor_view_fit; mod view_blueprint; mod view_contents; +mod viewport_blueprint; mod visible_time_ranges; mod visible_time_ranges_ext; mod visual_bounds2d; pub use self::background::Background; +pub use self::container_blueprint::ContainerBlueprint; pub use self::dataframe_query::DataframeQuery; pub use self::force_center::ForceCenter; pub use self::force_collision_radius::ForceCollisionRadius; @@ -31,6 +35,7 @@ pub use self::force_position::ForcePosition; pub use self::line_grid3d::LineGrid3D; pub use self::map_background::MapBackground; pub use self::map_zoom::MapZoom; +pub use self::panel_blueprint::PanelBlueprint; pub use self::plot_legend::PlotLegend; pub use self::scalar_axis::ScalarAxis; pub use self::tensor_scalar_mapping::TensorScalarMapping; @@ -38,5 +43,6 @@ pub use self::tensor_slice_selection::TensorSliceSelection; pub use self::tensor_view_fit::TensorViewFit; pub use self::view_blueprint::ViewBlueprint; pub use self::view_contents::ViewContents; +pub use self::viewport_blueprint::ViewportBlueprint; pub use self::visible_time_ranges::VisibleTimeRanges; pub use self::visual_bounds2d::VisualBounds2D; diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs b/crates/store/re_types/src/blueprint/archetypes/panel_blueprint.rs similarity index 98% rename from crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs rename to crates/store/re_types/src/blueprint/archetypes/panel_blueprint.rs index 8197210161ae..7f55137e124f 100644 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs +++ b/crates/store/re_types/src/blueprint/archetypes/panel_blueprint.rs @@ -21,6 +21,7 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: Shared state for the 3 collapsible panels. #[derive(Clone, Debug, Default)] pub struct PanelBlueprint { + /// Current state of the panels. pub state: Option, } @@ -166,6 +167,7 @@ impl PanelBlueprint { Self { state: None } } + /// Current state of the panels. #[inline] pub fn with_state( mut self, diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs b/crates/store/re_types/src/blueprint/archetypes/viewport_blueprint.rs similarity index 100% rename from crates/store/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs rename to crates/store/re_types/src/blueprint/archetypes/viewport_blueprint.rs diff --git a/crates/store/re_types/src/blueprint/components/.gitattributes b/crates/store/re_types/src/blueprint/components/.gitattributes index 8ad1b4e0df36..26c669440aaf 100644 --- a/crates/store/re_types/src/blueprint/components/.gitattributes +++ b/crates/store/re_types/src/blueprint/components/.gitattributes @@ -3,9 +3,12 @@ .gitattributes linguist-generated=true active_tab.rs linguist-generated=true apply_latest_at.rs linguist-generated=true +auto_layout.rs linguist-generated=true +auto_views.rs linguist-generated=true background_kind.rs linguist-generated=true column_share.rs linguist-generated=true component_column_selector.rs linguist-generated=true +container_kind.rs linguist-generated=true corner2d.rs linguist-generated=true enabled.rs linguist-generated=true filter_by_range.rs linguist-generated=true @@ -13,6 +16,7 @@ filter_is_not_null.rs linguist-generated=true force_distance.rs linguist-generated=true force_iterations.rs linguist-generated=true force_strength.rs linguist-generated=true +grid_columns.rs linguist-generated=true grid_spacing.rs linguist-generated=true included_content.rs linguist-generated=true interactive.rs linguist-generated=true @@ -22,15 +26,18 @@ mod.rs linguist-generated=true near_clip_plane.rs linguist-generated=true panel_state.rs linguist-generated=true query_expression.rs linguist-generated=true +root_container.rs linguist-generated=true row_share.rs linguist-generated=true selected_columns.rs linguist-generated=true tensor_dimension_index_slider.rs linguist-generated=true timeline_name.rs linguist-generated=true view_class.rs linguist-generated=true view_fit.rs linguist-generated=true +view_maximized.rs linguist-generated=true view_origin.rs linguist-generated=true viewer_recommendation_hash.rs linguist-generated=true visible.rs linguist-generated=true visible_time_range.rs linguist-generated=true visual_bounds2d.rs linguist-generated=true +visualizer_overrides.rs linguist-generated=true zoom_level.rs linguist-generated=true diff --git a/crates/store/re_types_blueprint/src/blueprint/components/auto_layout.rs b/crates/store/re_types/src/blueprint/components/auto_layout.rs similarity index 100% rename from crates/store/re_types_blueprint/src/blueprint/components/auto_layout.rs rename to crates/store/re_types/src/blueprint/components/auto_layout.rs diff --git a/crates/store/re_types_blueprint/src/blueprint/components/auto_layout_ext.rs b/crates/store/re_types/src/blueprint/components/auto_layout_ext.rs similarity index 80% rename from crates/store/re_types_blueprint/src/blueprint/components/auto_layout_ext.rs rename to crates/store/re_types/src/blueprint/components/auto_layout_ext.rs index 4113abafc344..79573e7901fe 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/auto_layout_ext.rs +++ b/crates/store/re_types/src/blueprint/components/auto_layout_ext.rs @@ -1,4 +1,4 @@ -use re_types::datatypes::Bool; +use crate::datatypes::Bool; use super::AutoLayout; diff --git a/crates/store/re_types_blueprint/src/blueprint/components/auto_views.rs b/crates/store/re_types/src/blueprint/components/auto_views.rs similarity index 100% rename from crates/store/re_types_blueprint/src/blueprint/components/auto_views.rs rename to crates/store/re_types/src/blueprint/components/auto_views.rs diff --git a/crates/store/re_types_blueprint/src/blueprint/components/container_kind.rs b/crates/store/re_types/src/blueprint/components/container_kind.rs similarity index 100% rename from crates/store/re_types_blueprint/src/blueprint/components/container_kind.rs rename to crates/store/re_types/src/blueprint/components/container_kind.rs diff --git a/crates/store/re_types_blueprint/src/blueprint/components/grid_columns.rs b/crates/store/re_types/src/blueprint/components/grid_columns.rs similarity index 100% rename from crates/store/re_types_blueprint/src/blueprint/components/grid_columns.rs rename to crates/store/re_types/src/blueprint/components/grid_columns.rs diff --git a/crates/store/re_types/src/blueprint/components/mod.rs b/crates/store/re_types/src/blueprint/components/mod.rs index 78723bc794d0..7933d51c393a 100644 --- a/crates/store/re_types/src/blueprint/components/mod.rs +++ b/crates/store/re_types/src/blueprint/components/mod.rs @@ -2,10 +2,14 @@ mod active_tab; mod apply_latest_at; +mod auto_layout; +mod auto_layout_ext; +mod auto_views; mod background_kind; mod column_share; mod component_column_selector; mod component_column_selector_ext; +mod container_kind; mod corner2d; mod corner2d_ext; mod enabled; @@ -17,6 +21,7 @@ mod filter_is_not_null_ext; mod force_distance; mod force_iterations; mod force_strength; +mod grid_columns; mod grid_spacing; mod grid_spacing_ext; mod included_content; @@ -29,6 +34,7 @@ mod near_clip_plane_ext; mod panel_state; mod panel_state_ext; mod query_expression; +mod root_container; mod row_share; mod selected_columns; mod tensor_dimension_index_slider; @@ -38,6 +44,7 @@ mod timeline_name_ext; mod view_class; mod view_class_ext; mod view_fit; +mod view_maximized; mod view_origin; mod view_origin_ext; mod viewer_recommendation_hash; @@ -47,13 +54,17 @@ mod visible_ext; mod visible_time_range; mod visual_bounds2d; mod visual_bounds2d_ext; +mod visualizer_overrides; mod zoom_level; pub use self::active_tab::ActiveTab; pub use self::apply_latest_at::ApplyLatestAt; +pub use self::auto_layout::AutoLayout; +pub use self::auto_views::AutoViews; pub use self::background_kind::BackgroundKind; pub use self::column_share::ColumnShare; pub use self::component_column_selector::ComponentColumnSelector; +pub use self::container_kind::ContainerKind; pub use self::corner2d::Corner2D; pub use self::enabled::Enabled; pub use self::filter_by_range::FilterByRange; @@ -61,6 +72,7 @@ pub use self::filter_is_not_null::FilterIsNotNull; pub use self::force_distance::ForceDistance; pub use self::force_iterations::ForceIterations; pub use self::force_strength::ForceStrength; +pub use self::grid_columns::GridColumns; pub use self::grid_spacing::GridSpacing; pub use self::included_content::IncludedContent; pub use self::interactive::Interactive; @@ -69,15 +81,18 @@ pub use self::map_provider::MapProvider; pub use self::near_clip_plane::NearClipPlane; pub use self::panel_state::PanelState; pub use self::query_expression::QueryExpression; +pub use self::root_container::RootContainer; pub use self::row_share::RowShare; pub use self::selected_columns::SelectedColumns; pub use self::tensor_dimension_index_slider::TensorDimensionIndexSlider; pub use self::timeline_name::TimelineName; pub use self::view_class::ViewClass; pub use self::view_fit::ViewFit; +pub use self::view_maximized::ViewMaximized; pub use self::view_origin::ViewOrigin; pub use self::viewer_recommendation_hash::ViewerRecommendationHash; pub use self::visible::Visible; pub use self::visible_time_range::VisibleTimeRange; pub use self::visual_bounds2d::VisualBounds2D; +pub use self::visualizer_overrides::VisualizerOverrides; pub use self::zoom_level::ZoomLevel; diff --git a/crates/store/re_types_blueprint/src/blueprint/components/root_container.rs b/crates/store/re_types/src/blueprint/components/root_container.rs similarity index 99% rename from crates/store/re_types_blueprint/src/blueprint/components/root_container.rs rename to crates/store/re_types/src/blueprint/components/root_container.rs index 9cfc9017f5d9..be4161f2de22 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/root_container.rs +++ b/crates/store/re_types/src/blueprint/components/root_container.rs @@ -20,7 +20,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: The container that sits at the root of a viewport. #[derive(Clone, Debug, Default)] -#[repr(transparent)] pub struct RootContainer( /// `ContainerId` for the root. pub crate::datatypes::Uuid, diff --git a/crates/store/re_types_blueprint/src/blueprint/components/view_maximized.rs b/crates/store/re_types/src/blueprint/components/view_maximized.rs similarity index 99% rename from crates/store/re_types_blueprint/src/blueprint/components/view_maximized.rs rename to crates/store/re_types/src/blueprint/components/view_maximized.rs index 27214db2194d..013b81cebc55 100644 --- a/crates/store/re_types_blueprint/src/blueprint/components/view_maximized.rs +++ b/crates/store/re_types/src/blueprint/components/view_maximized.rs @@ -20,7 +20,6 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: Whether a view is maximized. #[derive(Clone, Debug, Default)] -#[repr(transparent)] pub struct ViewMaximized(pub crate::datatypes::Uuid); impl ::re_types_core::Component for ViewMaximized { diff --git a/crates/store/re_types_blueprint/src/blueprint/components/visualizer_overrides.rs b/crates/store/re_types/src/blueprint/components/visualizer_overrides.rs similarity index 100% rename from crates/store/re_types_blueprint/src/blueprint/components/visualizer_overrides.rs rename to crates/store/re_types/src/blueprint/components/visualizer_overrides.rs diff --git a/crates/store/re_types/src/blueprint/datatypes/.gitattributes b/crates/store/re_types/src/blueprint/datatypes/.gitattributes index a5c2c2463632..3bf07cdc7a4b 100644 --- a/crates/store/re_types/src/blueprint/datatypes/.gitattributes +++ b/crates/store/re_types/src/blueprint/datatypes/.gitattributes @@ -7,3 +7,4 @@ filter_is_not_null.rs linguist-generated=true mod.rs linguist-generated=true selected_columns.rs linguist-generated=true tensor_dimension_index_slider.rs linguist-generated=true +utf8list.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/datatypes/mod.rs b/crates/store/re_types/src/blueprint/datatypes/mod.rs index b60da1620294..3998c09c31b9 100644 --- a/crates/store/re_types/src/blueprint/datatypes/mod.rs +++ b/crates/store/re_types/src/blueprint/datatypes/mod.rs @@ -6,9 +6,12 @@ mod filter_by_range; mod filter_is_not_null; mod selected_columns; mod tensor_dimension_index_slider; +mod utf8list; +mod utf8list_ext; pub use self::component_column_selector::ComponentColumnSelector; pub use self::filter_by_range::FilterByRange; pub use self::filter_is_not_null::FilterIsNotNull; pub use self::selected_columns::SelectedColumns; pub use self::tensor_dimension_index_slider::TensorDimensionIndexSlider; +pub use self::utf8list::Utf8List; diff --git a/crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list.rs b/crates/store/re_types/src/blueprint/datatypes/utf8list.rs similarity index 100% rename from crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list.rs rename to crates/store/re_types/src/blueprint/datatypes/utf8list.rs diff --git a/crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list_ext.rs b/crates/store/re_types/src/blueprint/datatypes/utf8list_ext.rs similarity index 100% rename from crates/store/re_types_blueprint/src/blueprint/datatypes/utf8list_ext.rs rename to crates/store/re_types/src/blueprint/datatypes/utf8list_ext.rs diff --git a/crates/store/re_types_blueprint/.gitattributes b/crates/store/re_types_blueprint/.gitattributes deleted file mode 100644 index 60dfe558e9de..000000000000 --- a/crates/store/re_types_blueprint/.gitattributes +++ /dev/null @@ -1,129 +0,0 @@ -# DO NOT EDIT! This file is generated by crates/build/re_types_builder/src/lib.rs - -.gitattributes linguist-generated=true -src/archetypes/annotation_context.rs linguist-generated=true -src/archetypes/arrows3d.rs linguist-generated=true -src/archetypes/asset3d.rs linguist-generated=true -src/archetypes/bar_chart.rs linguist-generated=true -src/archetypes/boxes2d.rs linguist-generated=true -src/archetypes/boxes3d.rs linguist-generated=true -src/archetypes/clear.rs linguist-generated=true -src/archetypes/depth_image.rs linguist-generated=true -src/archetypes/disconnected_space.rs linguist-generated=true -src/archetypes/image.rs linguist-generated=true -src/archetypes/line_strips2d.rs linguist-generated=true -src/archetypes/line_strips3d.rs linguist-generated=true -src/archetypes/mesh3d.rs linguist-generated=true -src/archetypes/mod.rs linguist-generated=true -src/archetypes/pinhole.rs linguist-generated=true -src/archetypes/points2d.rs linguist-generated=true -src/archetypes/points3d.rs linguist-generated=true -src/archetypes/segmentation_image.rs linguist-generated=true -src/archetypes/tensor.rs linguist-generated=true -src/archetypes/text_document.rs linguist-generated=true -src/archetypes/text_log.rs linguist-generated=true -src/archetypes/time_series_scalar.rs linguist-generated=true -src/archetypes/transform3d.rs linguist-generated=true -src/archetypes/view_coordinates.rs linguist-generated=true -src/components/annotation_context.rs linguist-generated=true -src/components/blob.rs linguist-generated=true -src/components/class_id.rs linguist-generated=true -src/components/clear_is_recursive.rs linguist-generated=true -src/components/color.rs linguist-generated=true -src/components/depth_meter.rs linguist-generated=true -src/components/disconnected_space.rs linguist-generated=true -src/components/draw_order.rs linguist-generated=true -src/components/half_size2d.rs linguist-generated=true -src/components/half_size3d.rs linguist-generated=true -src/components/instance_key.rs linguist-generated=true -src/components/keypoint_id.rs linguist-generated=true -src/components/line_strip2d.rs linguist-generated=true -src/components/line_strip3d.rs linguist-generated=true -src/components/material.rs linguist-generated=true -src/components/media_type.rs linguist-generated=true -src/components/mesh_properties.rs linguist-generated=true -src/components/mod.rs linguist-generated=true -src/components/out_of_tree_transform3d.rs linguist-generated=true -src/components/pinhole_projection.rs linguist-generated=true -src/components/position2d.rs linguist-generated=true -src/components/position3d.rs linguist-generated=true -src/components/radius.rs linguist-generated=true -src/components/resolution.rs linguist-generated=true -src/components/rotation3d.rs linguist-generated=true -src/components/scalar.rs linguist-generated=true -src/components/scalar_scattering.rs linguist-generated=true -src/components/tensor_data.rs linguist-generated=true -src/components/text.rs linguist-generated=true -src/components/text_log_level.rs linguist-generated=true -src/components/transform3d.rs linguist-generated=true -src/components/vector3d.rs linguist-generated=true -src/components/view_coordinates.rs linguist-generated=true -src/datatypes/angle.rs linguist-generated=true -src/datatypes/annotation_info.rs linguist-generated=true -src/datatypes/class_description.rs linguist-generated=true -src/datatypes/class_description_map_elem.rs linguist-generated=true -src/datatypes/class_id.rs linguist-generated=true -src/datatypes/float32.rs linguist-generated=true -src/datatypes/keypoint_id.rs linguist-generated=true -src/datatypes/keypoint_pair.rs linguist-generated=true -src/datatypes/mat3x3.rs linguist-generated=true -src/datatypes/mat4x4.rs linguist-generated=true -src/datatypes/material.rs linguist-generated=true -src/datatypes/mesh_properties.rs linguist-generated=true -src/datatypes/mod.rs linguist-generated=true -src/datatypes/quaternion.rs linguist-generated=true -src/datatypes/rgba32.rs linguist-generated=true -src/datatypes/rotation3d.rs linguist-generated=true -src/datatypes/rotation_axis_angle.rs linguist-generated=true -src/datatypes/scale3d.rs linguist-generated=true -src/datatypes/tensor_buffer.rs linguist-generated=true -src/datatypes/tensor_data.rs linguist-generated=true -src/datatypes/tensor_dimension.rs linguist-generated=true -src/datatypes/transform3d.rs linguist-generated=true -src/datatypes/translation_and_mat3x3.rs linguist-generated=true -src/datatypes/translation_rotation_scale3d.rs linguist-generated=true -src/datatypes/utf8.rs linguist-generated=true -src/datatypes/uvec2d.rs linguist-generated=true -src/datatypes/uvec3d.rs linguist-generated=true -src/datatypes/uvec4d.rs linguist-generated=true -src/datatypes/vec2d.rs linguist-generated=true -src/datatypes/vec3d.rs linguist-generated=true -src/datatypes/vec4d.rs linguist-generated=true -src/testing/archetypes/affix_fuzzer1.rs linguist-generated=true -src/testing/archetypes/affix_fuzzer2.rs linguist-generated=true -src/testing/archetypes/affix_fuzzer3.rs linguist-generated=true -src/testing/archetypes/affix_fuzzer4.rs linguist-generated=true -src/testing/archetypes/mod.rs linguist-generated=true -src/testing/components/affix_fuzzer1.rs linguist-generated=true -src/testing/components/affix_fuzzer10.rs linguist-generated=true -src/testing/components/affix_fuzzer11.rs linguist-generated=true -src/testing/components/affix_fuzzer12.rs linguist-generated=true -src/testing/components/affix_fuzzer13.rs linguist-generated=true -src/testing/components/affix_fuzzer14.rs linguist-generated=true -src/testing/components/affix_fuzzer15.rs linguist-generated=true -src/testing/components/affix_fuzzer16.rs linguist-generated=true -src/testing/components/affix_fuzzer17.rs linguist-generated=true -src/testing/components/affix_fuzzer18.rs linguist-generated=true -src/testing/components/affix_fuzzer19.rs linguist-generated=true -src/testing/components/affix_fuzzer2.rs linguist-generated=true -src/testing/components/affix_fuzzer20.rs linguist-generated=true -src/testing/components/affix_fuzzer21.rs linguist-generated=true -src/testing/components/affix_fuzzer3.rs linguist-generated=true -src/testing/components/affix_fuzzer4.rs linguist-generated=true -src/testing/components/affix_fuzzer5.rs linguist-generated=true -src/testing/components/affix_fuzzer6.rs linguist-generated=true -src/testing/components/affix_fuzzer7.rs linguist-generated=true -src/testing/components/affix_fuzzer8.rs linguist-generated=true -src/testing/components/affix_fuzzer9.rs linguist-generated=true -src/testing/components/mod.rs linguist-generated=true -src/testing/datatypes/affix_fuzzer1.rs linguist-generated=true -src/testing/datatypes/affix_fuzzer2.rs linguist-generated=true -src/testing/datatypes/affix_fuzzer20.rs linguist-generated=true -src/testing/datatypes/affix_fuzzer21.rs linguist-generated=true -src/testing/datatypes/affix_fuzzer3.rs linguist-generated=true -src/testing/datatypes/affix_fuzzer4.rs linguist-generated=true -src/testing/datatypes/affix_fuzzer5.rs linguist-generated=true -src/testing/datatypes/flattened_scalar.rs linguist-generated=true -src/testing/datatypes/mod.rs linguist-generated=true -src/testing/datatypes/primitive_component.rs linguist-generated=true -src/testing/datatypes/string_component.rs linguist-generated=true diff --git a/crates/store/re_types_blueprint/Cargo.toml b/crates/store/re_types_blueprint/Cargo.toml deleted file mode 100644 index 2be0628e2c03..000000000000 --- a/crates/store/re_types_blueprint/Cargo.toml +++ /dev/null @@ -1,41 +0,0 @@ -[package] -name = "re_types_blueprint" -authors.workspace = true -description = "The core traits and types that power Rerun's Blueprint sub-system." -edition.workspace = true -homepage.workspace = true -include.workspace = true -license.workspace = true -publish = true -readme = "README.md" -repository.workspace = true -rust-version.workspace = true -version.workspace = true - -[lints] -workspace = true - - -[package.metadata.docs.rs] -all-features = true - - -[features] -default = [] - - -[dependencies] -# Rerun -re_tracing.workspace = true -re_types.workspace = true -re_types_core.workspace = true - -# External -arrow.workspace = true -arrow2 = { workspace = true, features = [ - "arrow", - "compute_concatenate", - "io_ipc", - "io_print", -] } -once_cell.workspace = true diff --git a/crates/store/re_types_blueprint/README.md b/crates/store/re_types_blueprint/README.md deleted file mode 100644 index 64d32d0349d3..000000000000 --- a/crates/store/re_types_blueprint/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# re_types_blueprint - -Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates. - -[![Latest version](https://img.shields.io/crates/v/re_types.svg)](https://crates.io/crates/re_types) -[![Documentation](https://docs.rs/re_types/badge.svg)](https://docs.rs/re_types) -![MIT](https://img.shields.io/badge/license-MIT-blue.svg) -![Apache](https://img.shields.io/badge/license-Apache-blue.svg) - -The core traits and types that power Rerun's Blueprint sub-system. diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/.gitattributes b/crates/store/re_types_blueprint/src/blueprint/archetypes/.gitattributes deleted file mode 100644 index b89073c8d068..000000000000 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/.gitattributes +++ /dev/null @@ -1,7 +0,0 @@ -# DO NOT EDIT! This file is generated by crates/build/re_types_builder/src/lib.rs - -.gitattributes linguist-generated=true -container_blueprint.rs linguist-generated=true -mod.rs linguist-generated=true -panel_blueprint.rs linguist-generated=true -viewport_blueprint.rs linguist-generated=true diff --git a/crates/store/re_types_blueprint/src/blueprint/archetypes/mod.rs b/crates/store/re_types_blueprint/src/blueprint/archetypes/mod.rs deleted file mode 100644 index 45429f55fa41..000000000000 --- a/crates/store/re_types_blueprint/src/blueprint/archetypes/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs - -mod container_blueprint; -mod panel_blueprint; -mod viewport_blueprint; - -pub use self::container_blueprint::ContainerBlueprint; -pub use self::panel_blueprint::PanelBlueprint; -pub use self::viewport_blueprint::ViewportBlueprint; diff --git a/crates/store/re_types_blueprint/src/blueprint/components/.gitattributes b/crates/store/re_types_blueprint/src/blueprint/components/.gitattributes deleted file mode 100644 index 2978e26ea33d..000000000000 --- a/crates/store/re_types_blueprint/src/blueprint/components/.gitattributes +++ /dev/null @@ -1,11 +0,0 @@ -# DO NOT EDIT! This file is generated by crates/build/re_types_builder/src/lib.rs - -.gitattributes linguist-generated=true -auto_layout.rs linguist-generated=true -auto_views.rs linguist-generated=true -container_kind.rs linguist-generated=true -grid_columns.rs linguist-generated=true -mod.rs linguist-generated=true -root_container.rs linguist-generated=true -view_maximized.rs linguist-generated=true -visualizer_overrides.rs linguist-generated=true diff --git a/crates/store/re_types_blueprint/src/blueprint/components/mod.rs b/crates/store/re_types_blueprint/src/blueprint/components/mod.rs deleted file mode 100644 index dfb9de45eef6..000000000000 --- a/crates/store/re_types_blueprint/src/blueprint/components/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs - -mod auto_layout; -mod auto_layout_ext; -mod auto_views; -mod container_kind; -mod grid_columns; -mod root_container; -mod view_maximized; -mod visualizer_overrides; - -pub use self::auto_layout::AutoLayout; -pub use self::auto_views::AutoViews; -pub use self::container_kind::ContainerKind; -pub use self::grid_columns::GridColumns; -pub use self::root_container::RootContainer; -pub use self::view_maximized::ViewMaximized; -pub use self::visualizer_overrides::VisualizerOverrides; diff --git a/crates/store/re_types_blueprint/src/blueprint/datatypes/.gitattributes b/crates/store/re_types_blueprint/src/blueprint/datatypes/.gitattributes deleted file mode 100644 index c3dfab32d1bc..000000000000 --- a/crates/store/re_types_blueprint/src/blueprint/datatypes/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -# DO NOT EDIT! This file is generated by crates/build/re_types_builder/src/lib.rs - -.gitattributes linguist-generated=true -mod.rs linguist-generated=true -utf8list.rs linguist-generated=true diff --git a/crates/store/re_types_blueprint/src/blueprint/datatypes/mod.rs b/crates/store/re_types_blueprint/src/blueprint/datatypes/mod.rs deleted file mode 100644 index faad0f80b2d2..000000000000 --- a/crates/store/re_types_blueprint/src/blueprint/datatypes/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs - -mod utf8list; -mod utf8list_ext; - -pub use self::utf8list::Utf8List; diff --git a/crates/store/re_types_blueprint/src/blueprint/mod.rs b/crates/store/re_types_blueprint/src/blueprint/mod.rs deleted file mode 100644 index e67e9c5c4658..000000000000 --- a/crates/store/re_types_blueprint/src/blueprint/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -pub mod archetypes; - -pub mod components { - - #[path = "../components/mod.rs"] - mod _components; - - pub use self::_components::*; - pub use re_types::blueprint::components::*; -} - -pub mod datatypes; diff --git a/crates/store/re_types_blueprint/src/lib.rs b/crates/store/re_types_blueprint/src/lib.rs deleted file mode 100644 index 837d8cbc8f0c..000000000000 --- a/crates/store/re_types_blueprint/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -//! The core types and traits that power Rerun's Blueprint sub-system. - -/// Auto-generated blueprint-related types. -/// -/// They all implement the [`re_types_core::Component`] trait. -/// -/// Unstable. Used for the ongoing blueprint experimentation. -pub mod blueprint; - -// TODO(andreas): Workaround for referencing non-blueprint components from blueprint archetypes. -pub(crate) use re_types::datatypes; -pub(crate) mod components { - pub use re_types::components::Name; -} diff --git a/crates/store/re_types_core/src/reflection.rs b/crates/store/re_types_core/src/reflection.rs index 3f57ec665df7..5d1c633b97cf 100644 --- a/crates/store/re_types_core/src/reflection.rs +++ b/crates/store/re_types_core/src/reflection.rs @@ -25,7 +25,7 @@ impl Reflection { /// /// Useful when the only information available is the short name, e.g. when inferring archetype /// names from an indicator component. - //TODO( #6889): tagged component will contain a fully qualified archetype name, so this function + //TODO(#6889): tagged component will contain a fully qualified archetype name, so this function // will be unnecessary. pub fn archetype_reflection_from_short_name( &self, diff --git a/crates/viewer/re_component_ui/Cargo.toml b/crates/viewer/re_component_ui/Cargo.toml index c6a0f3329325..eac5afe72e67 100644 --- a/crates/viewer/re_component_ui/Cargo.toml +++ b/crates/viewer/re_component_ui/Cargo.toml @@ -28,7 +28,6 @@ re_tracing.workspace = true re_types = { workspace = true, features = [ "egui_plot", # Needed to draw marker shapes. ] } -re_types_blueprint.workspace = true # Needed to give some of the components a custom ui. Could happen in any other crate as well. re_types_core.workspace = true re_ui.workspace = true re_viewer_context.workspace = true diff --git a/crates/viewer/re_component_ui/src/lib.rs b/crates/viewer/re_component_ui/src/lib.rs index 5150d8ee061d..bbed24bfd956 100644 --- a/crates/viewer/re_component_ui/src/lib.rs +++ b/crates/viewer/re_component_ui/src/lib.rs @@ -34,6 +34,7 @@ use datatype_uis::{ view_view_id, }; +use re_types::blueprint::components::{RootContainer, ViewMaximized}; use re_types::{ blueprint::components::{ BackgroundKind, Corner2D, Enabled, ForceDistance, ForceIterations, ForceStrength, @@ -47,7 +48,6 @@ use re_types::{ }, Component as _, }; -use re_types_blueprint::blueprint::components::{RootContainer, ViewMaximized}; use re_viewer_context::gpu_bridge::colormap_edit_or_view_ui; /// Default number of ui points to show a number. diff --git a/crates/viewer/re_selection_panel/Cargo.toml b/crates/viewer/re_selection_panel/Cargo.toml index be4440087b19..aa09cf939c9a 100644 --- a/crates/viewer/re_selection_panel/Cargo.toml +++ b/crates/viewer/re_selection_panel/Cargo.toml @@ -29,7 +29,6 @@ re_log_types.workspace = true re_log.workspace = true re_view.workspace = true re_tracing.workspace = true -re_types_blueprint.workspace = true # TODO(jleibs): Remove this once VisualizerOverrides is gone re_types_core.workspace = true re_types.workspace = true re_ui.workspace = true diff --git a/crates/viewer/re_selection_panel/src/visualizer_ui.rs b/crates/viewer/re_selection_panel/src/visualizer_ui.rs index d1645afff8df..9f10aac8862a 100644 --- a/crates/viewer/re_selection_panel/src/visualizer_ui.rs +++ b/crates/viewer/re_selection_panel/src/visualizer_ui.rs @@ -4,8 +4,8 @@ use re_chunk::{ComponentName, RowId, UnitChunkShared}; use re_data_ui::{sorted_component_list_for_ui, DataUi}; use re_entity_db::EntityDb; use re_log_types::{ComponentPath, EntityPath}; +use re_types::blueprint::components::VisualizerOverrides; use re_types::external::arrow2; -use re_types_blueprint::blueprint::components::VisualizerOverrides; use re_ui::{list_item, UiExt as _}; use re_view::latest_at_with_blueprint_resolved_data; use re_viewer_context::{ diff --git a/crates/viewer/re_viewer/Cargo.toml b/crates/viewer/re_viewer/Cargo.toml index 18f55819dca5..ae496fc924a6 100644 --- a/crates/viewer/re_viewer/Cargo.toml +++ b/crates/viewer/re_viewer/Cargo.toml @@ -81,7 +81,6 @@ re_view_text_log.workspace = true re_view_time_series.workspace = true re_time_panel.workspace = true re_tracing = { workspace = true, features = ["server"] } -re_types_blueprint.workspace = true re_types_core.workspace = true re_types.workspace = true re_ui.workspace = true diff --git a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs index bed35cf8a280..d38838f0f70c 100644 --- a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs +++ b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs @@ -3,9 +3,12 @@ use super::validation::validate_component; use re_entity_db::EntityDb; pub use re_types::blueprint::components::ActiveTab; pub use re_types::blueprint::components::ApplyLatestAt; +pub use re_types::blueprint::components::AutoLayout; +pub use re_types::blueprint::components::AutoViews; pub use re_types::blueprint::components::BackgroundKind; pub use re_types::blueprint::components::ColumnShare; pub use re_types::blueprint::components::ComponentColumnSelector; +pub use re_types::blueprint::components::ContainerKind; pub use re_types::blueprint::components::Corner2D; pub use re_types::blueprint::components::Enabled; pub use re_types::blueprint::components::FilterByRange; @@ -13,6 +16,7 @@ pub use re_types::blueprint::components::FilterIsNotNull; pub use re_types::blueprint::components::ForceDistance; pub use re_types::blueprint::components::ForceIterations; pub use re_types::blueprint::components::ForceStrength; +pub use re_types::blueprint::components::GridColumns; pub use re_types::blueprint::components::GridSpacing; pub use re_types::blueprint::components::IncludedContent; pub use re_types::blueprint::components::Interactive; @@ -21,25 +25,21 @@ pub use re_types::blueprint::components::MapProvider; pub use re_types::blueprint::components::NearClipPlane; pub use re_types::blueprint::components::PanelState; pub use re_types::blueprint::components::QueryExpression; +pub use re_types::blueprint::components::RootContainer; pub use re_types::blueprint::components::RowShare; pub use re_types::blueprint::components::SelectedColumns; pub use re_types::blueprint::components::TensorDimensionIndexSlider; pub use re_types::blueprint::components::TimelineName; pub use re_types::blueprint::components::ViewClass; pub use re_types::blueprint::components::ViewFit; +pub use re_types::blueprint::components::ViewMaximized; pub use re_types::blueprint::components::ViewOrigin; pub use re_types::blueprint::components::ViewerRecommendationHash; pub use re_types::blueprint::components::Visible; pub use re_types::blueprint::components::VisibleTimeRange; pub use re_types::blueprint::components::VisualBounds2D; +pub use re_types::blueprint::components::VisualizerOverrides; pub use re_types::blueprint::components::ZoomLevel; -pub use re_types_blueprint::blueprint::components::AutoLayout; -pub use re_types_blueprint::blueprint::components::AutoViews; -pub use re_types_blueprint::blueprint::components::ContainerKind; -pub use re_types_blueprint::blueprint::components::GridColumns; -pub use re_types_blueprint::blueprint::components::RootContainer; -pub use re_types_blueprint::blueprint::components::ViewMaximized; -pub use re_types_blueprint::blueprint::components::VisualizerOverrides; /// Because blueprints are both read and written the schema must match what /// we expect to find or else we will run into all kinds of problems. diff --git a/crates/viewer/re_viewer/src/reflection/mod.rs b/crates/viewer/re_viewer/src/reflection/mod.rs index de51ce63624a..078c12c34885 100644 --- a/crates/viewer/re_viewer/src/reflection/mod.rs +++ b/crates/viewer/re_viewer/src/reflection/mod.rs @@ -5,7 +5,6 @@ #![allow(unused_imports)] use re_types::blueprint::components::*; use re_types::components::*; -use re_types_blueprint::blueprint::components::*; use re_types_core::components::*; use re_types_core::{ reflection::{ @@ -2145,7 +2144,8 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { fields: vec![ ArchetypeFieldReflection { component_name : "rerun.blueprint.components.PanelState".into(), display_name : - "State", docstring_md : "", is_required : false, }, + "State", docstring_md : "Current state of the panels.", is_required : + false, }, ], }, ), diff --git a/crates/viewer/re_viewport/Cargo.toml b/crates/viewer/re_viewport/Cargo.toml index af5a315504a9..fe80f4c3b184 100644 --- a/crates/viewer/re_viewport/Cargo.toml +++ b/crates/viewer/re_viewport/Cargo.toml @@ -32,7 +32,6 @@ re_renderer = { workspace = true, default-features = false, features = [ re_view.workspace = true re_tracing.workspace = true re_types.workspace = true -re_types_blueprint.workspace = true re_ui.workspace = true re_viewer_context.workspace = true re_viewport_blueprint.workspace = true diff --git a/crates/viewer/re_viewport/src/lib.rs b/crates/viewer/re_viewport/src/lib.rs index d69e424ae48f..5d1449a06318 100644 --- a/crates/viewer/re_viewport/src/lib.rs +++ b/crates/viewer/re_viewport/src/lib.rs @@ -13,6 +13,6 @@ mod viewport_ui; pub use self::viewport_ui::ViewportUi; pub mod external { - pub use re_types_blueprint; + pub use re_types; pub use re_view; } diff --git a/crates/viewer/re_viewport_blueprint/Cargo.toml b/crates/viewer/re_viewport_blueprint/Cargo.toml index 368b1db6acc8..e4a982608ae9 100644 --- a/crates/viewer/re_viewport_blueprint/Cargo.toml +++ b/crates/viewer/re_viewport_blueprint/Cargo.toml @@ -25,7 +25,6 @@ re_entity_db.workspace = true re_log.workspace = true re_log_types.workspace = true re_tracing.workspace = true -re_types_blueprint.workspace = true re_types_core.workspace = true re_types.workspace = true re_ui.workspace = true diff --git a/crates/viewer/re_viewport_blueprint/src/container.rs b/crates/viewer/re_viewport_blueprint/src/container.rs index 85cc1d7ee065..af0b03fb810f 100644 --- a/crates/viewer/re_viewport_blueprint/src/container.rs +++ b/crates/viewer/re_viewport_blueprint/src/container.rs @@ -4,13 +4,13 @@ use egui_tiles::TileId; use re_chunk::LatestAtQuery; use re_entity_db::EntityDb; use re_log_types::EntityPath; +use re_types::blueprint::archetypes as blueprint_archetypes; +use re_types::blueprint::components::{ContainerKind, GridColumns}; use re_types::components::Name; use re_types::{blueprint::components::Visible, Archetype as _}; -use re_types_blueprint::blueprint::archetypes as blueprint_archetypes; -use re_types_blueprint::blueprint::components::{ContainerKind, GridColumns}; use re_viewer_context::{ContainerId, Contents, ContentsName, ViewId, ViewerContext}; -/// The native version of a [`re_types_blueprint::blueprint::archetypes::ContainerBlueprint`]. +/// The native version of a [`re_types::blueprint::archetypes::ContainerBlueprint`]. /// /// This represents a single container in the blueprint. On each frame, it is /// used to populate an [`egui_tiles::Container`]. Each child in `contents` can @@ -180,12 +180,11 @@ impl ContainerBlueprint { let contents: Vec<_> = contents.iter().map(|item| item.as_entity_path()).collect(); let container_kind = crate::container_kind_from_egui(*container_kind); - let mut arch = - re_types_blueprint::blueprint::archetypes::ContainerBlueprint::new(container_kind) - .with_contents(&contents) - .with_col_shares(col_shares.clone()) - .with_row_shares(row_shares.clone()) - .with_visible(*visible); + let mut arch = re_types::blueprint::archetypes::ContainerBlueprint::new(container_kind) + .with_contents(&contents) + .with_col_shares(col_shares.clone()) + .with_row_shares(row_shares.clone()) + .with_visible(*visible); // Note: it's important to _not_ clear the `Name` component if `display_name` is set to // `None`, as we call this function with `ContainerBlueprint` recreated from `egui_tiles`, diff --git a/crates/viewer/re_viewport_blueprint/src/lib.rs b/crates/viewer/re_viewport_blueprint/src/lib.rs index 3ec02beb7356..5ed6164daf1c 100644 --- a/crates/viewer/re_viewport_blueprint/src/lib.rs +++ b/crates/viewer/re_viewport_blueprint/src/lib.rs @@ -21,15 +21,15 @@ pub use viewport_command::ViewportCommand; /// The entity path of the viewport blueprint in the blueprint store. pub const VIEWPORT_PATH: &str = "viewport"; -/// Converts a [`re_types_blueprint::blueprint::components::ContainerKind`] into a [`egui_tiles::ContainerKind`]. +/// Converts a [`re_types::blueprint::components::ContainerKind`] into a [`egui_tiles::ContainerKind`]. /// -/// Does not implement the `From`/`To` traits because we don't want `re_types_blueprint` to depend +/// Does not implement the `From`/`To` traits because we don't want `re_types` to depend /// on `egui`, and we cannot do it from here because of orphan rules. #[inline] pub fn container_kind_to_egui( - kind: re_types_blueprint::blueprint::components::ContainerKind, + kind: re_types::blueprint::components::ContainerKind, ) -> egui_tiles::ContainerKind { - use re_types_blueprint::blueprint::components::ContainerKind; + use re_types::blueprint::components::ContainerKind; match kind { ContainerKind::Tabs => egui_tiles::ContainerKind::Tabs, ContainerKind::Horizontal => egui_tiles::ContainerKind::Horizontal, @@ -38,15 +38,15 @@ pub fn container_kind_to_egui( } } -/// Converts a [`egui_tiles::ContainerKind`] into a [`re_types_blueprint::blueprint::components::ContainerKind`]. +/// Converts a [`egui_tiles::ContainerKind`] into a [`re_types::blueprint::components::ContainerKind`]. /// -/// Does not implement the `From`/`To` traits because we don't want `re_types_blueprint` to depend +/// Does not implement the `From`/`To` traits because we don't want `re_types` to depend /// on `egui`, and we cannot do it from here because of orphan rules. #[inline] pub fn container_kind_from_egui( kind: egui_tiles::ContainerKind, -) -> re_types_blueprint::blueprint::components::ContainerKind { - use re_types_blueprint::blueprint::components::ContainerKind; +) -> re_types::blueprint::components::ContainerKind { + use re_types::blueprint::components::ContainerKind; match kind { egui_tiles::ContainerKind::Tabs => ContainerKind::Tabs, egui_tiles::ContainerKind::Horizontal => ContainerKind::Horizontal, diff --git a/crates/viewer/re_viewport_blueprint/src/view_contents.rs b/crates/viewer/re_viewport_blueprint/src/view_contents.rs index 2351767c15da..ef4079f1f515 100644 --- a/crates/viewer/re_viewport_blueprint/src/view_contents.rs +++ b/crates/viewer/re_viewport_blueprint/src/view_contents.rs @@ -6,6 +6,7 @@ use re_entity_db::{external::re_chunk_store::LatestAtQuery, EntityDb, EntityTree use re_log_types::{ path::RuleEffect, EntityPath, EntityPathFilter, EntityPathRule, EntityPathSubs, Timeline, }; +use re_types::blueprint::components::VisualizerOverrides; use re_types::{ blueprint::{ archetypes as blueprint_archetypes, components as blueprint_components, @@ -13,7 +14,6 @@ use re_types::{ }, Archetype as _, ViewClassIdentifier, }; -use re_types_blueprint::blueprint::components::VisualizerOverrides; use re_types_core::ComponentName; use re_viewer_context::{ ApplicableEntities, DataQueryResult, DataResult, DataResultHandle, DataResultNode, diff --git a/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs b/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs index 911e53bc3956..f26dc39cda30 100644 --- a/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs +++ b/crates/viewer/re_viewport_blueprint/src/viewport_blueprint.rs @@ -14,13 +14,13 @@ use smallvec::SmallVec; use re_chunk_store::LatestAtQuery; use re_entity_db::EntityPath; -use re_types::{ - blueprint::components::ViewerRecommendationHash, Archetype as _, ViewClassIdentifier, -}; -use re_types_blueprint::blueprint::{ +use re_types::blueprint::{ archetypes as blueprint_archetypes, components::{AutoLayout, AutoViews, RootContainer, ViewMaximized}, }; +use re_types::{ + blueprint::components::ViewerRecommendationHash, Archetype as _, ViewClassIdentifier, +}; use re_viewer_context::{ blueprint_id_to_tile_id, ContainerId, Contents, Item, ViewId, ViewerContext, }; diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/panel_blueprint.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/panel_blueprint.hpp index 7f3f44c62d4e..79c674928cfa 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/panel_blueprint.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/panel_blueprint.hpp @@ -18,6 +18,7 @@ namespace rerun::blueprint::archetypes { /// **Archetype**: Shared state for the 3 collapsible panels. struct PanelBlueprint { + /// Current state of the panels. std::optional state; public: @@ -31,6 +32,7 @@ namespace rerun::blueprint::archetypes { PanelBlueprint() = default; PanelBlueprint(PanelBlueprint&& other) = default; + /// Current state of the panels. PanelBlueprint with_state(rerun::blueprint::components::PanelState _state) && { state = std::move(_state); // See: https://github.com/rerun-io/rerun/issues/4027 diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/panel_blueprint.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/panel_blueprint.py index 97aa8fc0744a..e9554a2d2053 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/panel_blueprint.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/panel_blueprint.py @@ -23,7 +23,15 @@ class PanelBlueprint(Archetype): """**Archetype**: Shared state for the 3 collapsible panels.""" def __init__(self: Any, *, state: blueprint_components.PanelStateLike | None = None): - """Create a new instance of the PanelBlueprint archetype.""" + """ + Create a new instance of the PanelBlueprint archetype. + + Parameters + ---------- + state: + Current state of the panels. + + """ # You can define your own __init__ function as a member of PanelBlueprintExt in panel_blueprint_ext.py with catch_and_log_exceptions(context=self.__class__.__name__): @@ -49,5 +57,9 @@ def _clear(cls) -> PanelBlueprint: default=None, converter=blueprint_components.PanelStateBatch._optional, # type: ignore[misc] ) + # Current state of the panels. + # + # (Docstring intentionally commented out to hide this field from the docs) + __str__ = Archetype.__str__ __repr__ = Archetype.__repr__ # type: ignore[assignment] From d9b65f8b24a7faa1ddf2eb8fb9eeda2cf085e396 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Thu, 12 Dec 2024 10:19:53 +0100 Subject: [PATCH 40/71] `re_viewer::reflection` -> `re_types::reflection` (#8420) Make the reflection available to everyone. * DNM: requires #8419 --- .../src/codegen/rust/reflection.rs | 35 ++++++++++++------- crates/store/re_chunk/src/chunk.rs | 2 +- crates/store/re_types/src/lib.rs | 16 +++++++++ .../re_types}/src/reflection/.gitattributes | 0 .../re_types}/src/reflection/mod.rs | 4 +-- crates/viewer/re_viewer/src/app.rs | 2 +- crates/viewer/re_viewer/src/lib.rs | 6 ++-- scripts/ci/check_large_files.py | 2 +- 8 files changed, 47 insertions(+), 20 deletions(-) rename crates/{viewer/re_viewer => store/re_types}/src/reflection/.gitattributes (100%) rename crates/{viewer/re_viewer => store/re_types}/src/reflection/mod.rs (99%) diff --git a/crates/build/re_types_builder/src/codegen/rust/reflection.rs b/crates/build/re_types_builder/src/codegen/rust/reflection.rs index 308929bbef70..c3c7739001a1 100644 --- a/crates/build/re_types_builder/src/codegen/rust/reflection.rs +++ b/crates/build/re_types_builder/src/codegen/rust/reflection.rs @@ -23,7 +23,7 @@ pub fn generate_reflection( // Put into its own subfolder since codegen is set up in a way that it thinks that everything // inside the folder is either generated or an extension to the generated code. // This way we don't have to build an exception just for this file. - let path = Utf8PathBuf::from("crates/viewer/re_viewer/src/reflection/mod.rs"); + let path = Utf8PathBuf::from("crates/store/re_types/src/reflection/mod.rs"); let mut imports = BTreeSet::new(); let component_reflection = generate_component_reflection( @@ -60,9 +60,9 @@ pub fn generate_reflection( SerializationError, }; - /// Generates reflection about all known components. - /// - /// Call only once and reuse the results. + #[doc = "Generates reflection about all known components."] + #[doc = ""] + #[doc = "Call only once and reuse the results."] pub fn generate_reflection() -> Result { re_tracing::profile_function!(); @@ -95,10 +95,11 @@ fn generate_component_reflection( .objects_of_kind(ObjectKind::Component) .filter(|obj| !obj.is_testing()) { + let crate_name = patched_crate_name(&obj.crate_name()); if let Some(scope) = obj.scope() { - imports.insert(format!("{}::{scope}::components::*", obj.crate_name())); + imports.insert(format!("{crate_name}::{scope}::components::*")); } else { - imports.insert(format!("{}::components::*", obj.crate_name())); + imports.insert(format!("{crate_name}::components::*")); } let type_name = format_ident!("{}", obj.name); @@ -152,9 +153,9 @@ fn generate_component_reflection( } quote! { - /// Generates reflection about all known components. - /// - /// Call only once and reuse the results. + #[doc = "Generates reflection about all known components."] + #[doc = ""] + #[doc = "Call only once and reuse the results."] fn generate_component_reflection() -> Result { re_tracing::profile_function!(); let array = [ @@ -246,9 +247,9 @@ fn generate_archetype_reflection(reporter: &Reporter, objects: &Objects) -> Toke } quote! { - /// Generates reflection about all known archetypes. - /// - /// Call only once and reuse the results. + #[doc = "Generates reflection about all known archetypes."] + #[doc = ""] + #[doc = "Call only once and reuse the results."] fn generate_archetype_reflection() -> ArchetypeReflectionMap { re_tracing::profile_function!(); let array = [ @@ -258,3 +259,13 @@ fn generate_archetype_reflection(reporter: &Reporter, objects: &Objects) -> Toke } } } + +/// Returns `crate_name` as is, unless it's `re_types`, in which case it's replace by `crate`, +/// because that's where this code lives. +fn patched_crate_name(crate_name: &str) -> String { + if crate_name == "re_types" { + "crate".to_owned() + } else { + crate_name.to_owned() + } +} diff --git a/crates/store/re_chunk/src/chunk.rs b/crates/store/re_chunk/src/chunk.rs index b7ddcda62982..8184bb5178d7 100644 --- a/crates/store/re_chunk/src/chunk.rs +++ b/crates/store/re_chunk/src/chunk.rs @@ -74,7 +74,7 @@ impl ChunkComponents { } /// Returns all list arrays for the given component name. - /// + /// /// I.e semantically equivalent to `get("MyComponent:*.*")` #[inline] pub fn get_by_component_name<'a>( diff --git a/crates/store/re_types/src/lib.rs b/crates/store/re_types/src/lib.rs index f6e07a7d97f0..9ad5c1d25cf2 100644 --- a/crates/store/re_types/src/lib.rs +++ b/crates/store/re_types/src/lib.rs @@ -246,6 +246,22 @@ pub mod datatypes { /// The blueprint-specific components. pub mod blueprint; +/// Run-time reflection for reading meta-data about components and archetypes. +pub mod reflection { + + // Some reflection types are so fundamental and used everywhere that we want them to be + // exposed by `re_types_core` directly; that way we don't force a dependency on the `re_types` + // behemoth just so one can use one of these fundamental reflection types. + // + // To do so, re-inject `re_types_core`'s datatypes into our own module. + + #[path = "../reflection/mod.rs"] + mod _reflection; + + pub use self::_reflection::*; + pub use re_types_core::reflection::*; +} + // --- // One almost never uses `re_types` without `re_types_core`, so we reexport these core types diff --git a/crates/viewer/re_viewer/src/reflection/.gitattributes b/crates/store/re_types/src/reflection/.gitattributes similarity index 100% rename from crates/viewer/re_viewer/src/reflection/.gitattributes rename to crates/store/re_types/src/reflection/.gitattributes diff --git a/crates/viewer/re_viewer/src/reflection/mod.rs b/crates/store/re_types/src/reflection/mod.rs similarity index 99% rename from crates/viewer/re_viewer/src/reflection/mod.rs rename to crates/store/re_types/src/reflection/mod.rs index 078c12c34885..ee95b1db1c8f 100644 --- a/crates/viewer/re_viewer/src/reflection/mod.rs +++ b/crates/store/re_types/src/reflection/mod.rs @@ -3,8 +3,8 @@ #![allow(clippy::too_many_lines)] #![allow(clippy::wildcard_imports)] #![allow(unused_imports)] -use re_types::blueprint::components::*; -use re_types::components::*; +use crate::blueprint::components::*; +use crate::components::*; use re_types_core::components::*; use re_types_core::{ reflection::{ diff --git a/crates/viewer/re_viewer/src/app.rs b/crates/viewer/re_viewer/src/app.rs index b8d36e4d2899..870e52527f4c 100644 --- a/crates/viewer/re_viewer/src/app.rs +++ b/crates/viewer/re_viewer/src/app.rs @@ -296,7 +296,7 @@ impl App { let panel_state_overrides = startup_options.panel_state_overrides; - let reflection = crate::reflection::generate_reflection().unwrap_or_else(|err| { + let reflection = re_types::reflection::generate_reflection().unwrap_or_else(|err| { re_log::error!( "Failed to create list of serialized default values for components: {err}" ); diff --git a/crates/viewer/re_viewer/src/lib.rs b/crates/viewer/re_viewer/src/lib.rs index 60fef300f387..8e17962aa5bf 100644 --- a/crates/viewer/re_viewer/src/lib.rs +++ b/crates/viewer/re_viewer/src/lib.rs @@ -11,14 +11,14 @@ mod app_blueprint; mod app_state; mod background_tasks; pub mod env_vars; -#[cfg(not(target_arch = "wasm32"))] -mod loading; -mod reflection; mod saving; mod screenshotter; mod ui; mod viewer_analytics; +#[cfg(not(target_arch = "wasm32"))] +mod loading; + /// Auto-generated blueprint-related types. /// /// They all implement the [`re_types_core::Component`] trait. diff --git a/scripts/ci/check_large_files.py b/scripts/ci/check_large_files.py index 694ff8672e90..b83948029e1c 100755 --- a/scripts/ci/check_large_files.py +++ b/scripts/ci/check_large_files.py @@ -10,8 +10,8 @@ "crates/build/re_types_builder/src/reflection.rs", "crates/store/re_dataframe/src/query.rs", "crates/store/re_types/src/datatypes/tensor_buffer.rs", + "crates/store/re_types/src/reflection/mod.rs", "crates/viewer/re_ui/data/Inter-Medium.otf", - "crates/viewer/re_viewer/src/reflection/mod.rs", "docs/snippets/INDEX.md", "pixi.lock", "rerun_cpp/docs/Doxyfile", From 115d0b269e9c9f2c61be35e5870066af4db7ede1 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Thu, 12 Dec 2024 10:22:01 +0100 Subject: [PATCH 41/71] Fix nightly execution (#8427) --- .github/workflows/nightly.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b586c858d39c..aa6e28f7f917 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -15,6 +15,9 @@ permissions: contents: "write" id-token: "write" deployments: "write" + # This is needed since the web viewer build has this permission in order to write comments in PRs + # (not needed for nightly, but the permission is still active). + pull-requests: "write" jobs: checks: From 22be22d4f4a0670e2db926a4a5ecf45d8fdc11f7 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 12 Dec 2024 10:43:26 +0100 Subject: [PATCH 42/71] Improve hovered order in 2D views (#8405) ### What Order the hovered items more logically, starting with the closest (topmost) and going down to the deepest, like image layers in Photoshop. #### Before ![image](https://github.com/user-attachments/assets/91893939-e4e2-4275-930a-39d584d4f8fc) #### After Screenshot 2024-12-11 at 10 22 48 --- crates/viewer/re_view_spatial/src/picking.rs | 43 ++++++++++++------- .../viewer/re_view_spatial/src/picking_ui.rs | 1 + 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/crates/viewer/re_view_spatial/src/picking.rs b/crates/viewer/re_view_spatial/src/picking.rs index fcd12266d257..327213499d94 100644 --- a/crates/viewer/re_view_spatial/src/picking.rs +++ b/crates/viewer/re_view_spatial/src/picking.rs @@ -39,7 +39,9 @@ pub struct PickingRayHit { #[derive(Clone, PartialEq)] pub struct PickingResult { - /// Picking ray hits. NOT sorted by distance but rather by source of picking. + /// Picking ray hits. + /// + /// The hits are sorted front-to-back, i.e. closest hits are first. /// /// Typically there is only one hit, but there might be several if there are transparent objects /// or "aggressive" objects like 2D images which we always want to pick, even if they're in the background. @@ -132,29 +134,31 @@ impl PickingContext { self, previous_picking_result, ); - let mut rect_hits = picking_textured_rects(self, images); - rect_hits.sort_by(|a, b| b.depth_offset.cmp(&a.depth_offset)); - let ui_rect_hits = picking_ui_rects(self, ui_rects); + + let mut image_hits = picking_textured_rects(self, images); + image_hits.sort_by(|a, b| b.depth_offset.cmp(&a.depth_offset)); + + let ui_hits = picking_ui_rects(self, ui_rects); let mut hits = Vec::new(); // Start with gpu based picking as baseline. This is our prime source of picking information. - // - // ..unless the same object got also picked as part of a textured rect. - // Textured rect picks also know where on the rect, making this the better source! - // Note that whenever this happens, it means that the same object path has a textured rect and something else - // e.g. a camera. if let Some(gpu_pick) = gpu_pick { - if rect_hits.iter().all(|rect_hit| { - rect_hit.instance_path_hash.entity_path_hash - != gpu_pick.instance_path_hash.entity_path_hash - }) { + // ..unless the same object got also picked as part of a textured rect. + // Textured rect picks also know where on the rect they hit, making this the better source! + // Note that whenever this happens, it means that the same object path has a textured rect and something else + // e.g. a camera. + let has_image_hit_on_gpu_pick = image_hits.iter().any(|image_hit| { + image_hit.instance_path_hash.entity_path_hash + == gpu_pick.instance_path_hash.entity_path_hash + }); + if !has_image_hit_on_gpu_pick { hits.push(gpu_pick); } } // We never throw away any textured rects, even if they're behind other objects. - hits.extend(rect_hits); + hits.extend(image_hits); // UI rects are overlaid on top, but we don't let them hide other picking results either. // Give any other previous hits precedence. @@ -163,11 +167,20 @@ impl PickingContext { .map(|prev_hit| prev_hit.instance_path_hash) .collect(); hits.extend( - ui_rect_hits + ui_hits .into_iter() .filter(|ui_hit| !previously_hit_objects.contains(&ui_hit.instance_path_hash)), ); + // Re-order so that the closest hits are first: + hits.sort_by_key(|hit| match hit.hit_type { + PickingHitType::GuiOverlay => 0, // GUI is closest, so always goes on top + + PickingHitType::GpuPickingResult => 1, + + PickingHitType::TexturedRect => 2, // Images are usually behind other things (e.g. an image is behind a bounding rectangle in a 2D view), so we put these last (furthest last) + }); + PickingResult { hits } } } diff --git a/crates/viewer/re_view_spatial/src/picking_ui.rs b/crates/viewer/re_view_spatial/src/picking_ui.rs index b14282fa9d13..949e85bb8dd2 100644 --- a/crates/viewer/re_view_spatial/src/picking_ui.rs +++ b/crates/viewer/re_view_spatial/src/picking_ui.rs @@ -84,6 +84,7 @@ pub fn picking( // TODO(#1818): Depth at pointer only works for depth images so far. let mut depth_at_pointer = None; + // We iterate front-to-back, putting foreground hits on top, like layers in Photoshop: for (hit_idx, hit) in picking_result.hits.iter().enumerate() { let Some(mut instance_path) = hit.instance_path_hash.resolve(ctx.recording()) else { // Entity no longer exists in db. From 32181b460bf1450ebc55988d97e90f797a57b79a Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:56:11 +0100 Subject: [PATCH 43/71] Make our collapsing triangle thinner for more consistency with our icons (#8408) --- .../src/view_entity_picker.rs | 270 ++++++++++-------- crates/viewer/re_ui/src/ui_ext.rs | 37 +-- 2 files changed, 159 insertions(+), 148 deletions(-) diff --git a/crates/viewer/re_selection_panel/src/view_entity_picker.rs b/crates/viewer/re_selection_panel/src/view_entity_picker.rs index ba1f814076de..a1ad17dd02e7 100644 --- a/crates/viewer/re_selection_panel/src/view_entity_picker.rs +++ b/crates/viewer/re_selection_panel/src/view_entity_picker.rs @@ -1,10 +1,11 @@ +use egui::NumExt as _; use itertools::Itertools; use nohash_hasher::IntMap; use re_data_ui::item_ui; use re_entity_db::{EntityPath, EntityTree, InstancePath}; use re_log_types::{EntityPathFilter, EntityPathRule}; -use re_ui::UiExt as _; +use re_ui::{list_item, UiExt as _}; use re_viewer_context::{DataQueryResult, ViewClassExt as _, ViewId, ViewerContext}; use re_viewport_blueprint::{ViewBlueprint, ViewportBlueprint}; @@ -32,7 +33,11 @@ impl ViewEntityPicker { ) { self.modal_handler.ui( egui_ctx, - || re_ui::modal::ModalWrapper::new("Add/remove Entities").default_height(640.0), + || { + re_ui::modal::ModalWrapper::new("Add/remove Entities") + .default_height(640.0) + .full_span_content(true) + }, |ui, open| { let Some(view_id) = &self.view_id else { *open = false; @@ -44,9 +49,21 @@ impl ViewEntityPicker { return; }; - egui::ScrollArea::vertical().show(ui, |ui| { - add_entities_ui(ctx, ui, view); - }); + // Make the modal size less jumpy and work around https://github.com/emilk/egui/issues/5138 + // TODO(ab): move that boilerplate to `ModalWrapper` by adding a `scrollable` flag. + let max_height = 0.85 * ui.ctx().screen_rect().height(); + let min_height = 0.3 * ui.ctx().screen_rect().height().at_most(max_height); + + egui::ScrollArea::vertical() + .min_scrolled_height(max_height) + .max_height(max_height) + .show(ui, |ui| { + add_entities_ui(ctx, ui, view); + + if ui.min_rect().height() < min_height { + ui.add_space(min_height - ui.min_rect().height()); + } + }); }, ); } @@ -61,16 +78,18 @@ fn add_entities_ui(ctx: &ViewerContext<'_>, ui: &mut egui::Ui, view: &ViewBluepr let entity_path_filter = &view.contents.entity_path_filter; let entities_add_info = create_entity_add_info(ctx, tree, view, &query_result); - add_entities_tree_ui( - ctx, - ui, - &tree.path.to_string(), - tree, - view, - &query_result, - entity_path_filter, - &entities_add_info, - ); + list_item::list_item_scope(ui, "view_entity_picker", |ui| { + add_entities_tree_ui( + ctx, + ui, + &tree.path.to_string(), + tree, + view, + &query_result, + entity_path_filter, + &entities_add_info, + ); + }); } #[allow(clippy::too_many_arguments)] @@ -84,10 +103,15 @@ fn add_entities_tree_ui( entity_path_filter: &EntityPathFilter, entities_add_info: &IntMap, ) { - if tree.is_leaf() { + let item_content = list_item::CustomContent::new(|ui, content_ctx| { + let mut child_ui = ui.new_child( + egui::UiBuilder::new() + .max_rect(content_ctx.rect) + .layout(egui::Layout::left_to_right(egui::Align::Center)), + ); add_entities_line_ui( ctx, - ui, + &mut child_ui, name, tree, view, @@ -95,45 +119,42 @@ fn add_entities_tree_ui( entity_path_filter, entities_add_info, ); + }); + + let list_item = ui.list_item().interactive(false); + if tree.is_leaf() { + list_item.show_hierarchical(ui, item_content); } else { let level = tree.path.len(); let default_open = view.space_origin.is_descendant_of(&tree.path) || tree.children.len() <= 3 || level < 2; - egui::collapsing_header::CollapsingState::load_with_default_open( - ui.ctx(), + + list_item.show_hierarchical_with_children( + ui, ui.id().with(name), default_open, - ) - .show_header(ui, |ui| { - add_entities_line_ui( - ctx, - ui, - name, - tree, - view, - query_result, - entity_path_filter, - entities_add_info, - ); - }) - .body(|ui| { - for (path_comp, child_tree) in tree.children.iter().sorted_by_key(|(_, child_tree)| { - // Put descendants of the space path always first - let put_first = child_tree.path.starts_with(&view.space_origin); - !put_first - }) { - add_entities_tree_ui( - ctx, - ui, - &path_comp.ui_string(), - child_tree, - view, - query_result, - entity_path_filter, - entities_add_info, - ); - } - }); + item_content, + |ui| { + for (path_comp, child_tree) in + tree.children.iter().sorted_by_key(|(_, child_tree)| { + // Put descendants of the space path always first + let put_first = child_tree.path.starts_with(&view.space_origin); + !put_first + }) + { + add_entities_tree_ui( + ctx, + ui, + &path_comp.ui_string(), + child_tree, + view, + query_result, + entity_path_filter, + entities_add_info, + ); + } + }, + ); }; } @@ -151,98 +172,95 @@ fn add_entities_line_ui( re_tracing::profile_function!(); let query = ctx.current_query(); + let entity_path = &entity_tree.path; + + #[allow(clippy::unwrap_used)] + let add_info = entities_add_info.get(entity_path).unwrap(); + + let is_explicitly_excluded = entity_path_filter.is_explicitly_excluded(entity_path); + let is_explicitly_included = entity_path_filter.is_explicitly_included(entity_path); + let is_included = entity_path_filter.matches(entity_path); + + ui.add_enabled_ui(add_info.can_add_self_or_descendant.is_compatible(), |ui| { + let widget_text = if is_explicitly_excluded { + // TODO(jleibs): Better design-language for excluded. + egui::RichText::new(name).italics() + } else if entity_path == &view.space_origin { + egui::RichText::new(name).strong() + } else { + egui::RichText::new(name) + }; + let response = item_ui::instance_path_button_to( + ctx, + &query, + ctx.recording(), + ui, + Some(view.id), + &InstancePath::entity_all(entity_path.clone()), + widget_text, + ); + if query_result.contains_entity(entity_path) { + response.highlight(); + } + }); - ui.horizontal(|ui| { - let entity_path = &entity_tree.path; - - #[allow(clippy::unwrap_used)] - let add_info = entities_add_info.get(entity_path).unwrap(); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + if entity_path_filter.contains_rule_for_exactly(entity_path) { + // Reset-button + // Shows when an entity is explicitly excluded or included + let response = ui.small_icon_button(&re_ui::icons::RESET); - let is_explicitly_excluded = entity_path_filter.is_explicitly_excluded(entity_path); - let is_explicitly_included = entity_path_filter.is_explicitly_included(entity_path); - let is_included = entity_path_filter.matches(entity_path); + if response.clicked() { + view.contents.remove_filter_rule_for(ctx, &entity_tree.path); + } - ui.add_enabled_ui(add_info.can_add_self_or_descendant.is_compatible(), |ui| { - let widget_text = if is_explicitly_excluded { - // TODO(jleibs): Better design-language for excluded. - egui::RichText::new(name).italics() - } else if entity_path == &view.space_origin { - egui::RichText::new(name).strong() - } else { - egui::RichText::new(name) - }; - let response = item_ui::instance_path_button_to( - ctx, - &query, - ctx.recording(), - ui, - Some(view.id), - &InstancePath::entity_all(entity_path.clone()), - widget_text, - ); - if query_result.contains_entity(entity_path) { - response.highlight(); + if is_explicitly_excluded { + response.on_hover_text("Stop excluding this entity path."); + } else if is_explicitly_included { + response.on_hover_text("Stop including this entity path."); } - }); + } else if is_included { + // Remove-button + // Shows when an entity is already included (but not explicitly) + let response = ui.small_icon_button(&re_ui::icons::REMOVE); - ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { - if entity_path_filter.contains_rule_for_exactly(entity_path) { - // Reset-button - // Shows when an entity is explicitly excluded or included - let response = ui.small_icon_button(&re_ui::icons::RESET); + if response.clicked() { + view.contents.raw_add_entity_exclusion( + ctx, + EntityPathRule::including_subtree(entity_tree.path.clone()), + ); + } - if response.clicked() { - view.contents.remove_filter_rule_for(ctx, &entity_tree.path); - } + response.on_hover_text("Exclude this entity and all its descendants from the view"); + } else { + // Add-button: + // Shows when an entity is not included + // Only enabled if the entity is compatible. + let enabled = add_info.can_add_self_or_descendant.is_compatible(); - if is_explicitly_excluded { - response.on_hover_text("Stop excluding this entity path."); - } else if is_explicitly_included { - response.on_hover_text("Stop including this entity path."); - } - } else if is_included { - // Remove-button - // Shows when an entity is already included (but not explicitly) - let response = ui.small_icon_button(&re_ui::icons::REMOVE); + ui.add_enabled_ui(enabled, |ui| { + let response = ui.small_icon_button(&re_ui::icons::ADD); if response.clicked() { - view.contents.raw_add_entity_exclusion( + view.contents.raw_add_entity_inclusion( ctx, EntityPathRule::including_subtree(entity_tree.path.clone()), ); } - response.on_hover_text("Exclude this entity and all its descendants from the view"); - } else { - // Add-button: - // Shows when an entity is not included - // Only enabled if the entity is compatible. - let enabled = add_info.can_add_self_or_descendant.is_compatible(); - - ui.add_enabled_ui(enabled, |ui| { - let response = ui.small_icon_button(&re_ui::icons::ADD); - - if response.clicked() { - view.contents.raw_add_entity_inclusion( - ctx, - EntityPathRule::including_subtree(entity_tree.path.clone()), + if enabled { + if add_info.can_add.is_compatible_and_missing() { + response.on_hover_text( + "Include this entity and all its descendants in the view", ); + } else { + response.on_hover_text("Add descendants of this entity to the view"); } - - if enabled { - if add_info.can_add.is_compatible_and_missing() { - response.on_hover_text( - "Include this entity and all its descendants in the view", - ); - } else { - response.on_hover_text("Add descendants of this entity to the view"); - } - } else if let CanAddToView::No { reason } = &add_info.can_add { - response.on_disabled_hover_text(reason); - } - }); - } - }); + } else if let CanAddToView::No { reason } = &add_info.can_add { + response.on_disabled_hover_text(reason); + } + }); + } }); } diff --git a/crates/viewer/re_ui/src/ui_ext.rs b/crates/viewer/re_ui/src/ui_ext.rs index 210814ac99c6..547332d0f6d3 100644 --- a/crates/viewer/re_ui/src/ui_ext.rs +++ b/crates/viewer/re_ui/src/ui_ext.rs @@ -1,8 +1,7 @@ use std::hash::Hash; use egui::{ - emath::Rot2, pos2, Align2, CollapsingResponse, Color32, NumExt, Rangef, Rect, Shape, Vec2, - Widget, + emath::Rot2, pos2, Align2, CollapsingResponse, Color32, NumExt, Rangef, Rect, Vec2, Widget, }; use crate::{ @@ -554,7 +553,7 @@ pub trait UiExt { } } - /// Paint a collapsing triangle with rounded corners. + /// Paint a collapsing triangle in the Rerun's style. /// /// Alternative to [`egui::collapsing_header::paint_default_icon`]. Note that the triangle is /// painted with a fixed size. @@ -569,21 +568,17 @@ pub trait UiExt { static TRIANGLE_SIZE: f32 = 8.0; // Normalized in [0, 1]^2 space. - // Note on how these coords have been computed: https://github.com/rerun-io/rerun/pull/2920 - // Discussion on the future of icons: https://github.com/rerun-io/rerun/issues/2960 + // + // Note on how these coords were originally computed: https://github.com/rerun-io/rerun/pull/2920 + // Since then, the coordinates have been manually updated to Look Good(tm). + // + // Discussion on the future of icons: https://github.com/rerun-io/rerun/issues/2960 let mut points = vec![ - pos2(0.80387, 0.470537), - pos2(0.816074, 0.5), - pos2(0.80387, 0.529463), - pos2(0.316248, 1.017085), - pos2(0.286141, 1.029362), - pos2(0.257726, 1.017592), - pos2(0.245118, 0.987622), - pos2(0.245118, 0.012378), - pos2(0.257726, -0.017592), - pos2(0.286141, -0.029362), - pos2(0.316248, -0.017085), - pos2(0.80387, 0.470537), + pos2(0.306248, -0.017085), // top left end + pos2(0.79387, 0.470537), // ┐ + pos2(0.806074, 0.5), // ├ "rounded" corner + pos2(0.79387, 0.529463), // ┘ + pos2(0.306248, 1.017085), // bottom left end ]; use std::f32::consts::TAU; @@ -592,11 +587,9 @@ pub trait UiExt { *p = center + rotation * (*p - pos2(0.5, 0.5)) * TRIANGLE_SIZE; } - self.ui().painter().add(Shape::convex_polygon( - points, - visuals.fg_stroke.color, - egui::Stroke::NONE, - )); + self.ui() + .painter() + .line(points, (1.0, visuals.fg_stroke.color)); } /// Workaround for putting a label into a grid at the top left of its row. From 7b769586d9ad767825833644a80e8118d2f022b8 Mon Sep 17 00:00:00 2001 From: Zeljko Mihaljcic <7150613+zehiko@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:23:13 +0100 Subject: [PATCH 44/71] Enrich ReDap Catalog with RecordingUri on the fly (#8418) As of right now, only the viewer is fully aware of Data Platform's endpoint, so we leverage that to enrich Catalog view with RecordingUri for each recording. We also add the chunk id to make received record batch convertible to a Chunk. --- Cargo.lock | 1 + crates/store/re_grpc_client/Cargo.toml | 1 + crates/store/re_grpc_client/src/lib.rs | 78 +++++++++++++++++++++++--- 3 files changed, 72 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f3a411f3fb9..bd21dfd45a73 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5931,6 +5931,7 @@ dependencies = [ "re_log_types", "re_protos", "re_smart_channel", + "re_types", "thiserror", "tokio", "tokio-stream", diff --git a/crates/store/re_grpc_client/Cargo.toml b/crates/store/re_grpc_client/Cargo.toml index 665e7fc6faa9..efb330fc306e 100644 --- a/crates/store/re_grpc_client/Cargo.toml +++ b/crates/store/re_grpc_client/Cargo.toml @@ -27,6 +27,7 @@ re_log_encoding.workspace = true re_log_types.workspace = true re_protos.workspace = true re_smart_channel.workspace = true +re_types.workspace = true thiserror.workspace = true tokio-stream.workspace = true diff --git a/crates/store/re_grpc_client/src/lib.rs b/crates/store/re_grpc_client/src/lib.rs index 478312bb6aaa..d6e7b3605e07 100644 --- a/crates/store/re_grpc_client/src/lib.rs +++ b/crates/store/re_grpc_client/src/lib.rs @@ -3,13 +3,19 @@ mod address; pub use address::{InvalidRedapAddress, RedapAddress}; +use re_chunk::external::arrow2; +use re_log_types::external::re_types_core::ComponentDescriptor; +use re_types::components::RecordingUri; +use re_types::Component; use url::Url; // ---------------------------------------------------------------------------- use std::error::Error; -use re_chunk::Chunk; +use arrow2::array::Utf8Array as Arrow2Utf8Array; +use arrow2::datatypes::Field as Arrow2Field; +use re_chunk::{Arrow2Array, Chunk, ChunkId, TransportChunk}; use re_log_encoding::codec::{wire::decode, CodecError}; use re_log_types::{ ApplicationId, LogMsg, SetStoreInfo, StoreId, StoreInfo, StoreKind, StoreSource, Time, @@ -64,6 +70,9 @@ enum StreamError { #[error(transparent)] ChunkError(#[from] re_chunk::ChunkError), + + #[error("Invalid URI: {0}")] + InvalidUri(String), } // ---------------------------------------------------------------------------- @@ -179,7 +188,7 @@ async fn stream_recording_async( let store_id = StoreId::from_string(StoreKind::Recording, recording_id.clone()); let store_info = StoreInfo { - application_id: ApplicationId::from("rerun_data_platform"), + application_id: ApplicationId::from("redap_recording"), store_id: store_id.clone(), cloned_from: None, is_official_example: false, @@ -221,9 +230,6 @@ async fn stream_recording_async( Ok(()) } -/// TODO(zehiko) - this is a copy of `stream_recording_async` with a different gRPC call, -/// this will go away as we tackle unification of data and metadata streams REDAP #74, hence -/// avoiding refactoring right now async fn stream_catalog_async( tx: re_smart_channel::Sender, redap_endpoint: Url, @@ -273,7 +279,7 @@ async fn stream_catalog_async( let store_id = StoreId::from_string(StoreKind::Recording, "catalog".to_owned()); let store_info = StoreInfo { - application_id: ApplicationId::from("rerun_data_platform"), + application_id: ApplicationId::from("redap_catalog"), store_id: store_id.clone(), cloned_from: None, is_official_example: false, @@ -295,8 +301,64 @@ async fn stream_catalog_async( re_log::info!("Starting to read..."); while let Some(result) = resp.next().await { - let tc = result.map_err(TonicStatusError)?; - let chunk = Chunk::from_transport(&tc)?; + let mut tc = result.map_err(TonicStatusError)?; + // received TransportChunk doesn't have ChunkId, hence we need to add it before converting + // to Chunk + tc.schema.metadata.insert( + 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) + // and the recording id (that we have in the catalog data) + let host = redap_endpoint + .host() + .ok_or(StreamError::InvalidUri(format!( + "couldn't get host from {redap_endpoint}" + )))?; + let port = redap_endpoint + .port() + .ok_or(StreamError::InvalidUri(format!( + "couldn't get port from {redap_endpoint}" + )))?; + + let recording_uri_arrays: Vec> = chunk + .iter_component_arrays(&"id".into()) + .map(|id| { + let rec_id = id + .as_any() + .downcast_ref::>() + .ok_or(StreamError::ChunkError(re_chunk::ChunkError::Malformed { + reason: format!("id must be a utf8 array: {:?}", tc.schema), + }))? + .value(0); // each component batch is of length 1 i.e. single 'id' value + + let recording_uri = format!("rerun://{host}:{port}/recording/{rec_id}"); + + let recording_uri_data = Arrow2Utf8Array::::from([Some(recording_uri)]); + + Ok::, StreamError>( + Box::new(recording_uri_data) as Box + ) + }) + .collect::, _>>()?; + + let recording_id_arrays = recording_uri_arrays + .iter() + .map(|e| Some(e.as_ref())) + .collect::>(); + + let rec_id_field = Arrow2Field::new("item", arrow2::datatypes::DataType::Utf8, true); + #[allow(clippy::unwrap_used)] // we know we've given the right field type + let uris = re_chunk::util::arrays_to_list_array( + rec_id_field.data_type().clone(), + &recording_id_arrays, + ) + .unwrap(); + + chunk.add_component(ComponentDescriptor::new(RecordingUri::name()), uris)?; if tx .send(LogMsg::ArrowMsg(store_id.clone(), chunk.to_arrow_msg()?)) From 776aa4f2024e83bd0778ae5d07a1d220dd458e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Thu, 12 Dec 2024 12:58:57 +0100 Subject: [PATCH 45/71] Create a more convincing example of the graph view (#8421) ### What This PR tries to create a more convincing example for the graph view. It consists of 4 views: * A tree that randomly grows over time * A bubble chart with new bubbles coming in over time * The lattice, which is logged statically but without positions * And finally a Markov-Chain with fixed positions There are still some minor things to fix: * [x] That one weird edge in the Markov-Chain * [x] It would be nice if the viewer would fit the resulting graphs to the view. image --------- Co-authored-by: Clement Rey --- Cargo.lock | 9 - .../re_view_graph/src/layout/provider.rs | 2 +- crates/viewer/re_view_graph/src/view.rs | 3 +- examples/manifest.toml | 5 +- examples/python/graph_binary_tree/README.md | 28 --- .../graph_binary_tree/graph_binary_tree.py | 108 --------- examples/python/graph_lattice/README.md | 8 +- examples/python/graphs/README.md | 29 +++ examples/python/graphs/graphs.py | 205 ++++++++++++++++++ .../pyproject.toml | 4 +- examples/rust/graph_binary_tree/Cargo.toml | 13 -- examples/rust/graph_binary_tree/README.md | 3 - examples/rust/graph_binary_tree/src/main.rs | 155 ------------- pixi.lock | 44 ++-- pixi.toml | 2 +- .../check_graph_time_layout.py | 111 ---------- 16 files changed, 268 insertions(+), 461 deletions(-) delete mode 100644 examples/python/graph_binary_tree/README.md delete mode 100644 examples/python/graph_binary_tree/graph_binary_tree.py create mode 100644 examples/python/graphs/README.md create mode 100644 examples/python/graphs/graphs.py rename examples/python/{graph_binary_tree => graphs}/pyproject.toml (70%) delete mode 100644 examples/rust/graph_binary_tree/Cargo.toml delete mode 100644 examples/rust/graph_binary_tree/README.md delete mode 100644 examples/rust/graph_binary_tree/src/main.rs delete mode 100644 tests/python/release_checklist/check_graph_time_layout.py diff --git a/Cargo.lock b/Cargo.lock index bd21dfd45a73..98a0e10c66c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2915,15 +2915,6 @@ dependencies = [ "bitflags 2.6.0", ] -[[package]] -name = "graph_binary_tree" -version = "0.21.0-alpha.1+dev" -dependencies = [ - "anyhow", - "clap", - "rerun", -] - [[package]] name = "graph_lattice" version = "0.21.0-alpha.1+dev" diff --git a/crates/viewer/re_view_graph/src/layout/provider.rs b/crates/viewer/re_view_graph/src/layout/provider.rs index 6f84d1ff3f67..b49f3f6669a0 100644 --- a/crates/viewer/re_view_graph/src/layout/provider.rs +++ b/crates/viewer/re_view_graph/src/layout/provider.rs @@ -236,7 +236,7 @@ impl ForceLayoutProvider { let c1_base = source_pos + delta * 0.25; let c2_base = source_pos + delta * 0.75; - let base_n = Vec2::new(-c1_base.y, c1_base.x).normalized(); + let base_n = Vec2::new(-delta.y, delta.x).normalized(); let c1_left = c1_base + base_n * (fan_amount / 2.); let c2_left = c2_base + base_n * (fan_amount / 2.); diff --git a/crates/viewer/re_view_graph/src/view.rs b/crates/viewer/re_view_graph/src/view.rs index eaf2068663ee..8948a343c423 100644 --- a/crates/viewer/re_view_graph/src/view.rs +++ b/crates/viewer/re_view_graph/src/view.rs @@ -180,7 +180,6 @@ Display a graph of nodes and edges. // Perform all layout-related tasks. let request = LayoutRequest::from_graphs(graphs.iter()); - let layout_was_empty = state.layout_state.is_none(); let layout = state.layout_state.get(request, params); // Prepare the view and the transformations. @@ -216,7 +215,7 @@ Display a graph of nodes and edges. // Update blueprint if changed let updated_rect_in_scene = blueprint::components::VisualBounds2D::from(ui_from_world.inverse() * rect_in_ui); - if resp.double_clicked() || layout_was_empty { + if resp.double_clicked() { bounds_property.reset_blueprint_component::(ctx); state.ui_from_world = None; } else if rect_in_scene != updated_rect_in_scene { diff --git a/examples/manifest.toml b/examples/manifest.toml index 915fc0509dcf..b229b765acd5 100644 --- a/examples/manifest.toml +++ b/examples/manifest.toml @@ -142,6 +142,7 @@ examples = [ "notebook", "clock", "dna", + "graphs", "log_file", "openstreetmap_data", "minimal", @@ -150,8 +151,6 @@ examples = [ "plots", "live_scrolling_plot", "raw_mesh", - "graph_lattice", - "graph_binary_tree", "air_traffic_data", ] @@ -169,6 +168,8 @@ examples = [ "drone_lidar", "extend_viewer_ui", "external_data_loader", + "graph_binary_tree", + "graph_lattice", "incremental_logging", "minimal_serve", "shared_recording", diff --git a/examples/python/graph_binary_tree/README.md b/examples/python/graph_binary_tree/README.md deleted file mode 100644 index 1165823aa39f..000000000000 --- a/examples/python/graph_binary_tree/README.md +++ /dev/null @@ -1,28 +0,0 @@ - - -This example shows a binary tree that uses `GraphNodes` and `GraphEdges` together with fixed node positions. - - - - - - - - - -## Used Rerun types -[`GraphNodes`](https://www.rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link), -[`GraphEdges`](https://www.rerun.io/docs/reference/types/archetypes/graph_edges?speculative-link) - -## Run the code - -```bash -pip install -e examples/python/graph_binary_tree -python -m graph_binary_tree -``` diff --git a/examples/python/graph_binary_tree/graph_binary_tree.py b/examples/python/graph_binary_tree/graph_binary_tree.py deleted file mode 100644 index 96f9a2c869a1..000000000000 --- a/examples/python/graph_binary_tree/graph_binary_tree.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env python3 -"""Examples of logging graph data to Rerun.""" - -from __future__ import annotations - -import argparse - -import rerun as rr - -DESCRIPTION = """ -# Binary tree -This is a minimal example that logs a time-varying binary tree to Rerun. - -The full source code for this example is available -[on GitHub](https://github.com/rerun-io/rerun/blob/latest/examples/python/graph_binary_tree?speculative-link). -""".strip() - -s = 3 # scaling factor for the positions - -# Potentially unbalanced and not sorted binary tree. :nerd_face:. -# :warning: The nodes have to be unique, which is why we use `5_0`… - -NodeId = str - - -class NodeInfo: - def __init__(self, label: str, pos: tuple[float, float]) -> None: - self.label = label - self.pos = pos - - -all_nodes: dict[NodeId, NodeInfo] = { - "1": NodeInfo(label="1", pos=(0 * s, 0 * s)), - "7": NodeInfo(label="7", pos=(-20 * s, 30 * s)), - "2": NodeInfo(label="2", pos=(-30 * s, 60 * s)), - "6": NodeInfo(label="6", pos=(-10 * s, 60 * s)), - "5_0": NodeInfo(label="5", pos=(-20 * s, 90 * s)), - "11": NodeInfo(label="11", pos=(0 * s, 90 * s)), - "9_0": NodeInfo(label="9", pos=(20 * s, 30 * s)), - "9_1": NodeInfo(label="9", pos=(30 * s, 60 * s)), - "5_1": NodeInfo(label="5", pos=(20 * s, 90 * s)), -} - - -class Level: - def __init__(self, nodes: list[NodeId], edges: list[tuple[NodeId, NodeId]]): - self.nodes = nodes - self.edges = edges - - -levels: list[Level] = [ - Level(nodes=["1"], edges=[]), - Level(nodes=["1", "7", "9_0"], edges=[("1", "7"), ("1", "9_0")]), - Level( - nodes=["1", "7", "9_0", "2", "6", "9_1"], - edges=[("1", "7"), ("1", "9_0"), ("7", "2"), ("7", "6"), ("9_0", "9_1")], - ), - Level( - nodes=["1", "7", "9_0", "2", "6", "9_1", "5_0", "11", "5_1"], - edges=[ - ("1", "7"), - ("1", "9_0"), - ("7", "2"), - ("7", "6"), - ("9_0", "9_1"), - ("6", "5_0"), - ("6", "11"), - ("9_1", "5_1"), - ], - ), -] - - -def log_data() -> None: - rr.log("description", rr.TextDocument(DESCRIPTION, media_type=rr.MediaType.MARKDOWN), static=True) - - t = 0 - for level in levels: - if len(level.nodes) > 0: - t = t + 1 - rr.set_time_seconds("stable_time", t) - rr.log( - "binary_tree", - rr.GraphNodes( - level.nodes, - labels=list(map(lambda n: all_nodes[n].label, level.nodes)), - positions=list(map(lambda n: all_nodes[n].pos, level.nodes)), - ), - ) - - if len(level.edges) > 0: - t = t + 1 - rr.set_time_seconds("stable_time", t) - rr.log("binary_tree", rr.GraphEdges(level.edges)) - - -def main() -> None: - parser = argparse.ArgumentParser(description="Logs a binary tree with associated positions using the Rerun SDK.") - rr.script_add_args(parser) - args = parser.parse_args() - - rr.script_setup(args, "rerun_example_graph_binary_tree") - log_data() - rr.script_teardown(args) - - -if __name__ == "__main__": - main() diff --git a/examples/python/graph_lattice/README.md b/examples/python/graph_lattice/README.md index ed764409c37c..8ffe2530634f 100644 --- a/examples/python/graph_lattice/README.md +++ b/examples/python/graph_lattice/README.md @@ -23,7 +23,7 @@ Since no explicit positions are passed for the nodes, Rerun will layout the grap ## Run the code -```bash -pip install -e examples/python/graph_lattice -python -m graph_lattice -``` + ```bash + pip install -e examples/python/graph_lattice + python -m graph_lattice + ``` diff --git a/examples/python/graphs/README.md b/examples/python/graphs/README.md new file mode 100644 index 000000000000..245143a18cc0 --- /dev/null +++ b/examples/python/graphs/README.md @@ -0,0 +1,29 @@ + + +This example shows different attributes that you can associate with nodes in a graph. +Since no explicit positions are passed for the nodes, Rerun will layout the graph automatically. + + + + + + + + + +## Used Rerun types +[`GraphNodes`](https://www.rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link), +[`GraphEdges`](https://www.rerun.io/docs/reference/types/archetypes/graph_edges?speculative-link) + +## Run the code + +```bash +pip install -e examples/python/graphs +python -m graphs +``` diff --git a/examples/python/graphs/graphs.py b/examples/python/graphs/graphs.py new file mode 100644 index 000000000000..3bf490c625d9 --- /dev/null +++ b/examples/python/graphs/graphs.py @@ -0,0 +1,205 @@ +#!/usr/bin/env python3 +"""Examples of logging graph data to Rerun and performing force-based layouts.""" + +from __future__ import annotations + +import argparse +import itertools +import random + +import numpy as np +import rerun as rr +import rerun.blueprint as rrb +from rerun.blueprint.archetypes.force_collision_radius import ForceCollisionRadius +from rerun.blueprint.archetypes.force_link import ForceLink +from rerun.blueprint.archetypes.force_many_body import ForceManyBody +from rerun.components.color import Color +from rerun.components.radius import Radius +from rerun.components.show_labels import ShowLabels + +color_scheme = [ + Color([228, 26, 28]), # Red + Color([55, 126, 184]), # Blue + Color([77, 175, 74]), # Green + Color([152, 78, 163]), # Purple + Color([255, 127, 0]), # Orange + Color([255, 255, 51]), # Yellow + Color([166, 86, 40]), # Brown + Color([247, 129, 191]), # Pink + Color([153, 153, 153]), # Gray +] + +DESCRIPTION = """ +# Graphs +This example shows various graph visualizations that you can create using Rerun. +In this example, the node positions—and therefore the graph layout—are computed by Rerun internally using a force-based layout algorithm. + +You can modify how these graphs look by changing the parameters of the force-based layout algorithm in the selection panel. + +The full source code for this example is available +[on GitHub](https://github.com/rerun-io/rerun/blob/latest/examples/python/graphs?speculative-link). +""".strip() + + +# We want reproducible results +random.seed(42) + + +def log_lattice(num_nodes: int) -> None: + coordinates = itertools.product(range(num_nodes), range(num_nodes)) + + nodes, colors = zip(*[ + ( + str(i), + rr.components.Color([round((x / (num_nodes - 1)) * 255), round((y / (num_nodes - 1)) * 255), 0]), + ) + for i, (x, y) in enumerate(coordinates) + ]) + + rr.log( + "lattice", + rr.GraphNodes( + nodes, + colors=colors, + labels=[f"({x}, {y})" for x, y in itertools.product(range(num_nodes), range(num_nodes))], + ), + static=True, + ) + + edges = [] + for x, y in itertools.product(range(num_nodes), range(num_nodes)): + if y > 0: + source = (y - 1) * num_nodes + x + target = y * num_nodes + x + edges.append((str(source), str(target))) + if x > 0: + source = y * num_nodes + (x - 1) + target = y * num_nodes + x + edges.append((str(source), str(target))) + + rr.log("lattice", rr.GraphEdges(edges, graph_type="directed"), static=True) + + +def log_trees() -> None: + nodes = ["root"] + radii = [42] + colors = [Color([81, 81, 81])] + edges = [] + + # Randomly add nodes and edges to the graph + for i in range(50): + existing = random.choice(nodes) + new_node = str(i) + nodes.append(new_node) + radii.append(random.randint(10, 50)) + colors.append(random.choice(color_scheme)) + edges.append((existing, new_node)) + + rr.set_time_sequence("frame", i) + rr.log( + "node_link", + rr.GraphNodes(nodes, labels=nodes, radii=radii, colors=colors), + rr.GraphEdges(edges, graph_type=rr.GraphType.Directed), + ) + rr.log( + "bubble_chart", + rr.GraphNodes(nodes, labels=nodes, radii=radii, colors=colors), + ) + + +def log_markov_chain() -> None: + transition_matrix = np.array([ + [0.8, 0.1, 0.1], # Transitions from sunny + [0.3, 0.4, 0.3], # Transitions from rainy + [0.2, 0.3, 0.5], # Transitions from cloudy + ]) + state_names = ["sunny", "rainy", "cloudy"] + # For this example, we use hardcoded positions. + positions = [[0, 0], [150, 150], [300, 0]] + inactive_color = Color([153, 153, 153]) # Gray + active_colors = [ + Color([255, 127, 0]), # Orange + Color([55, 126, 184]), # Blue + Color([152, 78, 163]), # Purple + ] + + edges = [ + (state_names[i], state_names[j]) + for i in range(len(state_names)) + for j in range(len(state_names)) + if transition_matrix[i][j] > 0 + ] + edges.append(("start", "sunny")) + + # We start in state "sunny" + state = "sunny" + + for i in range(50): + current_state_index = state_names.index(state) + next_state_index = np.random.choice(range(len(state_names)), p=transition_matrix[current_state_index]) + state = state_names[next_state_index] + colors = [inactive_color] * len(state_names) + colors[next_state_index] = active_colors[next_state_index] + + rr.set_time_sequence("frame", i) + rr.log( + "markov_chain", + rr.GraphNodes(state_names, labels=state_names, colors=colors, positions=positions), + rr.GraphEdges(edges, graph_type="directed"), + ) + + +def log_blueprint() -> None: + rr.send_blueprint( + rrb.Blueprint( + rrb.Grid( + rrb.GraphView( + origin="node_link", + name="Node-link diagram", + force_link=ForceLink(distance=60), + force_many_body=ForceManyBody(strength=-60), + ), + rrb.GraphView( + origin="bubble_chart", + name="Bubble chart", + force_link=ForceLink(enabled=False), + force_many_body=ForceManyBody(enabled=False), + force_collision_radius=ForceCollisionRadius(enabled=True), + defaults=[ShowLabels(False)], + ), + rrb.GraphView( + origin="lattice", + name="Lattice", + force_link=ForceLink(distance=60), + force_many_body=ForceManyBody(strength=-60), + defaults=[ShowLabels(False), Radius(10)], + ), + rrb.Horizontal( + rrb.GraphView( + origin="markov_chain", + name="Markov Chain", + # We don't need any forces for this graph, because the nodes have fixed positions. + ), + rrb.TextDocumentView(origin="description", name="Description"), + ), + ) + ) + ) + + +def main() -> None: + parser = argparse.ArgumentParser(description="Logs various graphs using the Rerun SDK.") + rr.script_add_args(parser) + args = parser.parse_args() + + rr.script_setup(args, "rerun_example_graphs") + rr.log("description", rr.TextDocument(DESCRIPTION, media_type=rr.MediaType.MARKDOWN), static=True) + log_trees() + log_lattice(10) + log_markov_chain() + log_blueprint() + rr.script_teardown(args) + + +if __name__ == "__main__": + main() diff --git a/examples/python/graph_binary_tree/pyproject.toml b/examples/python/graphs/pyproject.toml similarity index 70% rename from examples/python/graph_binary_tree/pyproject.toml rename to examples/python/graphs/pyproject.toml index a10385ee722a..107c5d05bba6 100644 --- a/examples/python/graph_binary_tree/pyproject.toml +++ b/examples/python/graphs/pyproject.toml @@ -1,11 +1,11 @@ [project] -name = "graph_binary_tree" +name = "graphs" version = "0.1.0" readme = "README.md" dependencies = ["rerun-sdk"] [project.scripts] -graph_binary_tree = "graph_binary_tree:main" +graphs = "graphs:main" [build-system] requires = ["hatchling"] diff --git a/examples/rust/graph_binary_tree/Cargo.toml b/examples/rust/graph_binary_tree/Cargo.toml deleted file mode 100644 index 34af848c8320..000000000000 --- a/examples/rust/graph_binary_tree/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "graph_binary_tree" -version = "0.21.0-alpha.1+dev" -edition = "2021" -rust-version = "1.80" -license = "MIT OR Apache-2.0" -publish = false - -[dependencies] -rerun = { path = "../../../crates/top/rerun", features = ["clap"] } - -anyhow = "1.0" -clap = { version = "4.0", features = ["derive"] } diff --git a/examples/rust/graph_binary_tree/README.md b/examples/rust/graph_binary_tree/README.md deleted file mode 100644 index 110ff4de97b1..000000000000 --- a/examples/rust/graph_binary_tree/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# graph_binary_tree - -Demonstrates visualization of a graph that varies over time. diff --git a/examples/rust/graph_binary_tree/src/main.rs b/examples/rust/graph_binary_tree/src/main.rs deleted file mode 100644 index 1f820fa28f0a..000000000000 --- a/examples/rust/graph_binary_tree/src/main.rs +++ /dev/null @@ -1,155 +0,0 @@ -//! Shows how to draw a graph that varies over time. -//! Please not that this example makes use of fixed positions. -//! -//! Usage: -//! ``` -//! cargo run -p graph_binary_tree -- --connect -//! ``` - -use rerun::{external::re_log, GraphEdges, GraphNodes}; -use std::collections::HashMap; - -#[derive(Debug, clap::Parser)] -#[clap(author, version, about)] -pub struct Args { - #[command(flatten)] - rerun: rerun::clap::RerunArgs, -} - -fn main() -> anyhow::Result<()> { - re_log::setup_logging(); - - use clap::Parser as _; - let args = Args::parse(); - - let (rec, _serve_guard) = args.rerun.init("rerun_example_graph_binary_tree")?; - - let s = 3.0; // scaling factor for the positions - - // Potentially unbalanced and not sorted binary tree. :nerd_face:. - // :warning: The nodes have to be unique, which is why we use `5_0`… - - // (label, position) - type NodeInfo = (&'static str, (f32, f32)); - - struct Level<'a> { - nodes: &'a [&'a str], - edges: &'a [(&'a str, &'a str)], - } - - let nodes_unsorted: HashMap<&str, NodeInfo> = [ - ("1", ("1", (0.0 * s, 0.0 * s))), - ("7", ("7", (-20.0 * s, 30.0 * s))), - ("2", ("2", (-30.0 * s, 60.0 * s))), - ("6", ("6", (-10.0 * s, 60.0 * s))), - ("5_0", ("5", (-20.0 * s, 90.0 * s))), - ("11", ("11", (0.0 * s, 90.0 * s))), - ("9_0", ("9", (20.0 * s, 30.0 * s))), - ("9_1", ("9", (30.0 * s, 60.0 * s))), - ("5_1", ("5", (20.0 * s, 90.0 * s))), - ] - .into_iter() - .collect(); - - let levels_unsorted: Vec = vec![ - Level { - nodes: &["1"], - edges: &[], - }, - Level { - nodes: &["1", "7", "9_0"], - edges: &[("1", "7"), ("1", "9_0")], - }, - Level { - nodes: &["1", "7", "9_0", "2", "6", "9_1"], - edges: &[ - ("1", "7"), - ("1", "9_0"), - ("7", "2"), - ("7", "6"), - ("9_0", "9_1"), - ], - }, - Level { - nodes: &["1", "7", "9_0", "2", "6", "9_1", "5_0", "11", "5_1"], - edges: &[ - ("1", "7"), - ("1", "9_0"), - ("7", "2"), - ("7", "6"), - ("9_0", "9_1"), - ("6", "5_0"), - ("6", "11"), - ("9_1", "5_1"), - ], - }, - ]; - - let nodes_sorted: HashMap<&str, NodeInfo> = [ - ("6", ("6", (0.0 * s, 0.0 * s))), - ("5_0", ("5", (-20.0 * s, 30.0 * s))), - ("9_0", ("9", (20.0 * s, 30.0 * s))), - ] - .into_iter() - .collect(); - - let levels_sorted: Vec = vec![ - Level { - nodes: &["6"], - edges: &[], - }, - Level { - nodes: &["6", "5_0", "9_0"], - edges: &[("6", "5_0"), ("6", "9_0"), ("1", "6"), ("1", "42")], - }, - ]; - - let mut t = 0; - for level in levels_unsorted { - if !level.nodes.is_empty() { - t += 1; - rec.set_time_seconds("stable_time", t as f64); - let _ = rec.log( - "unsorted", - &GraphNodes::new(level.nodes.iter().copied()) - .with_labels(level.nodes.iter().map(|n| nodes_unsorted[n].0)) - .with_positions(level.nodes.iter().map(|n| nodes_unsorted[n].1)), - ); - } - - if !level.edges.is_empty() { - t += 1; - rec.set_time_seconds("stable_time", t as f64); - let _ = rec.log("unsorted", &GraphEdges::new(level.edges)); - } - } - - let entity_offset_x = 200.0; - - for level in levels_sorted { - if !level.nodes.is_empty() { - t += 1; - rec.set_time_seconds("stable_time", t as f64); - let _ = rec.log( - "sorted", - &GraphNodes::new(level.nodes.iter().copied()) - .with_labels(level.nodes.iter().map(|n| nodes_sorted[n].0)) - .with_positions(level.nodes.iter().map(|n| { - let (x, y) = nodes_sorted[n].1; - [x + entity_offset_x, y] - })), - ); - } - - if !level.edges.is_empty() { - t += 1; - rec.set_time_seconds("stable_time", t as f64); - let _ = rec.log( - "sorted", - &GraphEdges::new(level.edges).with_directed_edges(), - ); - } - } - - Ok(()) -} diff --git a/pixi.lock b/pixi.lock index cec6b0f84bfb..704ab17f98a4 100644 --- a/pixi.lock +++ b/pixi.lock @@ -2549,8 +2549,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -2953,8 +2953,8 @@ environments: - pypi: examples/python/dicom_mri - pypi: examples/python/dna - pypi: examples/python/drone_lidar - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/incremental_logging - pypi: examples/python/lidar - pypi: examples/python/live_camera_edge_detection @@ -3338,8 +3338,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -3725,8 +3725,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -4111,8 +4111,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -4541,8 +4541,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -4897,8 +4897,8 @@ environments: - pypi: examples/python/dicom_mri - pypi: examples/python/dna - pypi: examples/python/drone_lidar - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/incremental_logging - pypi: examples/python/lidar - pypi: examples/python/live_camera_edge_detection @@ -5235,8 +5235,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -5575,8 +5575,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -5915,8 +5915,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -9158,8 +9158,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -9656,8 +9656,8 @@ environments: - pypi: examples/python/dicom_mri - pypi: examples/python/dna - pypi: examples/python/drone_lidar - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/incremental_logging - pypi: examples/python/lidar - pypi: examples/python/live_camera_edge_detection @@ -10134,8 +10134,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -10614,8 +10614,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -11073,8 +11073,8 @@ environments: - pypi: examples/python/drone_lidar - pypi: examples/python/face_tracking - pypi: examples/python/gesture_detection - - pypi: examples/python/graph_binary_tree - pypi: examples/python/graph_lattice + - pypi: examples/python/graphs - pypi: examples/python/human_pose_tracking - pypi: examples/python/incremental_logging - pypi: examples/python/lidar @@ -18045,13 +18045,6 @@ packages: - protobuf!=3.20.0,!=3.20.1,>=3.20.2,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0.dev0 - grpcio>=1.44.0,<2.0.0.dev0 ; extra == 'grpc' requires_python: '>=3.7' -- pypi: examples/python/graph_binary_tree - name: graph-binary-tree - version: 0.1.0 - sha256: 8ceb8c2d1102f2f2476eb5fb9c79e717e520f92220709449f48138a3c84c6609 - requires_dist: - - rerun-sdk - editable: true - pypi: examples/python/graph_lattice name: graph-lattice version: 0.1.0 @@ -18113,6 +18106,13 @@ packages: purls: [] size: 95406 timestamp: 1711634622644 +- pypi: examples/python/graphs + name: graphs + version: 0.1.0 + sha256: 4e848c8bfec82cd0d79a4080a37ea03ee24c33d3c64019af981b76ba0bd8d10c + requires_dist: + - rerun-sdk + editable: true - pypi: https://files.pythonhosted.org/packages/eb/fc/570a1e503e19be24c5642ea8b93f23e3eef1dfa930e761cab72dedc2c2db/griffe-1.4.1-py3-none-any.whl name: griffe version: 1.4.1 diff --git a/pixi.toml b/pixi.toml index 4448ca0b884a..72217e1239c9 100644 --- a/pixi.toml +++ b/pixi.toml @@ -638,8 +638,8 @@ minimal = { path = "examples/python/minimal", editable = true } minimal_options = { path = "examples/python/minimal_options", editable = true } multiprocess_logging = { path = "examples/python/multiprocess_logging", editable = true } multithreading = { path = "examples/python/multithreading", editable = true } -graph_binary_tree = { path = "examples/python/graph_binary_tree", editable = true } graph_lattice = { path = "examples/python/graph_lattice", editable = true } +graphs = { path = "examples/python/graphs", editable = true } nuscenes_dataset = { path = "examples/python/nuscenes_dataset", editable = true } nv12 = { path = "examples/python/nv12", editable = true } objectron = { path = "examples/python/objectron", editable = true } diff --git a/tests/python/release_checklist/check_graph_time_layout.py b/tests/python/release_checklist/check_graph_time_layout.py deleted file mode 100644 index e10bde1053a5..000000000000 --- a/tests/python/release_checklist/check_graph_time_layout.py +++ /dev/null @@ -1,111 +0,0 @@ -from __future__ import annotations - -# TODO(grtlr): Promote to example -import os -import random -from argparse import Namespace -from uuid import uuid4 - -import rerun as rr -import rerun.blueprint as rrb - -# TODO(grtlr): Clean up the exports -from rerun.blueprint.archetypes.force_collision_radius import ForceCollisionRadius -from rerun.blueprint.archetypes.force_link import ForceLink -from rerun.blueprint.archetypes.force_many_body import ForceManyBody -from rerun.components.color import Color -from rerun.components.show_labels import ShowLabels - -README = """\ -# Time-varying graph view - -Please watch out for any twitching, jumping, or other wise unexpected changes to -the layout when navigating the timeline. - -Please check the following: -* Scrub the timeline to see how the graph layout changes over time. -""" - -color_scheme = [ - Color([228, 26, 28]), # Red - Color([55, 126, 184]), # Blue - Color([77, 175, 74]), # Green - Color([152, 78, 163]), # Purple - Color([255, 127, 0]), # Orange - Color([255, 255, 51]), # Yellow - Color([166, 86, 40]), # Brown - Color([247, 129, 191]), # Pink - Color([153, 153, 153]), # Gray -] - - -def log_readme() -> None: - rr.log("readme", rr.TextDocument(README, media_type=rr.MediaType.MARKDOWN), static=True) - - -def log_graphs() -> None: - nodes = ["root"] - radii = [42] - colors = [Color([81, 81, 81])] - edges = [] - - # We want reproducible results - random.seed(42) - - # Randomly add nodes and edges to the graph - for i in range(50): - existing = random.choice(nodes) - new_node = str(i) - nodes.append(new_node) - radii.append(random.randint(10, 50)) - colors.append(random.choice(color_scheme)) - edges.append((existing, new_node)) - - rr.set_time_sequence("frame", i) - rr.log( - "node_link", - rr.GraphNodes(nodes, labels=nodes, radii=radii, colors=colors), - rr.GraphEdges(edges, graph_type=rr.GraphType.Directed), - ) - rr.log( - "bubble_chart", - rr.GraphNodes(nodes, labels=nodes, radii=radii, colors=colors), - ) - - rr.send_blueprint( - rrb.Blueprint( - rrb.Grid( - rrb.GraphView( - origin="node_link", - name="Node-link diagram", - force_link=ForceLink(distance=60), - force_many_body=ForceManyBody(strength=-60), - ), - rrb.GraphView( - origin="bubble_chart", - name="Bubble chart", - force_link=ForceLink(enabled=False), - force_many_body=ForceManyBody(enabled=False), - force_collision_radius=ForceCollisionRadius(enabled=True), - defaults=[ShowLabels(False)], - ), - rrb.TextDocumentView(origin="readme", name="Instructions"), - ) - ) - ) - - -def run(args: Namespace) -> None: - rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4()) - - log_readme() - log_graphs() - - -if __name__ == "__main__": - import argparse - - parser = argparse.ArgumentParser(description="Interactive release checklist") - rr.script_add_args(parser) - args = parser.parse_args() - run(args) From 0786fdab0ad8043e8bc43205050ff9387eb10b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= Date: Thu, 12 Dec 2024 13:01:38 +0100 Subject: [PATCH 46/71] Encode `LogMsg` using protobuf (#8347) --- Cargo.lock | 2 + Cargo.toml | 1 + crates/build/re_protos_builder/Cargo.toml | 1 + .../src/bin/build_re_remote_store_types.rs | 12 +- crates/build/re_protos_builder/src/lib.rs | 5 +- crates/store/re_chunk_store/src/lib.rs | 4 +- .../src/protobuf_conversions.rs | 34 +- crates/store/re_chunk_store/src/store.rs | 4 +- .../re_data_loader/src/loader_external.rs | 2 +- crates/store/re_data_loader/src/loader_rrd.rs | 10 +- crates/store/re_data_source/src/load_stdin.rs | 2 +- crates/store/re_dataframe/Cargo.toml | 3 +- crates/store/re_dataframe/examples/query.rs | 3 +- crates/store/re_dataframe/src/engine.rs | 3 +- crates/store/re_dataframe/src/lib.rs | 3 +- .../re_entity_db/examples/memory_usage.rs | 4 +- crates/store/re_entity_db/src/store_bundle.rs | 2 +- crates/store/re_grpc_client/src/lib.rs | 3 +- .../benches/msg_encode_benchmark.rs | 219 +++++-- .../store/re_log_encoding/src/codec/arrow.rs | 96 +++ .../re_log_encoding/src/codec/file/decoder.rs | 58 ++ .../re_log_encoding/src/codec/file/encoder.rs | 59 ++ .../re_log_encoding/src/codec/file/mod.rs | 70 +++ crates/store/re_log_encoding/src/codec/mod.rs | 14 +- .../store/re_log_encoding/src/codec/wire.rs | 261 -------- .../re_log_encoding/src/codec/wire/decoder.rs | 55 ++ .../re_log_encoding/src/codec/wire/encoder.rs | 58 ++ .../re_log_encoding/src/codec/wire/mod.rs | 121 ++++ .../store/re_log_encoding/src/decoder/mod.rs | 329 +++++++---- .../re_log_encoding/src/decoder/stream.rs | 16 +- crates/store/re_log_encoding/src/encoder.rs | 117 ++-- crates/store/re_log_encoding/src/file_sink.rs | 4 +- crates/store/re_log_encoding/src/lib.rs | 27 +- .../src/protobuf_conversions.rs | 17 + .../src/stream_rrd_from_http.rs | 4 +- crates/store/re_log_types/src/lib.rs | 115 ++++ .../re_log_types/src/protobuf_conversions.rs | 559 +++++++++++++++++- crates/store/re_protos/.gitattributes | 2 +- .../re_protos/proto/rerun/v0/log_msg.proto | 190 ++++++ crates/store/re_protos/src/lib.rs | 46 +- .../store/re_protos/src/v0/rerun.common.v0.rs | 240 ++++++++ .../re_protos/src/v0/rerun.log_msg.v0.rs | 388 ++++++++++++ .../re_protos/src/v0/rerun.remote_store.v0.rs | 120 ++++ .../store/re_sdk_comms/src/buffered_client.rs | 2 +- crates/store/re_sdk_comms/src/server.rs | 2 +- crates/top/re_sdk/src/binary_stream_sink.rs | 2 +- crates/top/rerun/Cargo.toml | 8 +- crates/top/rerun/src/commands/entrypoint.rs | 2 +- crates/top/rerun/src/commands/rrd/compare.rs | 2 +- crates/top/rerun/src/commands/rrd/filter.rs | 4 +- .../rerun/src/commands/rrd/merge_compact.rs | 4 +- crates/top/rerun/src/commands/rrd/print.rs | 2 +- crates/top/rerun/src/commands/stdio.rs | 2 +- crates/top/rerun/src/lib.rs | 4 +- .../utils/re_tuid/src/protobuf_conversions.rs | 11 + crates/viewer/re_viewer/src/app.rs | 2 +- crates/viewer/re_viewer/src/loading.rs | 2 +- crates/viewer/re_viewer/src/saving.rs | 2 +- rerun_py/src/dataframe.rs | 3 +- 59 files changed, 2740 insertions(+), 597 deletions(-) create mode 100644 crates/store/re_log_encoding/src/codec/arrow.rs create mode 100644 crates/store/re_log_encoding/src/codec/file/decoder.rs create mode 100644 crates/store/re_log_encoding/src/codec/file/encoder.rs create mode 100644 crates/store/re_log_encoding/src/codec/file/mod.rs delete mode 100644 crates/store/re_log_encoding/src/codec/wire.rs create mode 100644 crates/store/re_log_encoding/src/codec/wire/decoder.rs create mode 100644 crates/store/re_log_encoding/src/codec/wire/encoder.rs create mode 100644 crates/store/re_log_encoding/src/codec/wire/mod.rs create mode 100644 crates/store/re_log_encoding/src/protobuf_conversions.rs create mode 100644 crates/store/re_protos/proto/rerun/v0/log_msg.proto create mode 100644 crates/store/re_protos/src/v0/rerun.log_msg.v0.rs diff --git a/Cargo.lock b/Cargo.lock index 98a0e10c66c5..fef05a09e3c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5816,6 +5816,7 @@ dependencies = [ "re_chunk", "re_chunk_store", "re_log", + "re_log_encoding", "re_log_types", "re_query", "re_tracing", @@ -6083,6 +6084,7 @@ name = "re_protos_builder" version = "0.21.0-alpha.1+dev" dependencies = [ "camino", + "prost-build", "re_log", "tonic-build", ] diff --git a/Cargo.toml b/Cargo.toml index 73d17d1b009f..f9093aa23cf5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -241,6 +241,7 @@ prettyplease = "0.2" proc-macro2 = { version = "1.0", default-features = false } profiling = { version = "1.0.12", default-features = false } prost = "0.13.3" +prost-build = "0.13.3" puffin = "0.19.1" puffin_http = "0.16" pyo3 = "0.22.5" diff --git a/crates/build/re_protos_builder/Cargo.toml b/crates/build/re_protos_builder/Cargo.toml index 87ab72d8efb8..6f100bcd9d49 100644 --- a/crates/build/re_protos_builder/Cargo.toml +++ b/crates/build/re_protos_builder/Cargo.toml @@ -29,3 +29,4 @@ camino.workspace = true tonic-build = { workspace = true, default-features = false, features = [ "prost", ] } +prost-build = { workspace = true } diff --git a/crates/build/re_protos_builder/src/bin/build_re_remote_store_types.rs b/crates/build/re_protos_builder/src/bin/build_re_remote_store_types.rs index cbb6b8fea943..9ed06af18e62 100644 --- a/crates/build/re_protos_builder/src/bin/build_re_remote_store_types.rs +++ b/crates/build/re_protos_builder/src/bin/build_re_remote_store_types.rs @@ -7,9 +7,9 @@ use camino::Utf8Path; -const PROTOBUF_DEFINITIONS_DIR_PATH: &str = "crates/store/re_protos/proto"; -const PROTOBUF_REMOTE_STORE_V0_RELATIVE_PATH: &str = "rerun/v0/remote_store.proto"; -const RUST_V0_OUTPUT_DIR_PATH: &str = "crates/store/re_protos/src/v0"; +const PROTOS_DIR: &str = "crates/store/re_protos/proto"; +const INPUT_V0: &[&str] = &["rerun/v0/remote_store.proto", "rerun/v0/log_msg.proto"]; +const OUTPUT_V0_RUST_DIR: &str = "crates/store/re_protos/src/v0"; fn main() { re_log::setup_logging(); @@ -26,8 +26,8 @@ fn main() { "failed to find workspace root" ); - let definitions_dir_path = workspace_dir.join(PROTOBUF_DEFINITIONS_DIR_PATH); - let rust_generated_output_dir_path = workspace_dir.join(RUST_V0_OUTPUT_DIR_PATH); + let definitions_dir_path = workspace_dir.join(PROTOS_DIR); + let rust_generated_output_dir_path = workspace_dir.join(OUTPUT_V0_RUST_DIR); re_log::info!( definitions=?definitions_dir_path, @@ -37,7 +37,7 @@ fn main() { re_protos_builder::generate_rust_code( definitions_dir_path, - &[PROTOBUF_REMOTE_STORE_V0_RELATIVE_PATH], + INPUT_V0, rust_generated_output_dir_path, ); } diff --git a/crates/build/re_protos_builder/src/lib.rs b/crates/build/re_protos_builder/src/lib.rs index a1d2f744e1a0..6f382e89fb48 100644 --- a/crates/build/re_protos_builder/src/lib.rs +++ b/crates/build/re_protos_builder/src/lib.rs @@ -16,12 +16,15 @@ pub fn generate_rust_code( proto_paths: &[impl AsRef], output_dir: impl AsRef, ) { + let mut prost_config = prost_build::Config::new(); + prost_config.enable_type_names(); // tonic doesn't expose this option + if let Err(err) = tonic_build::configure() .out_dir(output_dir.as_ref()) .build_client(true) .build_server(true) .build_transport(false) // Small convenience, but doesn't work on web - .compile_protos(proto_paths, &[definitions_dir]) + .compile_protos_with_config(prost_config, proto_paths, &[definitions_dir]) { match err.kind() { std::io::ErrorKind::Other => { diff --git a/crates/store/re_chunk_store/src/lib.rs b/crates/store/re_chunk_store/src/lib.rs index 14921f45157c..645d6c7e9e84 100644 --- a/crates/store/re_chunk_store/src/lib.rs +++ b/crates/store/re_chunk_store/src/lib.rs @@ -51,8 +51,7 @@ pub use re_chunk::{ Chunk, ChunkId, ChunkShared, LatestAtQuery, RangeQuery, RangeQueryOptions, RowId, UnitChunkShared, }; -#[doc(no_inline)] -pub use re_log_encoding::decoder::VersionPolicy; + #[doc(no_inline)] pub use re_log_types::{ResolvedTimeRange, TimeInt, TimeType, Timeline}; @@ -60,7 +59,6 @@ pub mod external { pub use arrow2; pub use re_chunk; - pub use re_log_encoding; } // --- diff --git a/crates/store/re_chunk_store/src/protobuf_conversions.rs b/crates/store/re_chunk_store/src/protobuf_conversions.rs index 67ef038284e0..4f37e7b3bf5a 100644 --- a/crates/store/re_chunk_store/src/protobuf_conversions.rs +++ b/crates/store/re_chunk_store/src/protobuf_conversions.rs @@ -1,8 +1,8 @@ +use re_protos::missing_field; +use re_protos::TypeConversionError; use std::collections::BTreeMap; use std::collections::BTreeSet; -use re_protos::TypeConversionError; - impl TryFrom for crate::ComponentColumnSelector { type Error = TypeConversionError; @@ -11,16 +11,16 @@ impl TryFrom for crate::Componen ) -> Result { let entity_path = value .entity_path - .ok_or(TypeConversionError::missing_field( - "rerun.common.v0.ComponentColumnSelector", + .ok_or(missing_field!( + re_protos::common::v0::ComponentColumnSelector, "entity_path", ))? .try_into()?; let component_name = value .component - .ok_or(TypeConversionError::missing_field( - "rerun.common.v0.ComponentColumnSelector", + .ok_or(missing_field!( + re_protos::common::v0::ComponentColumnSelector, "component", ))? .name; @@ -36,8 +36,8 @@ impl TryFrom for crate::TimeColumnSel type Error = TypeConversionError; fn try_from(value: re_protos::common::v0::TimeColumnSelector) -> Result { - let timeline = value.timeline.ok_or(TypeConversionError::missing_field( - "rerun.common.v0.TimeColumnSelector", + let timeline = value.timeline.ok_or(missing_field!( + re_protos::common::v0::TimeColumnSelector, "timeline", ))?; @@ -51,12 +51,10 @@ impl TryFrom for crate::ColumnSelector { type Error = TypeConversionError; fn try_from(value: re_protos::common::v0::ColumnSelector) -> Result { - match value - .selector_type - .ok_or(TypeConversionError::missing_field( - "rerun.common.v0.ColumnSelector", - "selector_type", - ))? { + match value.selector_type.ok_or(missing_field!( + re_protos::common::v0::ColumnSelector, + "selector_type", + ))? { re_protos::common::v0::column_selector::SelectorType::ComponentColumn( component_column_selector, ) => { @@ -115,8 +113,8 @@ impl TryFrom for crate::ViewContentsSelecto .map(|part| { let entity_path: re_log_types::EntityPath = part .path - .ok_or(TypeConversionError::missing_field( - "rerun.common.v0.ViewContentsPart", + .ok_or(missing_field!( + re_protos::common::v0::ViewContentsPart, "path", ))? .try_into()?; @@ -139,8 +137,8 @@ impl TryFrom for crate::QueryExpression { fn try_from(value: re_protos::common::v0::Query) -> Result { let filtered_index = value .filtered_index - .ok_or(TypeConversionError::missing_field( - "rerun.common.v0.Query", + .ok_or(missing_field!( + re_protos::common::v0::Query, "filtered_index", ))? .try_into()?; diff --git a/crates/store/re_chunk_store/src/store.rs b/crates/store/re_chunk_store/src/store.rs index 454e3fb5c3ab..4658dd03812d 100644 --- a/crates/store/re_chunk_store/src/store.rs +++ b/crates/store/re_chunk_store/src/store.rs @@ -691,7 +691,7 @@ impl ChunkStore { pub fn from_rrd_filepath( store_config: &ChunkStoreConfig, path_to_rrd: impl AsRef, - version_policy: crate::VersionPolicy, + version_policy: re_log_encoding::VersionPolicy, ) -> anyhow::Result> { let path_to_rrd = path_to_rrd.as_ref(); @@ -808,7 +808,7 @@ impl ChunkStore { pub fn handle_from_rrd_filepath( store_config: &ChunkStoreConfig, path_to_rrd: impl AsRef, - version_policy: crate::VersionPolicy, + version_policy: re_log_encoding::VersionPolicy, ) -> anyhow::Result> { Ok( Self::from_rrd_filepath(store_config, path_to_rrd, version_policy)? diff --git a/crates/store/re_data_loader/src/loader_external.rs b/crates/store/re_data_loader/src/loader_external.rs index be4dacea5e61..51e4ac10f1d9 100644 --- a/crates/store/re_data_loader/src/loader_external.rs +++ b/crates/store/re_data_loader/src/loader_external.rs @@ -182,7 +182,7 @@ impl crate::DataLoader for ExternalLoader { // streaming data to stdout. let is_sending_data = Arc::new(AtomicBool::new(false)); - let version_policy = re_log_encoding::decoder::VersionPolicy::Warn; + let version_policy = re_log_encoding::VersionPolicy::Warn; let stdout = std::io::BufReader::new(stdout); match re_log_encoding::decoder::Decoder::new(version_policy, stdout) { Ok(decoder) => { diff --git a/crates/store/re_data_loader/src/loader_rrd.rs b/crates/store/re_data_loader/src/loader_rrd.rs index a7df3b51acb7..b421c6aa8d06 100644 --- a/crates/store/re_data_loader/src/loader_rrd.rs +++ b/crates/store/re_data_loader/src/loader_rrd.rs @@ -40,7 +40,7 @@ impl crate::DataLoader for RrdLoader { "Loading rrd data from filesystem…", ); - let version_policy = re_log_encoding::decoder::VersionPolicy::Warn; + let version_policy = re_log_encoding::VersionPolicy::Warn; match extension.as_str() { "rbl" => { @@ -118,7 +118,7 @@ impl crate::DataLoader for RrdLoader { return Err(crate::DataLoaderError::Incompatible(filepath)); } - let version_policy = re_log_encoding::decoder::VersionPolicy::Warn; + let version_policy = re_log_encoding::VersionPolicy::Warn; let contents = std::io::Cursor::new(contents); let decoder = match re_log_encoding::decoder::Decoder::new(version_policy, contents) { Ok(decoder) => decoder, @@ -308,7 +308,7 @@ impl RetryableFileReader { mod tests { use re_build_info::CrateVersion; use re_chunk::RowId; - use re_log_encoding::{decoder, encoder::DroppableEncoder}; + use re_log_encoding::{encoder::DroppableEncoder, VersionPolicy}; use re_log_types::{ ApplicationId, LogMsg, SetStoreInfo, StoreId, StoreInfo, StoreKind, StoreSource, Time, }; @@ -341,7 +341,7 @@ mod tests { let mut encoder = DroppableEncoder::new( re_build_info::CrateVersion::LOCAL, - re_log_encoding::EncodingOptions::UNCOMPRESSED, + re_log_encoding::EncodingOptions::MSGPACK_UNCOMPRESSED, rrd_file, ) .unwrap(); @@ -372,7 +372,7 @@ mod tests { encoder.flush_blocking().expect("failed to flush messages"); let reader = RetryableFileReader::new(&rrd_file_path).unwrap(); - let mut decoder = Decoder::new(decoder::VersionPolicy::Warn, reader).unwrap(); + let mut decoder = Decoder::new(VersionPolicy::Warn, reader).unwrap(); // we should be able to read 5 messages that we wrote let decoded_messages = (0..5) diff --git a/crates/store/re_data_source/src/load_stdin.rs b/crates/store/re_data_source/src/load_stdin.rs index 0573c20750ae..1c4f5ac437f5 100644 --- a/crates/store/re_data_source/src/load_stdin.rs +++ b/crates/store/re_data_source/src/load_stdin.rs @@ -6,7 +6,7 @@ use re_smart_channel::Sender; /// This fails synchronously iff the standard input stream could not be opened, otherwise errors /// are handled asynchronously (as in: they're logged). pub fn load_stdin(tx: Sender) -> anyhow::Result<()> { - let version_policy = re_log_encoding::decoder::VersionPolicy::Warn; + let version_policy = re_log_encoding::VersionPolicy::Warn; let stdin = std::io::BufReader::new(std::io::stdin()); let decoder = re_log_encoding::decoder::Decoder::new_concatenated(version_policy, stdin)?; diff --git a/crates/store/re_dataframe/Cargo.toml b/crates/store/re_dataframe/Cargo.toml index eb15df0a9b11..eaaca1a0a58d 100644 --- a/crates/store/re_dataframe/Cargo.toml +++ b/crates/store/re_dataframe/Cargo.toml @@ -24,16 +24,17 @@ all-features = true [features] default = [] - [dependencies] # Rerun dependencies: re_chunk.workspace = true re_chunk_store.workspace = true re_log.workspace = true +re_log_encoding.workspace = true re_log_types.workspace = true re_query.workspace = true re_tracing.workspace = true re_types_core.workspace = true + # External dependencies: anyhow.workspace = true arrow2.workspace = true diff --git a/crates/store/re_dataframe/examples/query.rs b/crates/store/re_dataframe/examples/query.rs index 3cc999177439..f4ffc1af746d 100644 --- a/crates/store/re_dataframe/examples/query.rs +++ b/crates/store/re_dataframe/examples/query.rs @@ -4,8 +4,9 @@ use itertools::Itertools; use re_dataframe::{ ChunkStoreConfig, EntityPathFilter, QueryEngine, QueryExpression, ResolvedTimeRange, - SparseFillStrategy, StoreKind, TimeInt, Timeline, VersionPolicy, + SparseFillStrategy, StoreKind, TimeInt, Timeline, }; +use re_log_encoding::VersionPolicy; fn main() -> anyhow::Result<()> { let args = std::env::args().collect_vec(); diff --git a/crates/store/re_dataframe/src/engine.rs b/crates/store/re_dataframe/src/engine.rs index 8a22a4cdaec0..3fc2bb875944 100644 --- a/crates/store/re_dataframe/src/engine.rs +++ b/crates/store/re_dataframe/src/engine.rs @@ -3,7 +3,6 @@ use std::collections::BTreeMap; use re_chunk::{EntityPath, TransportChunk}; use re_chunk_store::{ ChunkStore, ChunkStoreConfig, ChunkStoreHandle, ColumnDescriptor, QueryExpression, - VersionPolicy, }; use re_log_types::{EntityPathFilter, StoreId}; use re_query::{QueryCache, QueryCacheHandle, StorageEngine, StorageEngineLike}; @@ -59,7 +58,7 @@ impl QueryEngine { pub fn from_rrd_filepath( store_config: &ChunkStoreConfig, path_to_rrd: impl AsRef, - version_policy: VersionPolicy, + version_policy: re_log_encoding::VersionPolicy, ) -> anyhow::Result> { Ok( ChunkStore::handle_from_rrd_filepath(store_config, path_to_rrd, version_policy)? diff --git a/crates/store/re_dataframe/src/lib.rs b/crates/store/re_dataframe/src/lib.rs index 40702bc590ac..064727f9b612 100644 --- a/crates/store/re_dataframe/src/lib.rs +++ b/crates/store/re_dataframe/src/lib.rs @@ -13,8 +13,7 @@ pub use self::external::re_chunk::{util::concatenate_record_batches, TransportCh #[doc(no_inline)] pub use self::external::re_chunk_store::{ ChunkStoreConfig, ChunkStoreHandle, ColumnSelector, ComponentColumnSelector, Index, IndexRange, - IndexValue, QueryExpression, SparseFillStrategy, TimeColumnSelector, VersionPolicy, - ViewContentsSelector, + IndexValue, QueryExpression, SparseFillStrategy, TimeColumnSelector, ViewContentsSelector, }; #[doc(no_inline)] pub use self::external::re_log_types::{ diff --git a/crates/store/re_entity_db/examples/memory_usage.rs b/crates/store/re_entity_db/examples/memory_usage.rs index 7c4c524dc10e..870e296bcf72 100644 --- a/crates/store/re_entity_db/examples/memory_usage.rs +++ b/crates/store/re_entity_db/examples/memory_usage.rs @@ -66,7 +66,7 @@ fn log_messages() { fn encode_log_msg(log_msg: &LogMsg) -> Vec { let mut bytes = vec![]; - let encoding_options = re_log_encoding::EncodingOptions::COMPRESSED; + let encoding_options = re_log_encoding::EncodingOptions::MSGPACK_COMPRESSED; re_log_encoding::encoder::encode_ref( re_build_info::CrateVersion::LOCAL, encoding_options, @@ -78,7 +78,7 @@ fn log_messages() { } fn decode_log_msg(mut bytes: &[u8]) -> LogMsg { - let version_policy = re_log_encoding::decoder::VersionPolicy::Error; + let version_policy = re_log_encoding::VersionPolicy::Error; let mut messages = re_log_encoding::decoder::Decoder::new(version_policy, &mut bytes) .unwrap() .collect::, _>>() diff --git a/crates/store/re_entity_db/src/store_bundle.rs b/crates/store/re_entity_db/src/store_bundle.rs index 45fa833e02ee..a6645d606c45 100644 --- a/crates/store/re_entity_db/src/store_bundle.rs +++ b/crates/store/re_entity_db/src/store_bundle.rs @@ -1,7 +1,7 @@ use itertools::Itertools as _; use crate::EntityDb; -use re_log_encoding::decoder::VersionPolicy; +use re_log_encoding::VersionPolicy; use re_log_types::{StoreId, StoreKind}; #[derive(thiserror::Error, Debug)] diff --git a/crates/store/re_grpc_client/src/lib.rs b/crates/store/re_grpc_client/src/lib.rs index d6e7b3605e07..b37c07f20137 100644 --- a/crates/store/re_grpc_client/src/lib.rs +++ b/crates/store/re_grpc_client/src/lib.rs @@ -160,7 +160,8 @@ async fn stream_recording_async( .connect() .await?; - StorageNodeClient::new(tonic_client) + // TODO(#8411): figure out the right size for this + StorageNodeClient::new(tonic_client).max_decoding_message_size(usize::MAX) }; re_log::debug!("Fetching {recording_id}…"); diff --git a/crates/store/re_log_encoding/benches/msg_encode_benchmark.rs b/crates/store/re_log_encoding/benches/msg_encode_benchmark.rs index d2455b765530..40c72e5a906b 100644 --- a/crates/store/re_log_encoding/benches/msg_encode_benchmark.rs +++ b/crates/store/re_log_encoding/benches/msg_encode_benchmark.rs @@ -14,6 +14,10 @@ use re_log_types::{ LogMsg, StoreId, StoreKind, TimeInt, TimeType, Timeline, }; +use re_log_encoding::EncodingOptions; +const MSGPACK_COMPRESSED: EncodingOptions = EncodingOptions::MSGPACK_COMPRESSED; +const PROTOBUF_COMPRESSED: EncodingOptions = EncodingOptions::PROTOBUF_COMPRESSED; + use criterion::{criterion_group, criterion_main, Criterion}; #[cfg(not(debug_assertions))] @@ -31,8 +35,10 @@ criterion_group!( ); criterion_main!(benches); -fn encode_log_msgs(messages: &[LogMsg]) -> Vec { - let encoding_options = re_log_encoding::EncodingOptions::COMPRESSED; +fn encode_log_msgs( + messages: &[LogMsg], + encoding_options: re_log_encoding::EncodingOptions, +) -> Vec { let mut bytes = vec![]; re_log_encoding::encoder::encode_ref( re_build_info::CrateVersion::LOCAL, @@ -46,7 +52,7 @@ fn encode_log_msgs(messages: &[LogMsg]) -> Vec { } fn decode_log_msgs(mut bytes: &[u8]) -> Vec { - let version_policy = re_log_encoding::decoder::VersionPolicy::Error; + let version_policy = re_log_encoding::VersionPolicy::Error; let messages = re_log_encoding::decoder::Decoder::new(version_policy, &mut bytes) .unwrap() .collect::, _>>() @@ -111,30 +117,67 @@ fn mono_points_arrow(c: &mut Criterion) { }); let messages = generate_messages(&store_id, &chunks); group.bench_function("encode_log_msg", |b| { - b.iter(|| encode_log_msgs(&messages)); + b.iter(|| encode_log_msgs(&messages, MSGPACK_COMPRESSED)); }); - group.bench_function("encode_total", |b| { - b.iter(|| encode_log_msgs(&generate_messages(&store_id, &generate_chunks()))); + group.bench_function("encode_log_msg(protobuf)", |b| { + b.iter(|| encode_log_msgs(&messages, PROTOBUF_COMPRESSED)); }); - - let encoded = encode_log_msgs(&messages); - group.bench_function("decode_log_msg", |b| { + group.bench_function("encode_total", |b| { b.iter(|| { - let decoded = decode_log_msgs(&encoded); - assert_eq!(decoded.len(), messages.len()); - decoded + encode_log_msgs( + &generate_messages(&store_id, &generate_chunks()), + MSGPACK_COMPRESSED, + ) }); }); - group.bench_function("decode_message_bundles", |b| { + group.bench_function("encode_total(protobuf)", |b| { b.iter(|| { - let chunks = decode_chunks(&messages); - assert_eq!(chunks.len(), messages.len()); - chunks + encode_log_msgs( + &generate_messages(&store_id, &generate_chunks()), + PROTOBUF_COMPRESSED, + ) }); }); - group.bench_function("decode_total", |b| { - b.iter(|| decode_chunks(&decode_log_msgs(&encoded))); - }); + + { + let encoded = encode_log_msgs(&messages, MSGPACK_COMPRESSED); + group.bench_function("decode_log_msg", |b| { + b.iter(|| { + let decoded = decode_log_msgs(&encoded); + assert_eq!(decoded.len(), messages.len()); + decoded + }); + }); + group.bench_function("decode_message_bundles", |b| { + b.iter(|| { + let chunks = decode_chunks(&messages); + assert_eq!(chunks.len(), messages.len()); + chunks + }); + }); + group.bench_function("decode_total", |b| { + b.iter(|| decode_chunks(&decode_log_msgs(&encoded))); + }); + + let encoded = encode_log_msgs(&messages, PROTOBUF_COMPRESSED); + group.bench_function("decode_log_msg(protobuf)", |b| { + b.iter(|| { + let decoded = decode_log_msgs(&encoded); + assert_eq!(decoded.len(), messages.len()); + decoded + }); + }); + group.bench_function("decode_message_bundles(protobuf)", |b| { + b.iter(|| { + let chunks = decode_chunks(&messages); + assert_eq!(chunks.len(), messages.len()); + chunks + }); + }); + group.bench_function("decode_total(protobuf)", |b| { + b.iter(|| decode_chunks(&decode_log_msgs(&encoded))); + }); + } } } @@ -167,30 +210,67 @@ fn mono_points_arrow_batched(c: &mut Criterion) { }); let messages = generate_messages(&store_id, &chunks); group.bench_function("encode_log_msg", |b| { - b.iter(|| encode_log_msgs(&messages)); + b.iter(|| encode_log_msgs(&messages, MSGPACK_COMPRESSED)); }); - group.bench_function("encode_total", |b| { - b.iter(|| encode_log_msgs(&generate_messages(&store_id, &[generate_chunk()]))); + group.bench_function("encode_log_msg(protobuf)", |b| { + b.iter(|| encode_log_msgs(&messages, PROTOBUF_COMPRESSED)); }); - - let encoded = encode_log_msgs(&messages); - group.bench_function("decode_log_msg", |b| { + group.bench_function("encode_total", |b| { b.iter(|| { - let decoded = decode_log_msgs(&encoded); - assert_eq!(decoded.len(), messages.len()); - decoded + encode_log_msgs( + &generate_messages(&store_id, &[generate_chunk()]), + MSGPACK_COMPRESSED, + ) }); }); - group.bench_function("decode_message_bundles", |b| { + group.bench_function("encode_total(protobuf)", |b| { b.iter(|| { - let bundles = decode_chunks(&messages); - assert_eq!(bundles.len(), messages.len()); - bundles + encode_log_msgs( + &generate_messages(&store_id, &[generate_chunk()]), + PROTOBUF_COMPRESSED, + ) }); }); - group.bench_function("decode_total", |b| { - b.iter(|| decode_chunks(&decode_log_msgs(&encoded))); - }); + + { + let encoded = encode_log_msgs(&messages, MSGPACK_COMPRESSED); + group.bench_function("decode_log_msg", |b| { + b.iter(|| { + let decoded = decode_log_msgs(&encoded); + assert_eq!(decoded.len(), messages.len()); + decoded + }); + }); + group.bench_function("decode_message_bundles", |b| { + b.iter(|| { + let bundles = decode_chunks(&messages); + assert_eq!(bundles.len(), messages.len()); + bundles + }); + }); + group.bench_function("decode_total", |b| { + b.iter(|| decode_chunks(&decode_log_msgs(&encoded))); + }); + + let encoded = encode_log_msgs(&messages, PROTOBUF_COMPRESSED); + group.bench_function("decode_log_msg(protobuf)", |b| { + b.iter(|| { + let decoded = decode_log_msgs(&encoded); + assert_eq!(decoded.len(), messages.len()); + decoded + }); + }); + group.bench_function("decode_message_bundles(protobuf)", |b| { + b.iter(|| { + let bundles = decode_chunks(&messages); + assert_eq!(bundles.len(), messages.len()); + bundles + }); + }); + group.bench_function("decode_total(protobuf)", |b| { + b.iter(|| decode_chunks(&decode_log_msgs(&encoded))); + }); + } } } @@ -222,30 +302,67 @@ fn batch_points_arrow(c: &mut Criterion) { }); let messages = generate_messages(&store_id, &chunks); group.bench_function("encode_log_msg", |b| { - b.iter(|| encode_log_msgs(&messages)); + b.iter(|| encode_log_msgs(&messages, MSGPACK_COMPRESSED)); }); - group.bench_function("encode_total", |b| { - b.iter(|| encode_log_msgs(&generate_messages(&store_id, &generate_chunks()))); + group.bench_function("encode_log_msg(protobuf)", |b| { + b.iter(|| encode_log_msgs(&messages, PROTOBUF_COMPRESSED)); }); - - let encoded = encode_log_msgs(&messages); - group.bench_function("decode_log_msg", |b| { + group.bench_function("encode_total", |b| { b.iter(|| { - let decoded = decode_log_msgs(&encoded); - assert_eq!(decoded.len(), messages.len()); - decoded + encode_log_msgs( + &generate_messages(&store_id, &generate_chunks()), + MSGPACK_COMPRESSED, + ) }); }); - group.bench_function("decode_message_bundles", |b| { + group.bench_function("encode_total(protobuf)", |b| { b.iter(|| { - let chunks = decode_chunks(&messages); - assert_eq!(chunks.len(), messages.len()); - chunks + encode_log_msgs( + &generate_messages(&store_id, &generate_chunks()), + PROTOBUF_COMPRESSED, + ) }); }); - group.bench_function("decode_total", |b| { - b.iter(|| decode_chunks(&decode_log_msgs(&encoded))); - }); + + { + let encoded = encode_log_msgs(&messages, MSGPACK_COMPRESSED); + group.bench_function("decode_log_msg", |b| { + b.iter(|| { + let decoded = decode_log_msgs(&encoded); + assert_eq!(decoded.len(), messages.len()); + decoded + }); + }); + group.bench_function("decode_message_bundles", |b| { + b.iter(|| { + let chunks = decode_chunks(&messages); + assert_eq!(chunks.len(), messages.len()); + chunks + }); + }); + group.bench_function("decode_total", |b| { + b.iter(|| decode_chunks(&decode_log_msgs(&encoded))); + }); + + let encoded = encode_log_msgs(&messages, PROTOBUF_COMPRESSED); + group.bench_function("decode_log_msg(protobuf)", |b| { + b.iter(|| { + let decoded = decode_log_msgs(&encoded); + assert_eq!(decoded.len(), messages.len()); + decoded + }); + }); + group.bench_function("decode_message_bundles(protobuf)", |b| { + b.iter(|| { + let chunks = decode_chunks(&messages); + assert_eq!(chunks.len(), messages.len()); + chunks + }); + }); + group.bench_function("decode_total(protobuf)", |b| { + b.iter(|| decode_chunks(&decode_log_msgs(&encoded))); + }); + } } } diff --git a/crates/store/re_log_encoding/src/codec/arrow.rs b/crates/store/re_log_encoding/src/codec/arrow.rs new file mode 100644 index 000000000000..ae7cddabe27e --- /dev/null +++ b/crates/store/re_log_encoding/src/codec/arrow.rs @@ -0,0 +1,96 @@ +use super::CodecError; + +use arrow2::array::Array as Arrow2Array; +use arrow2::datatypes::Schema as Arrow2Schema; +use arrow2::io::ipc; + +type Arrow2Chunk = arrow2::chunk::Chunk>; + +/// Helper function that serializes given arrow schema and record batch into bytes +/// using Arrow IPC format. +pub(crate) fn write_arrow_to_bytes( + writer: &mut W, + schema: &Arrow2Schema, + data: &Arrow2Chunk, +) -> Result<(), CodecError> { + let options = ipc::write::WriteOptions { compression: None }; + let mut sw = ipc::write::StreamWriter::new(writer, options); + + sw.start(schema, None) + .map_err(CodecError::ArrowSerialization)?; + sw.write(data, None) + .map_err(CodecError::ArrowSerialization)?; + sw.finish().map_err(CodecError::ArrowSerialization)?; + + Ok(()) +} + +/// Helper function that deserializes raw bytes into arrow schema and record batch +/// using Arrow IPC format. +pub(crate) fn read_arrow_from_bytes( + reader: &mut R, +) -> Result<(Arrow2Schema, Arrow2Chunk), CodecError> { + use arrow2::io::ipc; + + let metadata = + ipc::read::read_stream_metadata(reader).map_err(CodecError::ArrowSerialization)?; + let mut stream = ipc::read::StreamReader::new(reader, metadata, None); + + let schema = stream.schema().clone(); + // there should be at least one record batch in the stream + let stream_state = stream + .next() + .ok_or(CodecError::MissingRecordBatch)? + .map_err(CodecError::ArrowSerialization)?; + + match stream_state { + ipc::read::StreamState::Waiting => Err(CodecError::UnexpectedStreamState), + ipc::read::StreamState::Some(chunk) => Ok((schema, chunk)), + } +} + +#[cfg(feature = "encoder")] +pub(crate) struct Payload { + pub uncompressed_size: usize, + pub data: Vec, +} + +#[cfg(feature = "encoder")] +pub(crate) fn encode_arrow( + schema: &Arrow2Schema, + chunk: &Arrow2Chunk, + compression: crate::Compression, +) -> Result { + let mut uncompressed = Vec::new(); + write_arrow_to_bytes(&mut uncompressed, schema, chunk)?; + let uncompressed_size = uncompressed.len(); + + let data = match compression { + crate::Compression::Off => uncompressed, + crate::Compression::LZ4 => lz4_flex::block::compress(&uncompressed), + }; + + Ok(Payload { + uncompressed_size, + data, + }) +} + +#[cfg(feature = "decoder")] +pub(crate) fn decode_arrow( + data: &[u8], + uncompressed_size: usize, + compression: crate::Compression, +) -> Result<(Arrow2Schema, Arrow2Chunk), crate::decoder::DecodeError> { + let mut uncompressed = Vec::new(); + let data = match compression { + crate::Compression::Off => data, + crate::Compression::LZ4 => { + uncompressed.resize(uncompressed_size, 0); + lz4_flex::block::decompress_into(data, &mut uncompressed)?; + uncompressed.as_slice() + } + }; + + Ok(read_arrow_from_bytes(&mut &data[..])?) +} diff --git a/crates/store/re_log_encoding/src/codec/file/decoder.rs b/crates/store/re_log_encoding/src/codec/file/decoder.rs new file mode 100644 index 000000000000..16b6f0ba4728 --- /dev/null +++ b/crates/store/re_log_encoding/src/codec/file/decoder.rs @@ -0,0 +1,58 @@ +use super::{MessageHeader, MessageKind}; +use crate::codec::arrow::decode_arrow; +use crate::codec::CodecError; +use crate::decoder::DecodeError; +use re_log_types::LogMsg; +use re_protos::missing_field; + +pub(crate) fn decode(data: &mut impl std::io::Read) -> Result<(u64, Option), DecodeError> { + use re_protos::external::prost::Message; + use re_protos::log_msg::v0::{ArrowMsg, BlueprintActivationCommand, Encoding, SetStoreInfo}; + + let mut read_bytes = 0u64; + let header = MessageHeader::decode(data)?; + read_bytes += std::mem::size_of::() as u64 + header.len; + + let mut buf = vec![0; header.len as usize]; + data.read_exact(&mut buf[..])?; + + let msg = match header.kind { + MessageKind::SetStoreInfo => { + let set_store_info = SetStoreInfo::decode(&buf[..])?; + Some(LogMsg::SetStoreInfo(set_store_info.try_into()?)) + } + MessageKind::ArrowMsg => { + let arrow_msg = ArrowMsg::decode(&buf[..])?; + if arrow_msg.encoding() != Encoding::ArrowIpc { + return Err(DecodeError::Codec(CodecError::UnsupportedEncoding)); + } + + let (schema, chunk) = decode_arrow( + &arrow_msg.payload, + arrow_msg.uncompressed_size as usize, + arrow_msg.compression().into(), + )?; + + let store_id: re_log_types::StoreId = arrow_msg + .store_id + .ok_or_else(|| missing_field!(re_protos::log_msg::v0::ArrowMsg, "store_id"))? + .into(); + + let chunk = re_chunk::Chunk::from_transport(&re_chunk::TransportChunk { + schema, + data: chunk, + })?; + + Some(LogMsg::ArrowMsg(store_id, chunk.to_arrow_msg()?)) + } + MessageKind::BlueprintActivationCommand => { + let blueprint_activation_command = BlueprintActivationCommand::decode(&buf[..])?; + Some(LogMsg::BlueprintActivationCommand( + blueprint_activation_command.try_into()?, + )) + } + MessageKind::End => None, + }; + + Ok((read_bytes, msg)) +} diff --git a/crates/store/re_log_encoding/src/codec/file/encoder.rs b/crates/store/re_log_encoding/src/codec/file/encoder.rs new file mode 100644 index 000000000000..3456df76b37b --- /dev/null +++ b/crates/store/re_log_encoding/src/codec/file/encoder.rs @@ -0,0 +1,59 @@ +use super::{MessageHeader, MessageKind}; +use crate::codec::arrow::encode_arrow; +use crate::encoder::EncodeError; +use crate::Compression; +use re_log_types::LogMsg; + +pub(crate) fn encode( + buf: &mut Vec, + message: &LogMsg, + compression: Compression, +) -> Result<(), EncodeError> { + use re_protos::external::prost::Message; + use re_protos::log_msg::v0::{ + self as proto, ArrowMsg, BlueprintActivationCommand, Encoding, SetStoreInfo, + }; + + match message { + LogMsg::SetStoreInfo(set_store_info) => { + let set_store_info: SetStoreInfo = set_store_info.clone().into(); + let header = MessageHeader { + kind: MessageKind::SetStoreInfo, + len: set_store_info.encoded_len() as u64, + }; + header.encode(buf)?; + set_store_info.encode(buf)?; + } + LogMsg::ArrowMsg(store_id, arrow_msg) => { + let payload = encode_arrow(&arrow_msg.schema, &arrow_msg.chunk, compression)?; + let arrow_msg = ArrowMsg { + store_id: Some(store_id.clone().into()), + compression: match compression { + Compression::Off => proto::Compression::None as i32, + Compression::LZ4 => proto::Compression::Lz4 as i32, + }, + uncompressed_size: payload.uncompressed_size as i32, + encoding: Encoding::ArrowIpc as i32, + payload: payload.data, + }; + let header = MessageHeader { + kind: MessageKind::ArrowMsg, + len: arrow_msg.encoded_len() as u64, + }; + header.encode(buf)?; + arrow_msg.encode(buf)?; + } + LogMsg::BlueprintActivationCommand(blueprint_activation_command) => { + let blueprint_activation_command: BlueprintActivationCommand = + blueprint_activation_command.clone().into(); + let header = MessageHeader { + kind: MessageKind::BlueprintActivationCommand, + len: blueprint_activation_command.encoded_len() as u64, + }; + header.encode(buf)?; + blueprint_activation_command.encode(buf)?; + } + } + + Ok(()) +} diff --git a/crates/store/re_log_encoding/src/codec/file/mod.rs b/crates/store/re_log_encoding/src/codec/file/mod.rs new file mode 100644 index 000000000000..e491777409ca --- /dev/null +++ b/crates/store/re_log_encoding/src/codec/file/mod.rs @@ -0,0 +1,70 @@ +#[cfg(feature = "decoder")] +pub(crate) mod decoder; +#[cfg(feature = "encoder")] +pub(crate) mod encoder; + +#[allow(dead_code)] // used behind feature flag +#[derive(Default, Debug, Clone, Copy)] +#[repr(u64)] +pub(crate) enum MessageKind { + #[default] + End = Self::END, + SetStoreInfo = Self::SET_STORE_INFO, + ArrowMsg = Self::ARROW_MSG, + BlueprintActivationCommand = Self::BLUEPRINT_ACTIVATION_COMMAND, +} + +#[allow(dead_code)] // used behind feature flag +impl MessageKind { + const END: u64 = 0; + const SET_STORE_INFO: u64 = 1; + const ARROW_MSG: u64 = 2; + const BLUEPRINT_ACTIVATION_COMMAND: u64 = 3; +} + +#[allow(dead_code)] // used behind feature flag +#[derive(Debug, Clone, Copy)] +pub(crate) struct MessageHeader { + pub(crate) kind: MessageKind, + pub(crate) len: u64, +} + +impl MessageHeader { + #[cfg(feature = "encoder")] + pub(crate) fn encode( + &self, + buf: &mut impl std::io::Write, + ) -> Result<(), crate::encoder::EncodeError> { + let Self { kind, len } = *self; + buf.write_all(&(kind as u64).to_le_bytes())?; + buf.write_all(&len.to_le_bytes())?; + Ok(()) + } + + #[cfg(feature = "decoder")] + pub(crate) fn decode( + data: &mut impl std::io::Read, + ) -> Result { + let mut buf = [0; std::mem::size_of::()]; + data.read_exact(&mut buf)?; + + #[allow(clippy::unwrap_used)] // cannot fail + let kind = u64::from_le_bytes(buf[0..8].try_into().unwrap()); + let kind = match kind { + MessageKind::END => MessageKind::End, + MessageKind::SET_STORE_INFO => MessageKind::SetStoreInfo, + MessageKind::ARROW_MSG => MessageKind::ArrowMsg, + MessageKind::BLUEPRINT_ACTIVATION_COMMAND => MessageKind::BlueprintActivationCommand, + _ => { + return Err(crate::decoder::DecodeError::Codec( + crate::codec::CodecError::UnknownMessageHeader, + )) + } + }; + + #[allow(clippy::unwrap_used)] // cannot fail + let len = u64::from_le_bytes(buf[8..16].try_into().unwrap()); + + Ok(Self { kind, len }) + } +} diff --git a/crates/store/re_log_encoding/src/codec/mod.rs b/crates/store/re_log_encoding/src/codec/mod.rs index c332217e0e04..7c51b4b690e0 100644 --- a/crates/store/re_log_encoding/src/codec/mod.rs +++ b/crates/store/re_log_encoding/src/codec/mod.rs @@ -1,3 +1,5 @@ +mod arrow; +pub mod file; pub mod wire; #[derive(Debug, thiserror::Error)] @@ -20,18 +22,6 @@ pub enum CodecError { #[error("Unsupported encoding, expected Arrow IPC")] UnsupportedEncoding, - #[error("Invalid file header")] - InvalidFileHeader, - #[error("Unknown message header")] UnknownMessageHeader, - - #[error("Invalid message header")] - InvalidMessageHeader, - - #[error("Unknown message kind {0}")] - UnknownMessageKind(u8), - - #[error("Invalid argument: {0}")] - InvalidArgument(String), } diff --git a/crates/store/re_log_encoding/src/codec/wire.rs b/crates/store/re_log_encoding/src/codec/wire.rs deleted file mode 100644 index e0b0daabd1d1..000000000000 --- a/crates/store/re_log_encoding/src/codec/wire.rs +++ /dev/null @@ -1,261 +0,0 @@ -use arrow2::chunk::Chunk as Arrow2Chunk; -use arrow2::datatypes::Schema as Arrow2Schema; -use arrow2::io::ipc; -use re_chunk::Arrow2Array; -use re_chunk::TransportChunk; - -use super::CodecError; - -#[derive(Clone, Copy, PartialEq, Eq, Hash, Default)] -pub struct MessageHeader(pub u8); - -impl MessageHeader { - pub const NO_DATA: Self = Self(1); - pub const RECORD_BATCH: Self = Self(2); - - pub const SIZE_BYTES: usize = 1; -} - -impl MessageHeader { - fn decode(read: &mut impl std::io::Read) -> Result { - let mut buffer = [0_u8; Self::SIZE_BYTES]; - read.read_exact(&mut buffer) - .map_err(CodecError::HeaderDecoding)?; - - let header = u8::from_le(buffer[0]); - - Ok(Self(header)) - } - - fn encode(&self, write: &mut impl std::io::Write) -> Result<(), CodecError> { - write - .write_all(&[self.0]) - .map_err(CodecError::HeaderEncoding)?; - - Ok(()) - } -} - -#[derive(Debug)] -pub enum TransportMessageV0 { - NoData, - RecordBatch(TransportChunk), -} - -impl TransportMessageV0 { - fn to_bytes(&self) -> Result, CodecError> { - match self { - Self::NoData => { - let mut data: Vec = Vec::new(); - MessageHeader::NO_DATA.encode(&mut data)?; - Ok(data) - } - Self::RecordBatch(chunk) => { - let mut data: Vec = Vec::new(); - MessageHeader::RECORD_BATCH.encode(&mut data)?; - - write_arrow_to_bytes(&mut data, &chunk.schema, &chunk.data)?; - - Ok(data) - } - } - } - - fn from_bytes(data: &[u8]) -> Result { - let mut reader = std::io::Cursor::new(data); - let header = MessageHeader::decode(&mut reader)?; - - match header { - MessageHeader::NO_DATA => Ok(Self::NoData), - MessageHeader::RECORD_BATCH => { - let (schema, data) = read_arrow_from_bytes(&mut reader)?; - - let tc = TransportChunk { - schema: schema.clone(), - data, - }; - - Ok(Self::RecordBatch(tc)) - } - _ => Err(CodecError::UnknownMessageHeader), - } - } -} - -// TODO(zehiko) add support for separately encoding schema from the record batch to get rid of overhead -// of sending schema in each transport message for the same stream of batches. This will require codec -// to become stateful and keep track if schema was sent / received. -/// Encode a transport chunk into a byte stream. -pub fn encode( - version: re_protos::common::v0::EncoderVersion, - chunk: TransportChunk, -) -> Result, CodecError> { - match version { - re_protos::common::v0::EncoderVersion::V0 => { - TransportMessageV0::RecordBatch(chunk).to_bytes() - } - } -} - -/// Encode a `NoData` message into a byte stream. This can be used by the remote store -/// (i.e. data producer) to signal back to the client that there's no data available. -pub fn no_data(version: re_protos::common::v0::EncoderVersion) -> Result, CodecError> { - match version { - re_protos::common::v0::EncoderVersion::V0 => TransportMessageV0::NoData.to_bytes(), - } -} - -/// Decode transport data from a byte stream - if there's a record batch present, return it, otherwise return `None`. -pub fn decode( - version: re_protos::common::v0::EncoderVersion, - data: &[u8], -) -> Result, CodecError> { - match version { - re_protos::common::v0::EncoderVersion::V0 => { - let msg = TransportMessageV0::from_bytes(data)?; - match msg { - TransportMessageV0::RecordBatch(chunk) => Ok(Some(chunk)), - TransportMessageV0::NoData => Ok(None), - } - } - } -} - -/// Helper function that serializes given arrow schema and record batch into bytes -/// using Arrow IPC format. -pub fn write_arrow_to_bytes( - writer: &mut W, - schema: &Arrow2Schema, - data: &Arrow2Chunk>, -) -> Result<(), CodecError> { - let options = ipc::write::WriteOptions { compression: None }; - let mut sw = ipc::write::StreamWriter::new(writer, options); - - sw.start(schema, None) - .map_err(CodecError::ArrowSerialization)?; - sw.write(data, None) - .map_err(CodecError::ArrowSerialization)?; - sw.finish().map_err(CodecError::ArrowSerialization)?; - - Ok(()) -} - -/// Helper function that deserializes raw bytes into arrow schema and record batch -/// using Arrow IPC format. -pub fn read_arrow_from_bytes( - reader: &mut R, -) -> Result<(Arrow2Schema, Arrow2Chunk>), CodecError> { - let metadata = - ipc::read::read_stream_metadata(reader).map_err(CodecError::ArrowSerialization)?; - let mut stream = ipc::read::StreamReader::new(reader, metadata, None); - - let schema = stream.schema().clone(); - // there should be at least one record batch in the stream - let stream_state = stream - .next() - .ok_or(CodecError::MissingRecordBatch)? - .map_err(CodecError::ArrowSerialization)?; - - match stream_state { - ipc::read::StreamState::Waiting => Err(CodecError::UnexpectedStreamState), - ipc::read::StreamState::Some(chunk) => Ok((schema, chunk)), - } -} - -#[cfg(test)] -mod tests { - use crate::{ - codec::wire::{decode, encode, TransportMessageV0}, - codec::CodecError, - }; - use re_chunk::{Chunk, RowId}; - use re_log_types::{example_components::MyPoint, Timeline}; - use re_protos::common::v0::EncoderVersion; - - fn get_test_chunk() -> Chunk { - let row_id1 = RowId::new(); - let row_id2 = RowId::new(); - - let timepoint1 = [ - (Timeline::log_time(), 100), - (Timeline::new_sequence("frame"), 1), - ]; - let timepoint2 = [ - (Timeline::log_time(), 104), - (Timeline::new_sequence("frame"), 1), - ]; - - let points1 = &[MyPoint::new(1.0, 1.0)]; - let points2 = &[MyPoint::new(2.0, 2.0)]; - - Chunk::builder("mypoints".into()) - .with_component_batches(row_id1, timepoint1, [points1 as _]) - .with_component_batches(row_id2, timepoint2, [points2 as _]) - .build() - .unwrap() - } - - #[test] - fn test_message_v0_no_data() { - let msg = TransportMessageV0::NoData; - let data = msg.to_bytes().unwrap(); - let decoded = TransportMessageV0::from_bytes(&data).unwrap(); - assert!(matches!(decoded, TransportMessageV0::NoData)); - } - - #[test] - fn test_message_v0_record_batch() { - let expected_chunk = get_test_chunk(); - - let msg = TransportMessageV0::RecordBatch(expected_chunk.clone().to_transport().unwrap()); - let data = msg.to_bytes().unwrap(); - let decoded = TransportMessageV0::from_bytes(&data).unwrap(); - - #[allow(clippy::match_wildcard_for_single_variants)] - match decoded { - TransportMessageV0::RecordBatch(transport) => { - let decoded_chunk = Chunk::from_transport(&transport).unwrap(); - assert_eq!(expected_chunk, decoded_chunk); - } - _ => panic!("unexpected message type"), - } - } - - #[test] - fn test_invalid_batch_data() { - let data = vec![2, 3, 4]; // '1' is NO_DATA message header - let decoded = TransportMessageV0::from_bytes(&data); - - assert!(matches!( - decoded.err().unwrap(), - CodecError::ArrowSerialization(_) - )); - } - - #[test] - fn test_unknown_header() { - let data = vec![3]; - let decoded = TransportMessageV0::from_bytes(&data); - assert!(decoded.is_err()); - - assert!(matches!( - decoded.err().unwrap(), - CodecError::UnknownMessageHeader - )); - } - - #[test] - fn test_v0_codec() { - let expected_chunk = get_test_chunk(); - - let encoded = encode( - EncoderVersion::V0, - expected_chunk.clone().to_transport().unwrap(), - ) - .unwrap(); - let decoded = decode(EncoderVersion::V0, &encoded).unwrap().unwrap(); - let decoded_chunk = Chunk::from_transport(&decoded).unwrap(); - - assert_eq!(expected_chunk, decoded_chunk); - } -} diff --git a/crates/store/re_log_encoding/src/codec/wire/decoder.rs b/crates/store/re_log_encoding/src/codec/wire/decoder.rs new file mode 100644 index 000000000000..06b9bccdbc23 --- /dev/null +++ b/crates/store/re_log_encoding/src/codec/wire/decoder.rs @@ -0,0 +1,55 @@ +use super::MessageHeader; +use super::TransportMessageV0; +use crate::codec::arrow::read_arrow_from_bytes; +use crate::codec::CodecError; +use re_chunk::TransportChunk; + +impl MessageHeader { + pub(crate) fn decode(read: &mut impl std::io::Read) -> Result { + let mut buffer = [0_u8; Self::SIZE_BYTES]; + read.read_exact(&mut buffer) + .map_err(CodecError::HeaderDecoding)?; + + let header = u8::from_le(buffer[0]); + + Ok(Self(header)) + } +} + +impl TransportMessageV0 { + pub(crate) fn from_bytes(data: &[u8]) -> Result { + let mut reader = std::io::Cursor::new(data); + let header = MessageHeader::decode(&mut reader)?; + + match header { + MessageHeader::NO_DATA => Ok(Self::NoData), + MessageHeader::RECORD_BATCH => { + let (schema, data) = read_arrow_from_bytes(&mut reader)?; + + let tc = TransportChunk { + schema: schema.clone(), + data, + }; + + Ok(Self::RecordBatch(tc)) + } + _ => Err(CodecError::UnknownMessageHeader), + } + } +} + +/// Decode transport data from a byte stream - if there's a record batch present, return it, otherwise return `None`. +pub fn decode( + version: re_protos::common::v0::EncoderVersion, + data: &[u8], +) -> Result, CodecError> { + match version { + re_protos::common::v0::EncoderVersion::V0 => { + let msg = TransportMessageV0::from_bytes(data)?; + match msg { + TransportMessageV0::RecordBatch(chunk) => Ok(Some(chunk)), + TransportMessageV0::NoData => Ok(None), + } + } + } +} diff --git a/crates/store/re_log_encoding/src/codec/wire/encoder.rs b/crates/store/re_log_encoding/src/codec/wire/encoder.rs new file mode 100644 index 000000000000..e6ae62c1e1b7 --- /dev/null +++ b/crates/store/re_log_encoding/src/codec/wire/encoder.rs @@ -0,0 +1,58 @@ +use super::MessageHeader; +use super::TransportMessageV0; +use crate::codec::arrow::write_arrow_to_bytes; +use crate::codec::CodecError; +use re_chunk::TransportChunk; + +impl MessageHeader { + pub(crate) fn encode(&self, write: &mut impl std::io::Write) -> Result<(), CodecError> { + write + .write_all(&[self.0]) + .map_err(CodecError::HeaderEncoding)?; + + Ok(()) + } +} + +impl TransportMessageV0 { + pub(crate) fn to_bytes(&self) -> Result, CodecError> { + match self { + Self::NoData => { + let mut data: Vec = Vec::new(); + MessageHeader::NO_DATA.encode(&mut data)?; + Ok(data) + } + Self::RecordBatch(chunk) => { + let mut data: Vec = Vec::new(); + MessageHeader::RECORD_BATCH.encode(&mut data)?; + + write_arrow_to_bytes(&mut data, &chunk.schema, &chunk.data)?; + + Ok(data) + } + } + } +} + +/// Encode a `NoData` message into a byte stream. This can be used by the remote store +/// (i.e. data producer) to signal back to the client that there's no data available. +pub fn no_data(version: re_protos::common::v0::EncoderVersion) -> Result, CodecError> { + match version { + re_protos::common::v0::EncoderVersion::V0 => TransportMessageV0::NoData.to_bytes(), + } +} + +// TODO(zehiko) add support for separately encoding schema from the record batch to get rid of overhead +// of sending schema in each transport message for the same stream of batches. This will require codec +// to become stateful and keep track if schema was sent / received. +/// Encode a transport chunk into a byte stream. +pub fn encode( + version: re_protos::common::v0::EncoderVersion, + chunk: TransportChunk, +) -> Result, CodecError> { + match version { + re_protos::common::v0::EncoderVersion::V0 => { + TransportMessageV0::RecordBatch(chunk).to_bytes() + } + } +} diff --git a/crates/store/re_log_encoding/src/codec/wire/mod.rs b/crates/store/re_log_encoding/src/codec/wire/mod.rs new file mode 100644 index 000000000000..587e9e31e2ce --- /dev/null +++ b/crates/store/re_log_encoding/src/codec/wire/mod.rs @@ -0,0 +1,121 @@ +pub mod decoder; +pub mod encoder; + +pub use decoder::decode; +pub use encoder::encode; + +use re_chunk::TransportChunk; + +#[derive(Clone, Copy, PartialEq, Eq, Hash, Default)] +pub struct MessageHeader(pub u8); + +impl MessageHeader { + pub const NO_DATA: Self = Self(1); + pub const RECORD_BATCH: Self = Self(2); + + pub const SIZE_BYTES: usize = 1; +} + +#[derive(Debug)] +pub enum TransportMessageV0 { + NoData, + RecordBatch(TransportChunk), +} + +#[cfg(test)] +mod tests { + use crate::{ + codec::wire::{decode, encode, TransportMessageV0}, + codec::CodecError, + }; + use re_chunk::{Chunk, RowId}; + use re_log_types::{example_components::MyPoint, Timeline}; + use re_protos::common::v0::EncoderVersion; + + fn get_test_chunk() -> Chunk { + let row_id1 = RowId::new(); + let row_id2 = RowId::new(); + + let timepoint1 = [ + (Timeline::log_time(), 100), + (Timeline::new_sequence("frame"), 1), + ]; + let timepoint2 = [ + (Timeline::log_time(), 104), + (Timeline::new_sequence("frame"), 1), + ]; + + let points1 = &[MyPoint::new(1.0, 1.0)]; + let points2 = &[MyPoint::new(2.0, 2.0)]; + + Chunk::builder("mypoints".into()) + .with_component_batches(row_id1, timepoint1, [points1 as _]) + .with_component_batches(row_id2, timepoint2, [points2 as _]) + .build() + .unwrap() + } + + #[test] + fn test_message_v0_no_data() { + let msg = TransportMessageV0::NoData; + let data = msg.to_bytes().unwrap(); + let decoded = TransportMessageV0::from_bytes(&data).unwrap(); + assert!(matches!(decoded, TransportMessageV0::NoData)); + } + + #[test] + fn test_message_v0_record_batch() { + let expected_chunk = get_test_chunk(); + + let msg = TransportMessageV0::RecordBatch(expected_chunk.clone().to_transport().unwrap()); + let data = msg.to_bytes().unwrap(); + let decoded = TransportMessageV0::from_bytes(&data).unwrap(); + + #[allow(clippy::match_wildcard_for_single_variants)] + match decoded { + TransportMessageV0::RecordBatch(transport) => { + let decoded_chunk = Chunk::from_transport(&transport).unwrap(); + assert_eq!(expected_chunk, decoded_chunk); + } + _ => panic!("unexpected message type"), + } + } + + #[test] + fn test_invalid_batch_data() { + let data = vec![2, 3, 4]; // '1' is NO_DATA message header + let decoded = TransportMessageV0::from_bytes(&data); + + assert!(matches!( + decoded.err().unwrap(), + CodecError::ArrowSerialization(_) + )); + } + + #[test] + fn test_unknown_header() { + let data = vec![3]; + let decoded = TransportMessageV0::from_bytes(&data); + assert!(decoded.is_err()); + + assert!(matches!( + decoded.err().unwrap(), + CodecError::UnknownMessageHeader + )); + } + + #[test] + fn test_v0_codec() { + let expected_chunk = get_test_chunk(); + + let encoded = encode( + EncoderVersion::V0, + expected_chunk.clone().to_transport().unwrap(), + ) + .unwrap(); + let decoded = decode(EncoderVersion::V0, &encoded).unwrap().unwrap(); + let decoded_chunk = Chunk::from_transport(&decoded).unwrap(); + + assert_eq!(expected_chunk, decoded_chunk); + } +} diff --git a/crates/store/re_log_encoding/src/decoder/mod.rs b/crates/store/re_log_encoding/src/decoder/mod.rs index 3483bd4b39fb..224bc03ceef2 100644 --- a/crates/store/re_log_encoding/src/decoder/mod.rs +++ b/crates/store/re_log_encoding/src/decoder/mod.rs @@ -8,27 +8,16 @@ use std::io::Read; use re_build_info::CrateVersion; use re_log_types::LogMsg; +use crate::codec; +use crate::codec::file::decoder; use crate::FileHeader; use crate::MessageHeader; +use crate::VersionPolicy; use crate::OLD_RRD_HEADERS; use crate::{Compression, EncodingOptions, Serializer}; // ---------------------------------------------------------------------------- -/// How to handle version mismatches during decoding. -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub enum VersionPolicy { - /// Warn if the versions don't match, but continue loading. - /// - /// We usually use this for loading `.rrd` recordings. - Warn, - - /// Return [`DecodeError::IncompatibleRerunVersion`] if the versions aren't compatible. - /// - /// We usually use this for tests, and for loading `.rbl` blueprint files. - Error, -} - fn warn_on_version_mismatch( version_policy: VersionPolicy, encoded_version: [u8; 4], @@ -82,13 +71,28 @@ pub enum DecodeError { Options(#[from] crate::OptionsError), #[error("Failed to read: {0}")] - Read(std::io::Error), + Read(#[from] std::io::Error), #[error("lz4 error: {0}")] - Lz4(lz4_flex::block::DecompressError), + Lz4(#[from] lz4_flex::block::DecompressError), + + #[error("Protobuf error: {0}")] + Protobuf(#[from] re_protos::external::prost::DecodeError), + + #[error("Could not convert type from protobuf: {0}")] + TypeConversion(#[from] re_protos::TypeConversionError), + + #[error("Failed to read chunk: {0}")] + Chunk(#[from] re_chunk::ChunkError), + + #[error("Arrow error: {0}")] + Arrow(#[from] arrow2::error::Error), #[error("MsgPack error: {0}")] MsgPack(#[from] rmp_serde::decode::Error), + + #[error("Codec error: {0}")] + Codec(#[from] codec::CodecError), } // ---------------------------------------------------------------------------- @@ -129,7 +133,7 @@ pub fn read_options( warn_on_version_mismatch(version_policy, version)?; match options.serializer { - Serializer::MsgPack => {} + Serializer::MsgPack | Serializer::Protobuf => {} } Ok((CrateVersion::from_bytes(version), options)) @@ -152,7 +156,7 @@ impl std::io::Read for Reader { pub struct Decoder { version: CrateVersion, - compression: Compression, + options: EncodingOptions, read: Reader, uncompressed: Vec, // scratch space compressed: Vec, // scratch space @@ -179,11 +183,10 @@ impl Decoder { read.read_exact(&mut data).map_err(DecodeError::Read)?; let (version, options) = read_options(version_policy, &data)?; - let compression = options.compression; Ok(Self { version, - compression, + options, read: Reader::Raw(read), uncompressed: vec![], compressed: vec![], @@ -217,11 +220,10 @@ impl Decoder { read.read_exact(&mut data).map_err(DecodeError::Read)?; let (version, options) = read_options(version_policy, &data)?; - let compression = options.compression; Ok(Self { version, - compression, + options, read: Reader::Buffered(read), uncompressed: vec![], compressed: vec![], @@ -235,6 +237,7 @@ impl Decoder { self.version } + // TODO(jan): stop returning number of read bytes, use cursors wrapping readers instead. /// Returns the size in bytes of the data that has been decoded up to now. #[inline] pub fn size_bytes(&self) -> u64 { @@ -284,90 +287,114 @@ impl Iterator for Decoder { Ok(opts) => opts, Err(err) => return Some(Err(err)), }; - let compression = options.compression; self.version = CrateVersion::max(self.version, version); - self.compression = compression; + self.options = options; self.size_bytes += FileHeader::SIZE as u64; } - let header = match MessageHeader::decode(&mut self.read) { - Ok(header) => header, - Err(err) => match err { - DecodeError::Read(e) if e.kind() == std::io::ErrorKind::UnexpectedEof => { - return None; + let msg = match self.options.serializer { + Serializer::Protobuf => match decoder::decode(&mut self.read) { + Ok((read_bytes, msg)) => { + self.size_bytes += read_bytes; + msg } - other => return Some(Err(other)), + Err(err) => return Some(Err(err)), }, - }; - self.size_bytes += MessageHeader::SIZE as u64; - - let (uncompressed_len, compressed_len) = match header { - MessageHeader::Data { - compressed_len, - uncompressed_len, - } => (uncompressed_len as usize, compressed_len as usize), - MessageHeader::EndOfStream => { - // we might have a concatenated stream, so we peek beyond end of file marker to see - if self.peek_file_header() { - re_log::debug!("Reached end of stream, but it seems we have a concatenated file, continuing"); - return self.next(); + Serializer::MsgPack => { + let header = match MessageHeader::decode(&mut self.read) { + Ok(header) => header, + Err(err) => match err { + DecodeError::Read(e) if e.kind() == std::io::ErrorKind::UnexpectedEof => { + return None; + } + other => return Some(Err(other)), + }, + }; + self.size_bytes += MessageHeader::SIZE as u64; + + match header { + MessageHeader::Data { + compressed_len, + uncompressed_len, + } => { + let uncompressed_len = uncompressed_len as usize; + let compressed_len = compressed_len as usize; + + self.uncompressed + .resize(self.uncompressed.len().max(uncompressed_len), 0); + + match self.options.compression { + Compression::Off => { + re_tracing::profile_scope!("read uncompressed"); + if let Err(err) = self + .read + .read_exact(&mut self.uncompressed[..uncompressed_len]) + { + return Some(Err(DecodeError::Read(err))); + } + self.size_bytes += uncompressed_len as u64; + } + + Compression::LZ4 => { + self.compressed + .resize(self.compressed.len().max(compressed_len), 0); + + { + re_tracing::profile_scope!("read compressed"); + if let Err(err) = + self.read.read_exact(&mut self.compressed[..compressed_len]) + { + return Some(Err(DecodeError::Read(err))); + } + } + + re_tracing::profile_scope!("lz4"); + if let Err(err) = lz4_flex::block::decompress_into( + &self.compressed[..compressed_len], + &mut self.uncompressed[..uncompressed_len], + ) { + return Some(Err(DecodeError::Lz4(err))); + } + + self.size_bytes += compressed_len as u64; + } + } + + let data = &self.uncompressed[..uncompressed_len]; + { + re_tracing::profile_scope!("MsgPack deser"); + match rmp_serde::from_slice::(data) { + Ok(msg) => Some(msg), + Err(err) => return Some(Err(err.into())), + } + } + } + MessageHeader::EndOfStream => None, } - - re_log::debug!("Reached end of stream, iterator complete"); - return None; } }; - self.uncompressed - .resize(self.uncompressed.len().max(uncompressed_len), 0); - - match self.compression { - Compression::Off => { - re_tracing::profile_scope!("read uncompressed"); - if let Err(err) = self - .read - .read_exact(&mut self.uncompressed[..uncompressed_len]) - { - return Some(Err(DecodeError::Read(err))); - } - self.size_bytes += uncompressed_len as u64; + let Some(mut msg) = msg else { + // we might have a concatenated stream, so we peek beyond end of file marker to see + if self.peek_file_header() { + re_log::debug!( + "Reached end of stream, but it seems we have a concatenated file, continuing" + ); + return self.next(); } - Compression::LZ4 => { - self.compressed - .resize(self.compressed.len().max(compressed_len), 0); - - { - re_tracing::profile_scope!("read compressed"); - if let Err(err) = self.read.read_exact(&mut self.compressed[..compressed_len]) { - return Some(Err(DecodeError::Read(err))); - } - } - - re_tracing::profile_scope!("lz4"); - if let Err(err) = lz4_flex::block::decompress_into( - &self.compressed[..compressed_len], - &mut self.uncompressed[..uncompressed_len], - ) { - return Some(Err(DecodeError::Lz4(err))); - } + re_log::debug!("Reached end of stream, iterator complete"); + return None; + }; - self.size_bytes += compressed_len as u64; - } + if let LogMsg::SetStoreInfo(msg) = &mut msg { + // Propagate the protocol version from the header into the `StoreInfo` so that all + // parts of the app can easily access it. + msg.info.store_version = Some(self.version()); } - re_tracing::profile_scope!("MsgPack deser"); - match rmp_serde::from_slice(&self.uncompressed[..uncompressed_len]) { - Ok(re_log_types::LogMsg::SetStoreInfo(mut msg)) => { - // Propagate the protocol version from the header into the `StoreInfo` so that all - // parts of the app can easily access it. - msg.info.store_version = Some(self.version()); - Some(Ok(re_log_types::LogMsg::SetStoreInfo(msg))) - } - Ok(msg) => Some(Ok(msg)), - Err(err) => Some(Err(err.into())), - } + Some(Ok(msg)) } } @@ -375,6 +402,8 @@ impl Iterator for Decoder { #[cfg(all(test, feature = "decoder", feature = "encoder"))] mod tests { + #![allow(clippy::unwrap_used)] // acceptable for tests + use super::*; use re_build_info::CrateVersion; use re_chunk::RowId; @@ -382,29 +411,68 @@ mod tests { ApplicationId, SetStoreInfo, StoreId, StoreInfo, StoreKind, StoreSource, Time, }; - fn fake_log_message() -> LogMsg { - LogMsg::SetStoreInfo(SetStoreInfo { - row_id: *RowId::new(), - info: StoreInfo { - application_id: ApplicationId("test".to_owned()), - store_id: StoreId::random(StoreKind::Recording), - cloned_from: None, - is_official_example: true, - started: Time::now(), - store_source: StoreSource::RustSdk { - rustc_version: String::new(), - llvm_version: String::new(), + fn fake_log_messages() -> Vec { + let store_id = StoreId::random(StoreKind::Blueprint); + vec![ + LogMsg::SetStoreInfo(SetStoreInfo { + row_id: *RowId::new(), + info: StoreInfo { + application_id: ApplicationId("test".to_owned()), + store_id: store_id.clone(), + cloned_from: None, + is_official_example: true, + started: Time::now(), + store_source: StoreSource::RustSdk { + rustc_version: String::new(), + llvm_version: String::new(), + }, + store_version: Some(CrateVersion::LOCAL), }, - store_version: Some(CrateVersion::LOCAL), - }, - }) + }), + LogMsg::ArrowMsg( + store_id.clone(), + re_chunk::Chunk::builder("test_entity".into()) + .with_archetype( + re_chunk::RowId::new(), + re_log_types::TimePoint::default().with( + re_log_types::Timeline::new_sequence("blueprint"), + re_log_types::TimeInt::from_milliseconds(re_log_types::NonMinI64::MIN), + ), + &re_types::blueprint::archetypes::Background::new( + re_types::blueprint::components::BackgroundKind::SolidColor, + ) + .with_color([255, 0, 0]), + ) + .build() + .unwrap() + .to_arrow_msg() + .unwrap(), + ), + LogMsg::BlueprintActivationCommand(re_log_types::BlueprintActivationCommand { + blueprint_id: store_id, + make_active: true, + make_default: true, + }), + ] + } + + fn clear_arrow_extension_metadata(messages: &mut Vec) { + for msg in messages { + if let LogMsg::ArrowMsg(_, arrow_msg) = msg { + for field in &mut arrow_msg.schema.fields { + field + .metadata + .retain(|k, _| !k.starts_with("ARROW:extension")); + } + } + } } #[test] fn test_encode_decode() { let rrd_version = CrateVersion::LOCAL; - let messages = vec![fake_log_message()]; + let messages = fake_log_messages(); let options = [ EncodingOptions { @@ -415,6 +483,14 @@ mod tests { compression: Compression::LZ4, serializer: Serializer::MsgPack, }, + EncodingOptions { + compression: Compression::Off, + serializer: Serializer::Protobuf, + }, + EncodingOptions { + compression: Compression::LZ4, + serializer: Serializer::Protobuf, + }, ]; for options in options { @@ -422,11 +498,13 @@ mod tests { crate::encoder::encode_ref(rrd_version, options, messages.iter().map(Ok), &mut file) .unwrap(); - let decoded_messages = Decoder::new(VersionPolicy::Error, &mut file.as_slice()) + let mut decoded_messages = Decoder::new(VersionPolicy::Error, &mut file.as_slice()) .unwrap() .collect::, DecodeError>>() .unwrap(); + clear_arrow_extension_metadata(&mut decoded_messages); + assert_eq!(messages, decoded_messages); } } @@ -442,25 +520,31 @@ mod tests { compression: Compression::LZ4, serializer: Serializer::MsgPack, }, + EncodingOptions { + compression: Compression::Off, + serializer: Serializer::Protobuf, + }, + EncodingOptions { + compression: Compression::LZ4, + serializer: Serializer::Protobuf, + }, ]; for options in options { + println!("{options:?}"); + let mut data = vec![]; // write "2 files" i.e. 2 streams that end with end-of-stream marker - let messages = vec![ - fake_log_message(), - fake_log_message(), - fake_log_message(), - fake_log_message(), - ]; + let messages = fake_log_messages(); // (2 encoders as each encoder writes a file header) let writer = std::io::Cursor::new(&mut data); let mut encoder1 = crate::encoder::Encoder::new(CrateVersion::LOCAL, options, writer).unwrap(); - encoder1.append(&messages[0]).unwrap(); - encoder1.append(&messages[1]).unwrap(); + for message in &messages { + encoder1.append(message).unwrap(); + } encoder1.finish().unwrap(); let written = data.len() as u64; @@ -468,9 +552,9 @@ mod tests { writer.set_position(written); let mut encoder2 = crate::encoder::Encoder::new(CrateVersion::LOCAL, options, writer).unwrap(); - - encoder2.append(&messages[2]).unwrap(); - encoder2.append(&messages[3]).unwrap(); + for message in &messages { + encoder2.append(message).unwrap(); + } encoder2.finish().unwrap(); let decoder = Decoder::new_concatenated( @@ -479,12 +563,11 @@ mod tests { ) .unwrap(); - let mut decoded_messages = vec![]; - for msg in decoder { - decoded_messages.push(msg.unwrap()); - } + let mut decoded_messages = decoder.into_iter().collect::, _>>().unwrap(); - assert_eq!(messages, decoded_messages); + clear_arrow_extension_metadata(&mut decoded_messages); + + assert_eq!([messages.clone(), messages].concat(), decoded_messages); } } } diff --git a/crates/store/re_log_encoding/src/decoder/stream.rs b/crates/store/re_log_encoding/src/decoder/stream.rs index ff85e734581b..0682c57a0609 100644 --- a/crates/store/re_log_encoding/src/decoder/stream.rs +++ b/crates/store/re_log_encoding/src/decoder/stream.rs @@ -317,7 +317,7 @@ mod tests { #[test] fn stream_whole_chunks_uncompressed() { - let (input, data) = test_data(EncodingOptions::UNCOMPRESSED, 16); + let (input, data) = test_data(EncodingOptions::MSGPACK_UNCOMPRESSED, 16); let mut decoder = StreamDecoder::new(VersionPolicy::Error); @@ -334,7 +334,7 @@ mod tests { #[test] fn stream_byte_chunks_uncompressed() { - let (input, data) = test_data(EncodingOptions::UNCOMPRESSED, 16); + let (input, data) = test_data(EncodingOptions::MSGPACK_UNCOMPRESSED, 16); let mut decoder = StreamDecoder::new(VersionPolicy::Error); @@ -353,8 +353,8 @@ mod tests { #[test] fn two_concatenated_streams() { - let (input1, data1) = test_data(EncodingOptions::UNCOMPRESSED, 16); - let (input2, data2) = test_data(EncodingOptions::UNCOMPRESSED, 16); + let (input1, data1) = test_data(EncodingOptions::MSGPACK_UNCOMPRESSED, 16); + let (input2, data2) = test_data(EncodingOptions::MSGPACK_UNCOMPRESSED, 16); let input = input1.into_iter().chain(input2).collect::>(); let mut decoder = StreamDecoder::new(VersionPolicy::Error); @@ -373,7 +373,7 @@ mod tests { #[test] fn stream_whole_chunks_compressed() { - let (input, data) = test_data(EncodingOptions::COMPRESSED, 16); + let (input, data) = test_data(EncodingOptions::MSGPACK_COMPRESSED, 16); let mut decoder = StreamDecoder::new(VersionPolicy::Error); @@ -390,7 +390,7 @@ mod tests { #[test] fn stream_byte_chunks_compressed() { - let (input, data) = test_data(EncodingOptions::COMPRESSED, 16); + let (input, data) = test_data(EncodingOptions::MSGPACK_COMPRESSED, 16); let mut decoder = StreamDecoder::new(VersionPolicy::Error); @@ -409,7 +409,7 @@ mod tests { #[test] fn stream_3x16_chunks() { - let (input, data) = test_data(EncodingOptions::COMPRESSED, 16); + let (input, data) = test_data(EncodingOptions::MSGPACK_COMPRESSED, 16); let mut decoder = StreamDecoder::new(VersionPolicy::Error); let mut decoded_messages = vec![]; @@ -438,7 +438,7 @@ mod tests { fn stream_irregular_chunks() { // this attempts to stress-test `try_read` with chunks of various sizes - let (input, data) = test_data(EncodingOptions::COMPRESSED, 16); + let (input, data) = test_data(EncodingOptions::MSGPACK_COMPRESSED, 16); let mut data = Cursor::new(data); let mut decoder = StreamDecoder::new(VersionPolicy::Error); diff --git a/crates/store/re_log_encoding/src/encoder.rs b/crates/store/re_log_encoding/src/encoder.rs index edc966ce0d19..47fd4bdffa2e 100644 --- a/crates/store/re_log_encoding/src/encoder.rs +++ b/crates/store/re_log_encoding/src/encoder.rs @@ -1,12 +1,14 @@ //! Encoding of [`LogMsg`]es as a binary stream, e.g. to store in an `.rrd` file, or send over network. -use re_build_info::CrateVersion; -use re_chunk::{ChunkError, ChunkResult}; -use re_log_types::LogMsg; - +use crate::codec; +use crate::codec::file::{self, encoder}; use crate::FileHeader; use crate::MessageHeader; +use crate::Serializer; use crate::{Compression, EncodingOptions}; +use re_build_info::CrateVersion; +use re_chunk::{ChunkError, ChunkResult}; +use re_log_types::LogMsg; // ---------------------------------------------------------------------------- @@ -14,14 +16,23 @@ use crate::{Compression, EncodingOptions}; #[derive(thiserror::Error, Debug)] pub enum EncodeError { #[error("Failed to write: {0}")] - Write(std::io::Error), + Write(#[from] std::io::Error), #[error("lz4 error: {0}")] - Lz4(lz4_flex::block::CompressError), + Lz4(#[from] lz4_flex::block::CompressError), #[error("MsgPack error: {0}")] MsgPack(#[from] rmp_serde::encode::Error), + #[error("Protobuf error: {0}")] + Protobuf(#[from] re_protos::external::prost::EncodeError), + + #[error("Arrow error: {0}")] + Arrow(#[from] arrow2::error::Error), + + #[error("{0}")] + Codec(#[from] codec::CodecError), + #[error("Chunk error: {0}")] Chunk(#[from] ChunkError), @@ -109,6 +120,7 @@ impl std::ops::Drop for DroppableEncoder { /// Prefer [`DroppableEncoder`] if possible, make sure to call [`Encoder::finish`] when appropriate /// otherwise. pub struct Encoder { + serializer: Serializer, compression: Compression, write: W, uncompressed: Vec, @@ -128,15 +140,12 @@ impl Encoder { } .encode(&mut write)?; - match options.serializer { - crate::Serializer::MsgPack => {} - } - Ok(Self { + serializer: options.serializer, compression: options.compression, write, - uncompressed: vec![], - compressed: vec![], + uncompressed: Vec::new(), + compressed: Vec::new(), }) } @@ -145,36 +154,51 @@ impl Encoder { re_tracing::profile_function!(); self.uncompressed.clear(); - rmp_serde::encode::write_named(&mut self.uncompressed, message)?; + match self.serializer { + Serializer::Protobuf => { + encoder::encode(&mut self.uncompressed, message, self.compression)?; - match self.compression { - Compression::Off => { - MessageHeader::Data { - uncompressed_len: self.uncompressed.len() as u32, - compressed_len: self.uncompressed.len() as u32, - } - .encode(&mut self.write)?; self.write .write_all(&self.uncompressed) .map(|_| self.uncompressed.len() as _) .map_err(EncodeError::Write) } - - Compression::LZ4 => { - let max_len = lz4_flex::block::get_maximum_output_size(self.uncompressed.len()); - self.compressed.resize(max_len, 0); - let compressed_len = - lz4_flex::block::compress_into(&self.uncompressed, &mut self.compressed) + Serializer::MsgPack => { + rmp_serde::encode::write_named(&mut self.uncompressed, message)?; + + match self.compression { + Compression::Off => { + MessageHeader::Data { + uncompressed_len: self.uncompressed.len() as u32, + compressed_len: self.uncompressed.len() as u32, + } + .encode(&mut self.write)?; + self.write + .write_all(&self.uncompressed) + .map(|_| self.uncompressed.len() as _) + .map_err(EncodeError::Write) + } + + Compression::LZ4 => { + let max_len = + lz4_flex::block::get_maximum_output_size(self.uncompressed.len()); + self.compressed.resize(max_len, 0); + let compressed_len = lz4_flex::block::compress_into( + &self.uncompressed, + &mut self.compressed, + ) .map_err(EncodeError::Lz4)?; - MessageHeader::Data { - uncompressed_len: self.uncompressed.len() as u32, - compressed_len: compressed_len as u32, + MessageHeader::Data { + uncompressed_len: self.uncompressed.len() as u32, + compressed_len: compressed_len as u32, + } + .encode(&mut self.write)?; + self.write + .write_all(&self.compressed[..compressed_len]) + .map(|_| compressed_len as _) + .map_err(EncodeError::Write) + } } - .encode(&mut self.write)?; - self.write - .write_all(&self.compressed[..compressed_len]) - .map(|_| compressed_len as _) - .map_err(EncodeError::Write) } } } @@ -183,7 +207,18 @@ impl Encoder { // does a partial move. #[inline] pub fn finish(&mut self) -> Result<(), EncodeError> { - MessageHeader::EndOfStream.encode(&mut self.write)?; + match self.serializer { + Serializer::MsgPack => { + MessageHeader::EndOfStream.encode(&mut self.write)?; + } + Serializer::Protobuf => { + file::MessageHeader { + kind: file::MessageKind::End, + len: 0, + } + .encode(&mut self.write)?; + } + } Ok(()) } @@ -247,12 +282,20 @@ pub fn encode_as_bytes( #[inline] pub fn local_encoder() -> Result>, EncodeError> { - DroppableEncoder::new(CrateVersion::LOCAL, EncodingOptions::COMPRESSED, Vec::new()) + DroppableEncoder::new( + CrateVersion::LOCAL, + EncodingOptions::MSGPACK_COMPRESSED, + Vec::new(), + ) } #[inline] pub fn local_raw_encoder() -> Result>, EncodeError> { - Encoder::new(CrateVersion::LOCAL, EncodingOptions::COMPRESSED, Vec::new()) + Encoder::new( + CrateVersion::LOCAL, + EncodingOptions::MSGPACK_COMPRESSED, + Vec::new(), + ) } #[inline] diff --git a/crates/store/re_log_encoding/src/file_sink.rs b/crates/store/re_log_encoding/src/file_sink.rs index cd5e7d2d953f..1a80625987f3 100644 --- a/crates/store/re_log_encoding/src/file_sink.rs +++ b/crates/store/re_log_encoding/src/file_sink.rs @@ -61,7 +61,7 @@ impl FileSink { /// Start writing log messages to a file at the given path. pub fn new(path: impl Into) -> Result { // We always compress on disk - let encoding_options = crate::EncodingOptions::COMPRESSED; + let encoding_options = crate::EncodingOptions::MSGPACK_COMPRESSED; let (tx, rx) = std::sync::mpsc::channel(); @@ -91,7 +91,7 @@ impl FileSink { /// Start writing log messages to standard output. pub fn stdout() -> Result { - let encoding_options = crate::EncodingOptions::COMPRESSED; + let encoding_options = crate::EncodingOptions::MSGPACK_COMPRESSED; let (tx, rx) = std::sync::mpsc::channel(); diff --git a/crates/store/re_log_encoding/src/lib.rs b/crates/store/re_log_encoding/src/lib.rs index fb0cbbbfe5b7..d35b8e331342 100644 --- a/crates/store/re_log_encoding/src/lib.rs +++ b/crates/store/re_log_encoding/src/lib.rs @@ -2,11 +2,14 @@ #[cfg(feature = "decoder")] pub mod decoder; + #[cfg(feature = "encoder")] pub mod encoder; pub mod codec; +mod protobuf_conversions; + #[cfg(feature = "encoder")] #[cfg(not(target_arch = "wasm32"))] mod file_sink; @@ -14,6 +17,20 @@ mod file_sink; #[cfg(feature = "stream_from_http")] pub mod stream_rrd_from_http; +/// How to handle version mismatches during decoding. +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub enum VersionPolicy { + /// Warn if the versions don't match, but continue loading. + /// + /// We usually use this for loading `.rrd` recordings. + Warn, + + /// Return an error if the versions aren't compatible. + /// + /// We usually use this for tests, and for loading `.rbl` blueprint files. + Error, +} + // --------------------------------------------------------------------- #[cfg(feature = "encoder")] @@ -45,6 +62,7 @@ pub enum Compression { #[repr(u8)] pub enum Serializer { MsgPack = 1, + Protobuf = 2, } #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -54,14 +72,18 @@ pub struct EncodingOptions { } impl EncodingOptions { - pub const UNCOMPRESSED: Self = Self { + pub const MSGPACK_UNCOMPRESSED: Self = Self { compression: Compression::Off, serializer: Serializer::MsgPack, }; - pub const COMPRESSED: Self = Self { + pub const MSGPACK_COMPRESSED: Self = Self { compression: Compression::LZ4, serializer: Serializer::MsgPack, }; + pub const PROTOBUF_COMPRESSED: Self = Self { + compression: Compression::LZ4, + serializer: Serializer::Protobuf, + }; pub fn from_bytes(bytes: [u8; 4]) -> Result { match bytes { @@ -73,6 +95,7 @@ impl EncodingOptions { }; let serializer = match serializer { 1 => Serializer::MsgPack, + 2 => Serializer::Protobuf, _ => return Err(OptionsError::UnknownSerializer(serializer)), }; Ok(Self { diff --git a/crates/store/re_log_encoding/src/protobuf_conversions.rs b/crates/store/re_log_encoding/src/protobuf_conversions.rs new file mode 100644 index 000000000000..9b613a1e3937 --- /dev/null +++ b/crates/store/re_log_encoding/src/protobuf_conversions.rs @@ -0,0 +1,17 @@ +impl From for crate::Compression { + fn from(value: re_protos::log_msg::v0::Compression) -> Self { + match value { + re_protos::log_msg::v0::Compression::None => Self::Off, + re_protos::log_msg::v0::Compression::Lz4 => Self::LZ4, + } + } +} + +impl From for re_protos::log_msg::v0::Compression { + fn from(value: crate::Compression) -> Self { + match value { + crate::Compression::Off => Self::None, + crate::Compression::LZ4 => Self::Lz4, + } + } +} diff --git a/crates/store/re_log_encoding/src/stream_rrd_from_http.rs b/crates/store/re_log_encoding/src/stream_rrd_from_http.rs index 718a8f8bb479..a52283c4fb05 100644 --- a/crates/store/re_log_encoding/src/stream_rrd_from_http.rs +++ b/crates/store/re_log_encoding/src/stream_rrd_from_http.rs @@ -71,7 +71,7 @@ pub fn stream_rrd_from_http(url: String, on_msg: Arc) { re_log::debug!("Downloading .rrd file from {url:?}…"); ehttp::streaming::fetch(ehttp::Request::get(&url), { - let version_policy = crate::decoder::VersionPolicy::Warn; + let version_policy = crate::VersionPolicy::Warn; let decoder = RefCell::new(StreamDecoder::new(version_policy)); move |part| match part { Ok(part) => match part { @@ -184,7 +184,7 @@ pub mod web_decode { async fn decode_rrd_async(rrd_bytes: Vec, on_msg: Arc) { let mut last_yield = web_time::Instant::now(); - let version_policy = crate::decoder::VersionPolicy::Warn; + let version_policy = crate::VersionPolicy::Warn; match crate::decoder::Decoder::new(version_policy, rrd_bytes.as_slice()) { Ok(decoder) => { for msg in decoder { diff --git a/crates/store/re_log_types/src/lib.rs b/crates/store/re_log_types/src/lib.rs index 3b708c10a2f1..3174228b7750 100644 --- a/crates/store/re_log_types/src/lib.rs +++ b/crates/store/re_log_types/src/lib.rs @@ -407,6 +407,67 @@ impl std::fmt::Display for PythonVersion { } } +impl std::str::FromStr for PythonVersion { + type Err = PythonVersionParseError; + + fn from_str(s: &str) -> Result { + if s.is_empty() { + return Err(PythonVersionParseError::MissingMajor); + } + let (major, rest) = s + .split_once('.') + .ok_or(PythonVersionParseError::MissingMinor)?; + if rest.is_empty() { + return Err(PythonVersionParseError::MissingMinor); + } + let (minor, rest) = rest + .split_once('.') + .ok_or(PythonVersionParseError::MissingPatch)?; + if rest.is_empty() { + return Err(PythonVersionParseError::MissingPatch); + } + let pos = rest.bytes().position(|v| !v.is_ascii_digit()); + let (patch, suffix) = match pos { + Some(pos) => rest.split_at(pos), + None => (rest, ""), + }; + + Ok(Self { + major: major + .parse() + .map_err(PythonVersionParseError::InvalidMajor)?, + minor: minor + .parse() + .map_err(PythonVersionParseError::InvalidMinor)?, + patch: patch + .parse() + .map_err(PythonVersionParseError::InvalidPatch)?, + suffix: suffix.into(), + }) + } +} + +#[derive(Debug, thiserror::Error)] +pub enum PythonVersionParseError { + #[error("missing major version")] + MissingMajor, + + #[error("missing minor version")] + MissingMinor, + + #[error("missing patch version")] + MissingPatch, + + #[error("invalid major version: {0}")] + InvalidMajor(std::num::ParseIntError), + + #[error("invalid minor version: {0}")] + InvalidMinor(std::num::ParseIntError), + + #[error("invalid patch version: {0}")] + InvalidPatch(std::num::ParseIntError), +} + #[derive(Clone, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub enum FileSource { @@ -573,3 +634,57 @@ pub fn build_frame_nr(frame_nr: impl TryInto) -> (Timeline, TimeInt) { frame_nr.try_into().unwrap_or(TimeInt::MIN), ) } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn parse_python_version() { + macro_rules! assert_parse_err { + ($input:literal, $expected:pat) => { + let actual = $input.parse::(); + + assert!( + matches!(actual, Err($expected)), + "actual: {actual:?}, expected: {}", + stringify!($expected) + ); + }; + } + + macro_rules! assert_parse_ok { + ($input:literal, $expected:expr) => { + let actual = $input.parse::().expect("failed to parse"); + assert_eq!(actual, $expected); + }; + } + + assert_parse_err!("", PythonVersionParseError::MissingMajor); + assert_parse_err!("3", PythonVersionParseError::MissingMinor); + assert_parse_err!("3.", PythonVersionParseError::MissingMinor); + assert_parse_err!("3.11", PythonVersionParseError::MissingPatch); + assert_parse_err!("3.11.", PythonVersionParseError::MissingPatch); + assert_parse_err!("a.11.0", PythonVersionParseError::InvalidMajor(_)); + assert_parse_err!("3.b.0", PythonVersionParseError::InvalidMinor(_)); + assert_parse_err!("3.11.c", PythonVersionParseError::InvalidPatch(_)); + assert_parse_ok!( + "3.11.0", + PythonVersion { + major: 3, + minor: 11, + patch: 0, + suffix: String::new(), + } + ); + assert_parse_ok!( + "3.11.0a1", + PythonVersion { + major: 3, + minor: 11, + patch: 0, + suffix: "a1".to_owned(), + } + ); + } +} diff --git a/crates/store/re_log_types/src/protobuf_conversions.rs b/crates/store/re_log_types/src/protobuf_conversions.rs index 80993323e529..aab629292512 100644 --- a/crates/store/re_log_types/src/protobuf_conversions.rs +++ b/crates/store/re_log_types/src/protobuf_conversions.rs @@ -1,6 +1,6 @@ -use std::sync::Arc; - use re_protos::TypeConversionError; +use re_protos::{invalid_field, missing_field}; +use std::sync::Arc; impl From for re_protos::common::v0::EntityPath { fn from(value: crate::EntityPath) -> Self { @@ -14,11 +14,8 @@ impl TryFrom for crate::EntityPath { type Error = TypeConversionError; fn try_from(value: re_protos::common::v0::EntityPath) -> Result { - Self::parse_strict(&value.path).map_err(|err| TypeConversionError::InvalidField { - type_name: "rerun.common.v0.EntityPath", - field_name: "path", - reason: err.to_string(), - }) + Self::parse_strict(&value.path) + .map_err(|err| invalid_field!(re_protos::common::v0::EntityPath, "path", err)) } } @@ -82,35 +79,47 @@ impl TryFrom for crate::ResolvedTimeRange { fn try_from(value: re_protos::common::v0::IndexRange) -> Result { value .time_range - .ok_or(TypeConversionError::missing_field( - "rerun.common.v0.IndexRange", - "time_range", + .ok_or(missing_field!( + re_protos::common::v0::IndexRange, + "time_range" )) .map(|time_range| Self::new(time_range.start, time_range.end)) } } +impl From for crate::Timeline { + fn from(value: re_protos::common::v0::Timeline) -> Self { + // TODO(cmc): QueryExpression::filtered_index gotta be a selector + #[allow(clippy::match_same_arms)] + match value.name.as_str() { + "log_time" => Self::new_temporal(value.name), + "log_tick" => Self::new_sequence(value.name), + "frame" => Self::new_sequence(value.name), + "frame_nr" => Self::new_sequence(value.name), + _ => Self::new_temporal(value.name), + } + } +} + +impl From for re_protos::common::v0::Timeline { + fn from(value: crate::Timeline) -> Self { + Self { + name: value.name().to_string(), + } + } +} + impl TryFrom for crate::Timeline { type Error = TypeConversionError; fn try_from(value: re_protos::common::v0::IndexColumnSelector) -> Result { - let timeline_name = value + let timeline = value .timeline - .ok_or(TypeConversionError::missing_field( - "rerun.common.v0.IndexColumnSelector", - "timeline", + .ok_or(missing_field!( + re_protos::common::v0::IndexColumnSelector, + "timeline" ))? - .name; - - // TODO(cmc): QueryExpression::filtered_index gotta be a selector - #[allow(clippy::match_same_arms)] - let timeline = match timeline_name.as_str() { - "log_time" => Self::new_temporal(timeline_name), - "log_tick" => Self::new_sequence(timeline_name), - "frame" => Self::new_sequence(timeline_name), - "frame_nr" => Self::new_sequence(timeline_name), - _ => Self::new_temporal(timeline_name), - }; + .into(); Ok(timeline) } @@ -154,7 +163,7 @@ impl From for crate::StoreId { #[inline] fn from(value: re_protos::common::v0::StoreId) -> Self { Self { - kind: crate::StoreKind::Recording, + kind: value.kind().into(), id: Arc::new(value.id), } } @@ -189,3 +198,501 @@ impl From for re_protos::common::v0::RecordingId { } } } + +impl From for re_protos::log_msg::v0::StoreSource { + #[inline] + fn from(value: crate::StoreSource) -> Self { + use re_protos::external::prost::Message as _; + + let (kind, payload) = match value { + crate::StoreSource::Unknown => ( + re_protos::log_msg::v0::StoreSourceKind::UnknownKind as i32, + Vec::new(), + ), + crate::StoreSource::CSdk => ( + re_protos::log_msg::v0::StoreSourceKind::CSdk as i32, + Vec::new(), + ), + crate::StoreSource::PythonSdk(python_version) => ( + re_protos::log_msg::v0::StoreSourceKind::PythonSdk as i32, + re_protos::log_msg::v0::PythonVersion::from(python_version).encode_to_vec(), + ), + crate::StoreSource::RustSdk { + rustc_version, + llvm_version, + } => ( + re_protos::log_msg::v0::StoreSourceKind::RustSdk as i32, + re_protos::log_msg::v0::CrateInfo { + rustc_version, + llvm_version, + } + .encode_to_vec(), + ), + crate::StoreSource::File { file_source } => ( + re_protos::log_msg::v0::StoreSourceKind::File as i32, + re_protos::log_msg::v0::FileSource::from(file_source).encode_to_vec(), + ), + crate::StoreSource::Viewer => ( + re_protos::log_msg::v0::StoreSourceKind::Viewer as i32, + Vec::new(), + ), + crate::StoreSource::Other(description) => ( + re_protos::log_msg::v0::StoreSourceKind::Other as i32, + description.into_bytes(), + ), + }; + + Self { + kind, + extra: Some(re_protos::log_msg::v0::StoreSourceExtra { payload }), + } + } +} + +impl TryFrom for crate::StoreSource { + type Error = TypeConversionError; + + #[inline] + fn try_from(value: re_protos::log_msg::v0::StoreSource) -> Result { + use re_protos::external::prost::Message as _; + use re_protos::log_msg::v0::StoreSourceKind; + + match value.kind() { + StoreSourceKind::UnknownKind => Ok(Self::Unknown), + StoreSourceKind::CSdk => Ok(Self::CSdk), + StoreSourceKind::PythonSdk => { + let extra = value + .extra + .ok_or(missing_field!(re_protos::log_msg::v0::StoreSource, "extra"))?; + let python_version = + re_protos::log_msg::v0::PythonVersion::decode(&mut &extra.payload[..])?; + Ok(Self::PythonSdk(crate::PythonVersion::try_from( + python_version, + )?)) + } + StoreSourceKind::RustSdk => { + let extra = value + .extra + .ok_or(missing_field!(re_protos::log_msg::v0::StoreSource, "extra"))?; + let crate_info = + re_protos::log_msg::v0::CrateInfo::decode(&mut &extra.payload[..])?; + Ok(Self::RustSdk { + rustc_version: crate_info.rustc_version, + llvm_version: crate_info.llvm_version, + }) + } + StoreSourceKind::File => { + let extra = value + .extra + .ok_or(missing_field!(re_protos::log_msg::v0::StoreSource, "extra"))?; + let file_source = + re_protos::log_msg::v0::FileSource::decode(&mut &extra.payload[..])?; + Ok(Self::File { + file_source: crate::FileSource::try_from(file_source)?, + }) + } + StoreSourceKind::Viewer => Ok(Self::Viewer), + StoreSourceKind::Other => { + let description = value + .extra + .ok_or(missing_field!(re_protos::log_msg::v0::StoreSource, "extra"))?; + let description = String::from_utf8(description.payload).map_err(|err| { + invalid_field!(re_protos::log_msg::v0::StoreSource, "extra", err) + })?; + Ok(Self::Other(description)) + } + } + } +} + +impl From for re_protos::log_msg::v0::PythonVersion { + #[inline] + fn from(value: crate::PythonVersion) -> Self { + Self { + major: value.major as i32, + minor: value.minor as i32, + patch: value.patch as i32, + suffix: value.suffix, + } + } +} + +impl TryFrom for crate::PythonVersion { + type Error = TypeConversionError; + + #[inline] + fn try_from(value: re_protos::log_msg::v0::PythonVersion) -> Result { + Ok(Self { + major: value.major as u8, + minor: value.minor as u8, + patch: value.patch as u8, + suffix: value.suffix, + }) + } +} + +impl From for re_protos::log_msg::v0::FileSource { + #[inline] + fn from(value: crate::FileSource) -> Self { + let kind = match value { + crate::FileSource::Cli => re_protos::log_msg::v0::FileSourceKind::Cli as i32, + crate::FileSource::Uri => re_protos::log_msg::v0::FileSourceKind::Uri as i32, + crate::FileSource::DragAndDrop { .. } => { + re_protos::log_msg::v0::FileSourceKind::DragAndDrop as i32 + } + crate::FileSource::FileDialog { .. } => { + re_protos::log_msg::v0::FileSourceKind::FileDialog as i32 + } + crate::FileSource::Sdk => re_protos::log_msg::v0::FileSourceKind::Sdk as i32, + }; + + Self { kind } + } +} + +impl TryFrom for crate::FileSource { + type Error = TypeConversionError; + + #[inline] + fn try_from(value: re_protos::log_msg::v0::FileSource) -> Result { + use re_protos::log_msg::v0::FileSourceKind; + + match value.kind() { + FileSourceKind::Cli => Ok(Self::Cli), + FileSourceKind::Uri => Ok(Self::Uri), + FileSourceKind::DragAndDrop => Ok(Self::DragAndDrop { + recommended_application_id: None, + recommended_recording_id: None, + force_store_info: false, + }), + FileSourceKind::FileDialog => Ok(Self::FileDialog { + recommended_application_id: None, + recommended_recording_id: None, + force_store_info: false, + }), + FileSourceKind::Sdk => Ok(Self::Sdk), + FileSourceKind::UnknownSource => Err(invalid_field!( + re_protos::log_msg::v0::FileSource, + "kind", + "unknown kind", + )), + } + } +} + +impl From for re_protos::log_msg::v0::StoreInfo { + #[inline] + fn from(value: crate::StoreInfo) -> Self { + Self { + application_id: Some(value.application_id.into()), + store_id: Some(value.store_id.into()), + is_official_example: value.is_official_example, + started: Some(value.started.into()), + store_source: Some(value.store_source.into()), + store_version: value + .store_version + .map(|v| re_protos::log_msg::v0::StoreVersion { + crate_version_bits: i32::from_le_bytes(v.to_bytes()), + }), + } + } +} + +impl TryFrom for crate::StoreInfo { + type Error = TypeConversionError; + + #[inline] + fn try_from(value: re_protos::log_msg::v0::StoreInfo) -> Result { + let application_id: crate::ApplicationId = value + .application_id + .ok_or(missing_field!( + re_protos::log_msg::v0::StoreInfo, + "application_id", + ))? + .into(); + let store_id: crate::StoreId = value + .store_id + .ok_or(missing_field!( + re_protos::log_msg::v0::StoreInfo, + "store_id", + ))? + .into(); + let is_official_example = value.is_official_example; + let started: crate::Time = value + .started + .ok_or(missing_field!(re_protos::log_msg::v0::StoreInfo, "started"))? + .into(); + let store_source: crate::StoreSource = value + .store_source + .ok_or(missing_field!( + re_protos::log_msg::v0::StoreInfo, + "store_source", + ))? + .try_into()?; + let store_version = value + .store_version + .map(|v| re_build_info::CrateVersion::from_bytes(v.crate_version_bits.to_le_bytes())); + + Ok(Self { + application_id, + store_id, + cloned_from: None, + is_official_example, + started, + store_source, + store_version, + }) + } +} + +impl From for re_protos::log_msg::v0::SetStoreInfo { + #[inline] + fn from(value: crate::SetStoreInfo) -> Self { + Self { + row_id: Some(value.row_id.into()), + info: Some(value.info.into()), + } + } +} + +impl TryFrom for crate::SetStoreInfo { + type Error = TypeConversionError; + + #[inline] + fn try_from(value: re_protos::log_msg::v0::SetStoreInfo) -> Result { + Ok(Self { + row_id: value + .row_id + .ok_or(missing_field!( + re_protos::log_msg::v0::SetStoreInfo, + "row_id", + ))? + .into(), + info: value + .info + .ok_or(missing_field!(re_protos::log_msg::v0::SetStoreInfo, "info"))? + .try_into()?, + }) + } +} + +impl From + for re_protos::log_msg::v0::BlueprintActivationCommand +{ + #[inline] + fn from(value: crate::BlueprintActivationCommand) -> Self { + Self { + blueprint_id: Some(value.blueprint_id.into()), + make_active: value.make_active, + make_default: value.make_default, + } + } +} + +impl TryFrom + for crate::BlueprintActivationCommand +{ + type Error = TypeConversionError; + + #[inline] + fn try_from( + value: re_protos::log_msg::v0::BlueprintActivationCommand, + ) -> Result { + Ok(Self { + blueprint_id: value + .blueprint_id + .ok_or(missing_field!( + re_protos::log_msg::v0::BlueprintActivationCommand, + "blueprint_id", + ))? + .into(), + make_active: value.make_active, + make_default: value.make_default, + }) + } +} + +#[cfg(test)] +mod tests { + #[test] + fn entity_path_conversion() { + let entity_path = crate::EntityPath::parse_strict("a/b/c").unwrap(); + let proto_entity_path: re_protos::common::v0::EntityPath = entity_path.clone().into(); + let entity_path2: crate::EntityPath = proto_entity_path.try_into().unwrap(); + assert_eq!(entity_path, entity_path2); + } + + #[test] + fn time_conversion() { + let time = crate::Time::from_ns_since_epoch(123456789); + let proto_time: re_protos::common::v0::Time = time.into(); + let time2: crate::Time = proto_time.into(); + assert_eq!(time, time2); + } + + #[test] + fn time_int_conversion() { + let time_int = crate::TimeInt::new_temporal(123456789); + let proto_time_int: re_protos::common::v0::TimeInt = time_int.into(); + let time_int2: crate::TimeInt = proto_time_int.into(); + assert_eq!(time_int, time_int2); + } + + #[test] + fn time_range_conversion() { + let time_range = crate::ResolvedTimeRange::new( + crate::TimeInt::new_temporal(123456789), + crate::TimeInt::new_temporal(987654321), + ); + let proto_time_range: re_protos::common::v0::TimeRange = time_range.into(); + let time_range2: crate::ResolvedTimeRange = proto_time_range.into(); + assert_eq!(time_range, time_range2); + } + + #[test] + fn index_range_conversion() { + let time_range = crate::ResolvedTimeRange::new( + crate::TimeInt::new_temporal(123456789), + crate::TimeInt::new_temporal(987654321), + ); + let proto_index_range: re_protos::common::v0::IndexRange = time_range.into(); + let time_range2: crate::ResolvedTimeRange = proto_index_range.try_into().unwrap(); + assert_eq!(time_range, time_range2); + } + + #[test] + fn index_column_selector_conversion() { + let timeline = crate::Timeline::new_temporal("log_time"); + let proto_index_column_selector: re_protos::common::v0::IndexColumnSelector = + re_protos::common::v0::IndexColumnSelector { + timeline: Some(timeline.into()), + }; + let timeline2: crate::Timeline = proto_index_column_selector.try_into().unwrap(); + assert_eq!(timeline, timeline2); + } + + #[test] + fn application_id_conversion() { + let application_id = crate::ApplicationId("test".to_owned()); + let proto_application_id: re_protos::common::v0::ApplicationId = + application_id.clone().into(); + let application_id2: crate::ApplicationId = proto_application_id.into(); + assert_eq!(application_id, application_id2); + } + + #[test] + fn store_kind_conversion() { + let store_kind = crate::StoreKind::Recording; + let proto_store_kind: re_protos::common::v0::StoreKind = store_kind.into(); + let store_kind2: crate::StoreKind = proto_store_kind.into(); + assert_eq!(store_kind, store_kind2); + } + + #[test] + fn store_id_conversion() { + let store_id = + crate::StoreId::from_string(crate::StoreKind::Recording, "test_recording".to_owned()); + let proto_store_id: re_protos::common::v0::StoreId = store_id.clone().into(); + let store_id2: crate::StoreId = proto_store_id.into(); + assert_eq!(store_id, store_id2); + } + + #[test] + fn recording_id_conversion() { + let store_id = + crate::StoreId::from_string(crate::StoreKind::Recording, "test_recording".to_owned()); + let proto_recording_id: re_protos::common::v0::RecordingId = store_id.clone().into(); + let store_id2: crate::StoreId = proto_recording_id.into(); + assert_eq!(store_id, store_id2); + } + + #[test] + fn store_source_conversion() { + let store_source = crate::StoreSource::PythonSdk(crate::PythonVersion { + major: 3, + minor: 8, + patch: 0, + suffix: "a".to_owned(), + }); + let proto_store_source: re_protos::log_msg::v0::StoreSource = store_source.clone().into(); + let store_source2: crate::StoreSource = proto_store_source.try_into().unwrap(); + assert_eq!(store_source, store_source2); + } + + #[test] + fn file_source_conversion() { + let file_source = crate::FileSource::Uri; + let proto_file_source: re_protos::log_msg::v0::FileSource = file_source.clone().into(); + let file_source2: crate::FileSource = proto_file_source.try_into().unwrap(); + assert_eq!(file_source, file_source2); + } + + #[test] + fn store_info_conversion() { + let store_info = crate::StoreInfo { + application_id: crate::ApplicationId("test".to_owned()), + store_id: crate::StoreId::from_string( + crate::StoreKind::Recording, + "test_recording".to_owned(), + ), + cloned_from: None, + is_official_example: false, + started: crate::Time::now(), + store_source: crate::StoreSource::PythonSdk(crate::PythonVersion { + major: 3, + minor: 8, + patch: 0, + suffix: "a".to_owned(), + }), + store_version: None, + }; + let proto_store_info: re_protos::log_msg::v0::StoreInfo = store_info.clone().into(); + let store_info2: crate::StoreInfo = proto_store_info.try_into().unwrap(); + assert_eq!(store_info, store_info2); + } + + #[test] + fn set_store_info_conversion() { + let set_store_info = crate::SetStoreInfo { + row_id: re_tuid::Tuid::new(), + info: crate::StoreInfo { + application_id: crate::ApplicationId("test".to_owned()), + store_id: crate::StoreId::from_string( + crate::StoreKind::Recording, + "test_recording".to_owned(), + ), + cloned_from: None, + is_official_example: false, + started: crate::Time::now(), + store_source: crate::StoreSource::PythonSdk(crate::PythonVersion { + major: 3, + minor: 8, + patch: 0, + suffix: "a".to_owned(), + }), + store_version: None, + }, + }; + let proto_set_store_info: re_protos::log_msg::v0::SetStoreInfo = + set_store_info.clone().into(); + let set_store_info2: crate::SetStoreInfo = proto_set_store_info.try_into().unwrap(); + assert_eq!(set_store_info, set_store_info2); + } + + #[test] + fn blueprint_activation_command_conversion() { + let blueprint_activation_command = crate::BlueprintActivationCommand { + blueprint_id: crate::StoreId::from_string( + crate::StoreKind::Blueprint, + "test".to_owned(), + ), + make_active: true, + make_default: false, + }; + let proto_blueprint_activation_command: re_protos::log_msg::v0::BlueprintActivationCommand = + blueprint_activation_command.clone().into(); + let blueprint_activation_command2: crate::BlueprintActivationCommand = + proto_blueprint_activation_command.try_into().unwrap(); + assert_eq!(blueprint_activation_command, blueprint_activation_command2); + } +} diff --git a/crates/store/re_protos/.gitattributes b/crates/store/re_protos/.gitattributes index be213900d102..7dd060db3f46 100644 --- a/crates/store/re_protos/.gitattributes +++ b/crates/store/re_protos/.gitattributes @@ -1 +1 @@ -src/v0/rerun.remote_store.v0.rs linguist-generated=true +src/v0/** linguist-generated=true diff --git a/crates/store/re_protos/proto/rerun/v0/log_msg.proto b/crates/store/re_protos/proto/rerun/v0/log_msg.proto new file mode 100644 index 000000000000..b35abec50a58 --- /dev/null +++ b/crates/store/re_protos/proto/rerun/v0/log_msg.proto @@ -0,0 +1,190 @@ +syntax = "proto3"; + +package rerun.log_msg.v0; + +import "rerun/v0/common.proto"; + +// Corresponds to `LogMsg::SetStoreInfo`. Used to identify a recording. +message SetStoreInfo { + // A time-based UID that is used to determine how a `StoreInfo` fits in the global ordering of events. + rerun.common.v0.Tuid row_id = 1; + + // The new store info. + StoreInfo info = 2; +} + +// The type of compression used on the payload. +enum Compression { + // No compression. + NONE = 0; + + // LZ4 block compression. + LZ4 = 1; +} + +// The encoding of the message payload. +enum Encoding { + // We don't know what encoding the payload is in. + UNKNOWN = 0; + + // The payload is encoded as Arrow-IPC. + ARROW_IPC = 1; +} + +// Corresponds to `LogMsg::ArrowMsg`. Used to transmit actual data. +message ArrowMsg { + // The ID of the store that this message is for. + rerun.common.v0.StoreId store_id = 1; + + // Compression algorithm used. + Compression compression = 2; + + int32 uncompressed_size = 3; + + // Encoding of the payload. + Encoding encoding = 4; + + // Arrow-IPC encoded schema and chunk, compressed according to the `compression` field. + bytes payload = 1000; +} + +// Corresponds to `LogMsg::BlueprintActivationCommand`. +// +// Used for activating a blueprint once it has been fully transmitted, +// because showing a blueprint before it is fully transmitted can lead to +// a confusing user experience, or inconsistent results due to heuristics. +message BlueprintActivationCommand { + // The ID of the blueprint to activate. + rerun.common.v0.StoreId blueprint_id = 1; + + // Whether to make the blueprint active immediately. + bool make_active = 2; + + // Whether to make the blueprint the default. + bool make_default = 3; +} + +// Information about a recording or blueprint. +message StoreInfo { + // User-chosen name of the application doing the logging. + rerun.common.v0.ApplicationId application_id = 1; + + // Unique ID of the recording. + rerun.common.v0.StoreId store_id = 2; + + /// True if the recording is one of the official Rerun examples. + bool is_official_example = 3; + + // When the recording started. + rerun.common.v0.Time started = 4; + + // Where the recording came from. + StoreSource store_source = 5; + + // Version of the store crate. + StoreVersion store_version = 6; +} + +// The source of a recording or blueprint. +message StoreSource { + // Determines what is encoded in `extra`. + StoreSourceKind kind = 1; + + // Store source payload. See `StoreSourceKind` for what exactly is encoded here. + StoreSourceExtra extra = 2; +} + +// A newtype for `StoreSource` payload. +// +// This exists to that we can implement conversions on the newtype for convenience. +message StoreSourceExtra { + bytes payload = 1; +} + +// What kind of source a recording comes from. +enum StoreSourceKind { + // We don't know anything about the source of this recording. + // + // `extra` is unused. + UNKNOWN_KIND = 0; + + // The recording came from the C++ SDK. + // + // `extra` is unused. + C_SDK = 1; + + // The recording came from the Python SDK. + // + // `extra` is `PythonVersion`. + PYTHON_SDK = 2; + + // The recording came from the Rust SDK. + // + // `extra` is `CrateInfo`. + RUST_SDK = 3; + + // The recording came from a file. + // + // `extra` is `FileSource`. + FILE = 4; + + // The recording came from some action in the viewer. + // + // `extra` is unused. + VIEWER = 5; + + // The recording came from some other source. + // + // `extra` is a string. + OTHER = 6; +} + +// Version of the Python SDK that created the recording. +message PythonVersion { + int32 major = 1; + int32 minor = 2; + int32 patch = 3; + string suffix = 4; +} + +// Information about the Rust SDK that created the recording. +message CrateInfo { + // Version of the Rust compiler used to compile the SDK. + string rustc_version = 1; + + // Version of LLVM used by the Rust compiler. + string llvm_version = 2; +} + +// A recording which came from a file. +message FileSource { + FileSourceKind kind = 1; +} + +// Determines where the file came from. +enum FileSourceKind { + // We don't know where the file came from. + UNKNOWN_SOURCE = 0; + + // The file came from the command line. + CLI = 1; + + // The file was served over HTTP. + URI = 2; + + // The file was dragged into the viewer. + DRAG_AND_DROP = 3; + + // The file was opened using a file dialog. + FILE_DIALOG = 4; + + // The recording was produced using a data loader, such as when logging a mesh file. + SDK = 5; +} + +message StoreVersion { + // Crate version encoded using our custom scheme. + // + // See `CrateVersion` in `re_build_info`. + int32 crate_version_bits = 1; +} diff --git a/crates/store/re_protos/src/lib.rs b/crates/store/re_protos/src/lib.rs index 35da3c09c82a..545198db999b 100644 --- a/crates/store/re_protos/src/lib.rs +++ b/crates/store/re_protos/src/lib.rs @@ -24,6 +24,9 @@ mod v0 { #[path = "./rerun.common.v0.rs"] pub mod rerun_common_v0; + #[path = "./rerun.log_msg.v0.rs"] + pub mod rerun_log_msg_v0; + #[path = "./rerun.remote_store.v0.rs"] pub mod rerun_remote_store_v0; } @@ -34,6 +37,12 @@ pub mod common { } } +pub mod log_msg { + pub mod v0 { + pub use crate::v0::rerun_log_msg_v0::*; + } +} + /// Generated types for the remote store gRPC service API v0. pub mod remote_store { pub mod v0 { @@ -43,14 +52,16 @@ pub mod remote_store { #[derive(Debug, thiserror::Error)] pub enum TypeConversionError { - #[error("missing required field: {type_name}.{field_name}")] + #[error("missing required field: {package_name}.{type_name}.{field_name}")] MissingField { + package_name: &'static str, type_name: &'static str, field_name: &'static str, }, - #[error("invalid value for field {type_name}.{field_name}: {reason}")] + #[error("invalid value for field {package_name}.{type_name}.{field_name}: {reason}")] InvalidField { + package_name: &'static str, type_name: &'static str, field_name: &'static str, reason: String, @@ -67,10 +78,37 @@ pub enum TypeConversionError { } impl TypeConversionError { - pub fn missing_field(type_name: &'static str, field_name: &'static str) -> Self { + #[inline] + pub fn missing_field(field_name: &'static str) -> Self { Self::MissingField { - type_name, + package_name: T::PACKAGE, + type_name: T::NAME, field_name, } } + + #[allow(clippy::needless_pass_by_value)] // false-positive + #[inline] + pub fn invalid_field(field_name: &'static str, reason: &impl ToString) -> Self { + Self::InvalidField { + package_name: T::PACKAGE, + type_name: T::NAME, + field_name, + reason: reason.to_string(), + } + } +} + +#[macro_export] +macro_rules! missing_field { + ($type:ty, $field:expr $(,)?) => { + $crate::TypeConversionError::missing_field::<$type>($field) + }; +} + +#[macro_export] +macro_rules! invalid_field { + ($type:ty, $field:expr, $reason:expr $(,)?) => { + $crate::TypeConversionError::invalid_field::<$type>($field, &$reason) + }; } diff --git a/crates/store/re_protos/src/v0/rerun.common.v0.rs b/crates/store/re_protos/src/v0/rerun.common.v0.rs index d06d839e0c65..99bcbbd61774 100644 --- a/crates/store/re_protos/src/v0/rerun.common.v0.rs +++ b/crates/store/re_protos/src/v0/rerun.common.v0.rs @@ -11,18 +11,48 @@ pub struct RerunChunk { #[prost(bytes = "vec", tag = "1000")] pub payload: ::prost::alloc::vec::Vec, } +impl ::prost::Name for RerunChunk { + const NAME: &'static str = "RerunChunk"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.RerunChunk".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.RerunChunk".into() + } +} /// unique recording identifier. At this point in time it is the same id as the ChunkStore's StoreId #[derive(Clone, PartialEq, ::prost::Message)] pub struct RecordingId { #[prost(string, tag = "1")] pub id: ::prost::alloc::string::String, } +impl ::prost::Name for RecordingId { + const NAME: &'static str = "RecordingId"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.RecordingId".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.RecordingId".into() + } +} /// A recording can have multiple timelines, each is identified by a name, for example `log_tick`, `log_time`, etc. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Timeline { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, } +impl ::prost::Name for Timeline { + const NAME: &'static str = "Timeline"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.Timeline".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.Timeline".into() + } +} /// A time range between start and end time points. Each 64 bit number can represent different time point data /// depending on the timeline it is associated with. Time range is inclusive for both start and end time points. #[derive(Clone, Copy, PartialEq, ::prost::Message)] @@ -32,12 +62,32 @@ pub struct TimeRange { #[prost(int64, tag = "2")] pub end: i64, } +impl ::prost::Name for TimeRange { + const NAME: &'static str = "TimeRange"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.TimeRange".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.TimeRange".into() + } +} /// arrow IPC serialized schema #[derive(Clone, PartialEq, ::prost::Message)] pub struct Schema { #[prost(bytes = "vec", tag = "1")] pub arrow_schema: ::prost::alloc::vec::Vec, } +impl ::prost::Name for Schema { + const NAME: &'static str = "Schema"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.Schema".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.Schema".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct Query { /// The subset of the database that the query will run on: a set of EntityPath(s) and their @@ -100,11 +150,31 @@ pub struct Query { #[prost(enumeration = "SparseFillStrategy", tag = "11")] pub sparse_fill_strategy: i32, } +impl ::prost::Name for Query { + const NAME: &'static str = "Query"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.Query".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.Query".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct ColumnSelection { #[prost(message, repeated, tag = "1")] pub columns: ::prost::alloc::vec::Vec, } +impl ::prost::Name for ColumnSelection { + const NAME: &'static str = "ColumnSelection"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.ColumnSelection".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.ColumnSelection".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct ColumnSelector { #[prost(oneof = "column_selector::SelectorType", tags = "2, 3")] @@ -120,40 +190,110 @@ pub mod column_selector { TimeColumn(super::TimeColumnSelector), } } +impl ::prost::Name for ColumnSelector { + const NAME: &'static str = "ColumnSelector"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.ColumnSelector".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.ColumnSelector".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct IndexColumnSelector { /// TODO(zehiko) we need to add support for other types of index selectors #[prost(message, optional, tag = "1")] pub timeline: ::core::option::Option, } +impl ::prost::Name for IndexColumnSelector { + const NAME: &'static str = "IndexColumnSelector"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.IndexColumnSelector".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.IndexColumnSelector".into() + } +} #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct IndexRange { /// TODO(zehiko) support for other ranges for other index selectors #[prost(message, optional, tag = "1")] pub time_range: ::core::option::Option, } +impl ::prost::Name for IndexRange { + const NAME: &'static str = "IndexRange"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.IndexRange".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.IndexRange".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct IndexValues { /// TODO(zehiko) we need to add support for other types of index selectors #[prost(message, repeated, tag = "1")] pub time_points: ::prost::alloc::vec::Vec, } +impl ::prost::Name for IndexValues { + const NAME: &'static str = "IndexValues"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.IndexValues".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.IndexValues".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct SampledIndexValues { #[prost(message, repeated, tag = "1")] pub sample_points: ::prost::alloc::vec::Vec, } +impl ::prost::Name for SampledIndexValues { + const NAME: &'static str = "SampledIndexValues"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.SampledIndexValues".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.SampledIndexValues".into() + } +} /// A 64-bit number describing either nanoseconds, sequence numbers or fully static data. #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct TimeInt { #[prost(int64, tag = "1")] pub time: i64, } +impl ::prost::Name for TimeInt { + const NAME: &'static str = "TimeInt"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.TimeInt".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.TimeInt".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct ViewContents { #[prost(message, repeated, tag = "1")] pub contents: ::prost::alloc::vec::Vec, } +impl ::prost::Name for ViewContents { + const NAME: &'static str = "ViewContents"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.ViewContents".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.ViewContents".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct ViewContentsPart { #[prost(message, optional, tag = "1")] @@ -161,11 +301,31 @@ pub struct ViewContentsPart { #[prost(message, optional, tag = "2")] pub components: ::core::option::Option, } +impl ::prost::Name for ViewContentsPart { + const NAME: &'static str = "ViewContentsPart"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.ViewContentsPart".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.ViewContentsPart".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct ComponentsSet { #[prost(message, repeated, tag = "1")] pub components: ::prost::alloc::vec::Vec, } +impl ::prost::Name for ComponentsSet { + const NAME: &'static str = "ComponentsSet"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.ComponentsSet".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.ComponentsSet".into() + } +} /// The unique identifier of an entity, e.g. `camera/3/points` /// See <> for more on entity paths. #[derive(Clone, PartialEq, ::prost::Message)] @@ -173,6 +333,16 @@ pub struct EntityPath { #[prost(string, tag = "1")] pub path: ::prost::alloc::string::String, } +impl ::prost::Name for EntityPath { + const NAME: &'static str = "EntityPath"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.EntityPath".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.EntityPath".into() + } +} /// Component describes semantic data that can be used by any number of rerun's archetypes. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Component { @@ -180,12 +350,32 @@ pub struct Component { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, } +impl ::prost::Name for Component { + const NAME: &'static str = "Component"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.Component".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.Component".into() + } +} /// Used to telect a time column. #[derive(Clone, PartialEq, ::prost::Message)] pub struct TimeColumnSelector { #[prost(message, optional, tag = "1")] pub timeline: ::core::option::Option, } +impl ::prost::Name for TimeColumnSelector { + const NAME: &'static str = "TimeColumnSelector"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.TimeColumnSelector".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.TimeColumnSelector".into() + } +} /// Used to select a component based on its EntityPath and Component name. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ComponentColumnSelector { @@ -194,11 +384,31 @@ pub struct ComponentColumnSelector { #[prost(message, optional, tag = "2")] pub component: ::core::option::Option, } +impl ::prost::Name for ComponentColumnSelector { + const NAME: &'static str = "ComponentColumnSelector"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.ComponentColumnSelector".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.ComponentColumnSelector".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct ApplicationId { #[prost(string, tag = "1")] pub id: ::prost::alloc::string::String, } +impl ::prost::Name for ApplicationId { + const NAME: &'static str = "ApplicationId"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.ApplicationId".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.ApplicationId".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct StoreId { #[prost(enumeration = "StoreKind", tag = "1")] @@ -206,12 +416,32 @@ pub struct StoreId { #[prost(string, tag = "2")] pub id: ::prost::alloc::string::String, } +impl ::prost::Name for StoreId { + const NAME: &'static str = "StoreId"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.StoreId".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.StoreId".into() + } +} /// A date-time represented as nanoseconds since unix epoch #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Time { #[prost(int64, tag = "1")] pub nanos_since_epoch: i64, } +impl ::prost::Name for Time { + const NAME: &'static str = "Time"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.Time".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.Time".into() + } +} #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Tuid { /// Approximate nanoseconds since epoch. @@ -222,6 +452,16 @@ pub struct Tuid { #[prost(fixed64, tag = "2")] pub inc: u64, } +impl ::prost::Name for Tuid { + const NAME: &'static str = "Tuid"; + const PACKAGE: &'static str = "rerun.common.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.common.v0.Tuid".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.common.v0.Tuid".into() + } +} /// supported encoder versions for encoding data /// See `RerunData` and `RerunChunkData` for its usage #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] diff --git a/crates/store/re_protos/src/v0/rerun.log_msg.v0.rs b/crates/store/re_protos/src/v0/rerun.log_msg.v0.rs new file mode 100644 index 000000000000..3b415876fbc0 --- /dev/null +++ b/crates/store/re_protos/src/v0/rerun.log_msg.v0.rs @@ -0,0 +1,388 @@ +// This file is @generated by prost-build. +/// Corresponds to `LogMsg::SetStoreInfo`. Used to identify a recording. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetStoreInfo { + /// A time-based UID that is used to determine how a `StoreInfo` fits in the global ordering of events. + #[prost(message, optional, tag = "1")] + pub row_id: ::core::option::Option, + /// The new store info. + #[prost(message, optional, tag = "2")] + pub info: ::core::option::Option, +} +impl ::prost::Name for SetStoreInfo { + const NAME: &'static str = "SetStoreInfo"; + const PACKAGE: &'static str = "rerun.log_msg.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.log_msg.v0.SetStoreInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.log_msg.v0.SetStoreInfo".into() + } +} +/// Corresponds to `LogMsg::ArrowMsg`. Used to transmit actual data. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ArrowMsg { + /// The ID of the store that this message is for. + #[prost(message, optional, tag = "1")] + pub store_id: ::core::option::Option, + /// Compression algorithm used. + #[prost(enumeration = "Compression", tag = "2")] + pub compression: i32, + #[prost(int32, tag = "3")] + pub uncompressed_size: i32, + /// Encoding of the payload. + #[prost(enumeration = "Encoding", tag = "4")] + pub encoding: i32, + /// Arrow-IPC encoded schema and chunk, compressed according to the `compression` field. + #[prost(bytes = "vec", tag = "1000")] + pub payload: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for ArrowMsg { + const NAME: &'static str = "ArrowMsg"; + const PACKAGE: &'static str = "rerun.log_msg.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.log_msg.v0.ArrowMsg".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.log_msg.v0.ArrowMsg".into() + } +} +/// Corresponds to `LogMsg::BlueprintActivationCommand`. +/// +/// Used for activating a blueprint once it has been fully transmitted, +/// because showing a blueprint before it is fully transmitted can lead to +/// a confusing user experience, or inconsistent results due to heuristics. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlueprintActivationCommand { + /// The ID of the blueprint to activate. + #[prost(message, optional, tag = "1")] + pub blueprint_id: ::core::option::Option, + /// Whether to make the blueprint active immediately. + #[prost(bool, tag = "2")] + pub make_active: bool, + /// Whether to make the blueprint the default. + #[prost(bool, tag = "3")] + pub make_default: bool, +} +impl ::prost::Name for BlueprintActivationCommand { + const NAME: &'static str = "BlueprintActivationCommand"; + const PACKAGE: &'static str = "rerun.log_msg.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.log_msg.v0.BlueprintActivationCommand".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.log_msg.v0.BlueprintActivationCommand".into() + } +} +/// Information about a recording or blueprint. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreInfo { + /// User-chosen name of the application doing the logging. + #[prost(message, optional, tag = "1")] + pub application_id: ::core::option::Option, + /// Unique ID of the recording. + #[prost(message, optional, tag = "2")] + pub store_id: ::core::option::Option, + /// / True if the recording is one of the official Rerun examples. + #[prost(bool, tag = "3")] + pub is_official_example: bool, + /// When the recording started. + #[prost(message, optional, tag = "4")] + pub started: ::core::option::Option, + /// Where the recording came from. + #[prost(message, optional, tag = "5")] + pub store_source: ::core::option::Option, + /// Version of the store crate. + #[prost(message, optional, tag = "6")] + pub store_version: ::core::option::Option, +} +impl ::prost::Name for StoreInfo { + const NAME: &'static str = "StoreInfo"; + const PACKAGE: &'static str = "rerun.log_msg.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.log_msg.v0.StoreInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.log_msg.v0.StoreInfo".into() + } +} +/// The source of a recording or blueprint. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreSource { + /// Determines what is encoded in `extra`. + #[prost(enumeration = "StoreSourceKind", tag = "1")] + pub kind: i32, + /// Store source payload. See `StoreSourceKind` for what exactly is encoded here. + #[prost(message, optional, tag = "2")] + pub extra: ::core::option::Option, +} +impl ::prost::Name for StoreSource { + const NAME: &'static str = "StoreSource"; + const PACKAGE: &'static str = "rerun.log_msg.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.log_msg.v0.StoreSource".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.log_msg.v0.StoreSource".into() + } +} +/// A newtype for `StoreSource` payload. +/// +/// This exists to that we can implement conversions on the newtype for convenience. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreSourceExtra { + #[prost(bytes = "vec", tag = "1")] + pub payload: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for StoreSourceExtra { + const NAME: &'static str = "StoreSourceExtra"; + const PACKAGE: &'static str = "rerun.log_msg.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.log_msg.v0.StoreSourceExtra".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.log_msg.v0.StoreSourceExtra".into() + } +} +/// Version of the Python SDK that created the recording. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PythonVersion { + #[prost(int32, tag = "1")] + pub major: i32, + #[prost(int32, tag = "2")] + pub minor: i32, + #[prost(int32, tag = "3")] + pub patch: i32, + #[prost(string, tag = "4")] + pub suffix: ::prost::alloc::string::String, +} +impl ::prost::Name for PythonVersion { + const NAME: &'static str = "PythonVersion"; + const PACKAGE: &'static str = "rerun.log_msg.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.log_msg.v0.PythonVersion".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.log_msg.v0.PythonVersion".into() + } +} +/// Information about the Rust SDK that created the recording. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CrateInfo { + /// Version of the Rust compiler used to compile the SDK. + #[prost(string, tag = "1")] + pub rustc_version: ::prost::alloc::string::String, + /// Version of LLVM used by the Rust compiler. + #[prost(string, tag = "2")] + pub llvm_version: ::prost::alloc::string::String, +} +impl ::prost::Name for CrateInfo { + const NAME: &'static str = "CrateInfo"; + const PACKAGE: &'static str = "rerun.log_msg.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.log_msg.v0.CrateInfo".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.log_msg.v0.CrateInfo".into() + } +} +/// A recording which came from a file. +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct FileSource { + #[prost(enumeration = "FileSourceKind", tag = "1")] + pub kind: i32, +} +impl ::prost::Name for FileSource { + const NAME: &'static str = "FileSource"; + const PACKAGE: &'static str = "rerun.log_msg.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.log_msg.v0.FileSource".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.log_msg.v0.FileSource".into() + } +} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct StoreVersion { + /// Crate version encoded using our custom scheme. + /// + /// See `CrateVersion` in `re_build_info`. + #[prost(int32, tag = "1")] + pub crate_version_bits: i32, +} +impl ::prost::Name for StoreVersion { + const NAME: &'static str = "StoreVersion"; + const PACKAGE: &'static str = "rerun.log_msg.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.log_msg.v0.StoreVersion".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.log_msg.v0.StoreVersion".into() + } +} +/// The type of compression used on the payload. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Compression { + /// No compression. + None = 0, + /// LZ4 block compression. + Lz4 = 1, +} +impl Compression { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::None => "NONE", + Self::Lz4 => "LZ4", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "NONE" => Some(Self::None), + "LZ4" => Some(Self::Lz4), + _ => None, + } + } +} +/// The encoding of the message payload. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Encoding { + /// We don't know what encoding the payload is in. + Unknown = 0, + /// The payload is encoded as Arrow-IPC. + ArrowIpc = 1, +} +impl Encoding { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unknown => "UNKNOWN", + Self::ArrowIpc => "ARROW_IPC", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN" => Some(Self::Unknown), + "ARROW_IPC" => Some(Self::ArrowIpc), + _ => None, + } + } +} +/// What kind of source a recording comes from. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum StoreSourceKind { + /// We don't know anything about the source of this recording. + /// + /// `extra` is unused. + UnknownKind = 0, + /// The recording came from the C++ SDK. + /// + /// `extra` is unused. + CSdk = 1, + /// The recording came from the Python SDK. + /// + /// `extra` is `PythonVersion`. + PythonSdk = 2, + /// The recording came from the Rust SDK. + /// + /// `extra` is `CrateInfo`. + RustSdk = 3, + /// The recording came from a file. + /// + /// `extra` is `FileSource`. + File = 4, + /// The recording came from some action in the viewer. + /// + /// `extra` is unused. + Viewer = 5, + /// The recording came from some other source. + /// + /// `extra` is a string. + Other = 6, +} +impl StoreSourceKind { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnknownKind => "UNKNOWN_KIND", + Self::CSdk => "C_SDK", + Self::PythonSdk => "PYTHON_SDK", + Self::RustSdk => "RUST_SDK", + Self::File => "FILE", + Self::Viewer => "VIEWER", + Self::Other => "OTHER", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN_KIND" => Some(Self::UnknownKind), + "C_SDK" => Some(Self::CSdk), + "PYTHON_SDK" => Some(Self::PythonSdk), + "RUST_SDK" => Some(Self::RustSdk), + "FILE" => Some(Self::File), + "VIEWER" => Some(Self::Viewer), + "OTHER" => Some(Self::Other), + _ => None, + } + } +} +/// Determines where the file came from. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum FileSourceKind { + /// We don't know where the file came from. + UnknownSource = 0, + /// The file came from the command line. + Cli = 1, + /// The file was served over HTTP. + Uri = 2, + /// The file was dragged into the viewer. + DragAndDrop = 3, + /// The file was opened using a file dialog. + FileDialog = 4, + /// The recording was produced using a data loader, such as when logging a mesh file. + Sdk = 5, +} +impl FileSourceKind { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnknownSource => "UNKNOWN_SOURCE", + Self::Cli => "CLI", + Self::Uri => "URI", + Self::DragAndDrop => "DRAG_AND_DROP", + Self::FileDialog => "FILE_DIALOG", + Self::Sdk => "SDK", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN_SOURCE" => Some(Self::UnknownSource), + "CLI" => Some(Self::Cli), + "URI" => Some(Self::Uri), + "DRAG_AND_DROP" => Some(Self::DragAndDrop), + "FILE_DIALOG" => Some(Self::FileDialog), + "SDK" => Some(Self::Sdk), + _ => None, + } + } +} diff --git a/crates/store/re_protos/src/v0/rerun.remote_store.v0.rs b/crates/store/re_protos/src/v0/rerun.remote_store.v0.rs index 144ddc584ef7..1429146e776d 100644 --- a/crates/store/re_protos/src/v0/rerun.remote_store.v0.rs +++ b/crates/store/re_protos/src/v0/rerun.remote_store.v0.rs @@ -9,6 +9,16 @@ pub struct DataframePart { #[prost(bytes = "vec", tag = "1000")] pub payload: ::prost::alloc::vec::Vec, } +impl ::prost::Name for DataframePart { + const NAME: &'static str = "DataframePart"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.DataframePart".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.DataframePart".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct RegisterRecordingRequest { /// human readable description of the recording @@ -25,6 +35,16 @@ pub struct RegisterRecordingRequest { #[prost(message, optional, tag = "4")] pub metadata: ::core::option::Option, } +impl ::prost::Name for RegisterRecordingRequest { + const NAME: &'static str = "RegisterRecordingRequest"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.RegisterRecordingRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.RegisterRecordingRequest".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpdateCatalogRequest { #[prost(message, optional, tag = "1")] @@ -32,8 +52,28 @@ pub struct UpdateCatalogRequest { #[prost(message, optional, tag = "2")] pub metadata: ::core::option::Option, } +impl ::prost::Name for UpdateCatalogRequest { + const NAME: &'static str = "UpdateCatalogRequest"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.UpdateCatalogRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.UpdateCatalogRequest".into() + } +} #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct UpdateCatalogResponse {} +impl ::prost::Name for UpdateCatalogResponse { + const NAME: &'static str = "UpdateCatalogResponse"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.UpdateCatalogResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.UpdateCatalogResponse".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryRequest { /// unique identifier of the recording @@ -43,6 +83,16 @@ pub struct QueryRequest { #[prost(message, optional, tag = "3")] pub query: ::core::option::Option, } +impl ::prost::Name for QueryRequest { + const NAME: &'static str = "QueryRequest"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.QueryRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.QueryRequest".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryCatalogRequest { /// Column projection - define which columns should be returned. @@ -53,11 +103,31 @@ pub struct QueryCatalogRequest { #[prost(message, optional, tag = "2")] pub filter: ::core::option::Option, } +impl ::prost::Name for QueryCatalogRequest { + const NAME: &'static str = "QueryCatalogRequest"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.QueryCatalogRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.QueryCatalogRequest".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct ColumnProjection { #[prost(string, repeated, tag = "1")] pub columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } +impl ::prost::Name for ColumnProjection { + const NAME: &'static str = "ColumnProjection"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.ColumnProjection".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.ColumnProjection".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct CatalogFilter { /// Filtering is very simple right now, we can only select @@ -65,6 +135,16 @@ pub struct CatalogFilter { #[prost(message, repeated, tag = "1")] pub recording_ids: ::prost::alloc::vec::Vec, } +impl ::prost::Name for CatalogFilter { + const NAME: &'static str = "CatalogFilter"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.CatalogFilter".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.CatalogFilter".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryCatalogResponse { #[prost(enumeration = "super::super::common::v0::EncoderVersion", tag = "1")] @@ -73,11 +153,31 @@ pub struct QueryCatalogResponse { #[prost(bytes = "vec", tag = "2")] pub payload: ::prost::alloc::vec::Vec, } +impl ::prost::Name for QueryCatalogResponse { + const NAME: &'static str = "QueryCatalogResponse"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.QueryCatalogResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.QueryCatalogResponse".into() + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct FetchRecordingRequest { #[prost(message, optional, tag = "1")] pub recording_id: ::core::option::Option, } +impl ::prost::Name for FetchRecordingRequest { + const NAME: &'static str = "FetchRecordingRequest"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.FetchRecordingRequest".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.FetchRecordingRequest".into() + } +} /// TODO(jleibs): Eventually this becomes either query-mediated in some way, but for now /// it's useful to be able to just get back the whole RRD somehow. #[derive(Clone, PartialEq, ::prost::Message)] @@ -91,6 +191,16 @@ pub struct FetchRecordingResponse { #[prost(bytes = "vec", tag = "2")] pub payload: ::prost::alloc::vec::Vec, } +impl ::prost::Name for FetchRecordingResponse { + const NAME: &'static str = "FetchRecordingResponse"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.FetchRecordingResponse".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.FetchRecordingResponse".into() + } +} /// Application level error - used as `details` in the `google.rpc.Status` message #[derive(Clone, PartialEq, ::prost::Message)] pub struct RemoteStoreError { @@ -104,6 +214,16 @@ pub struct RemoteStoreError { #[prost(string, tag = "3")] pub message: ::prost::alloc::string::String, } +impl ::prost::Name for RemoteStoreError { + const NAME: &'static str = "RemoteStoreError"; + const PACKAGE: &'static str = "rerun.remote_store.v0"; + fn full_name() -> ::prost::alloc::string::String { + "rerun.remote_store.v0.RemoteStoreError".into() + } + fn type_url() -> ::prost::alloc::string::String { + "/rerun.remote_store.v0.RemoteStoreError".into() + } +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum RecordingType { diff --git a/crates/store/re_sdk_comms/src/buffered_client.rs b/crates/store/re_sdk_comms/src/buffered_client.rs index 6a48e553bd4b..4616bcce5f7f 100644 --- a/crates/store/re_sdk_comms/src/buffered_client.rs +++ b/crates/store/re_sdk_comms/src/buffered_client.rs @@ -71,7 +71,7 @@ impl Client { // We don't compress the stream because we assume the SDK // and server are on the same machine and compression // can be expensive, see https://github.com/rerun-io/rerun/issues/2216 - let encoding_options = re_log_encoding::EncodingOptions::UNCOMPRESSED; + let encoding_options = re_log_encoding::EncodingOptions::MSGPACK_UNCOMPRESSED; let encode_join = std::thread::Builder::new() .name("msg_encoder".into()) diff --git a/crates/store/re_sdk_comms/src/server.rs b/crates/store/re_sdk_comms/src/server.rs index fc7ceea9037c..48a1c381c700 100644 --- a/crates/store/re_sdk_comms/src/server.rs +++ b/crates/store/re_sdk_comms/src/server.rs @@ -238,7 +238,7 @@ fn run_client( congestion_manager.register_latency(tx.latency_sec()); - let version_policy = re_log_encoding::decoder::VersionPolicy::Warn; + let version_policy = re_log_encoding::VersionPolicy::Warn; for msg in re_log_encoding::decoder::decode_bytes(version_policy, &packet)? { if congestion_manager.should_send(&msg) { tx.send(msg)?; diff --git a/crates/top/re_sdk/src/binary_stream_sink.rs b/crates/top/re_sdk/src/binary_stream_sink.rs index a673ea24992a..102f453271aa 100644 --- a/crates/top/re_sdk/src/binary_stream_sink.rs +++ b/crates/top/re_sdk/src/binary_stream_sink.rs @@ -129,7 +129,7 @@ impl BinaryStreamSink { // We always compress when writing to a stream // TODO(jleibs): Make this configurable - let encoding_options = re_log_encoding::EncodingOptions::COMPRESSED; + let encoding_options = re_log_encoding::EncodingOptions::MSGPACK_COMPRESSED; let (tx, rx) = std::sync::mpsc::channel(); diff --git a/crates/top/rerun/Cargo.toml b/crates/top/rerun/Cargo.toml index 068c98028fdd..d9739ec159f8 100644 --- a/crates/top/rerun/Cargo.toml +++ b/crates/top/rerun/Cargo.toml @@ -99,7 +99,8 @@ run = [ "unindent", "dep:re_chunk_store", "dep:re_data_source", - "dep:re_log_encoding", + "re_log_encoding/encoder", + "re_log_encoding/decoder", "dep:re_sdk_comms", "dep:re_ws_comms", ] @@ -128,6 +129,7 @@ re_crash_handler.workspace = true re_entity_db.workspace = true re_error.workspace = true re_format.workspace = true +re_log_encoding.workspace = true re_log_types.workspace = true re_video.workspace = true re_log.workspace = true @@ -145,10 +147,6 @@ re_analytics = { workspace = true, optional = true } re_chunk_store = { workspace = true, optional = true } re_data_source = { workspace = true, optional = true } re_dataframe = { workspace = true, optional = true } -re_log_encoding = { workspace = true, optional = true, features = [ - "decoder", - "encoder", -] } re_sdk = { workspace = true, optional = true } re_sdk_comms = { workspace = true, optional = true } re_types = { workspace = true, optional = true } diff --git a/crates/top/rerun/src/commands/entrypoint.rs b/crates/top/rerun/src/commands/entrypoint.rs index b34289ac1d09..bc437f46ce35 100644 --- a/crates/top/rerun/src/commands/entrypoint.rs +++ b/crates/top/rerun/src/commands/entrypoint.rs @@ -1007,7 +1007,7 @@ fn stream_to_rrd_on_disk( re_log::info!("Saving incoming log stream to {path:?}. Abort with Ctrl-C."); - let encoding_options = re_log_encoding::EncodingOptions::COMPRESSED; + let encoding_options = re_log_encoding::EncodingOptions::MSGPACK_COMPRESSED; let file = std::fs::File::create(path).map_err(|err| FileSinkError::CreateFile(path.clone(), err))?; let mut encoder = re_log_encoding::encoder::DroppableEncoder::new( diff --git a/crates/top/rerun/src/commands/rrd/compare.rs b/crates/top/rerun/src/commands/rrd/compare.rs index cd2c87b5aa09..3472eacd8f90 100644 --- a/crates/top/rerun/src/commands/rrd/compare.rs +++ b/crates/top/rerun/src/commands/rrd/compare.rs @@ -93,7 +93,7 @@ fn compute_uber_table( let rrd_file = std::io::BufReader::new(rrd_file); let mut stores: std::collections::HashMap = Default::default(); - let version_policy = re_log_encoding::decoder::VersionPolicy::Error; + let version_policy = re_log_encoding::VersionPolicy::Error; let decoder = re_log_encoding::decoder::Decoder::new(version_policy, rrd_file)?; for msg in decoder { let msg = msg.context("decode rrd message")?; diff --git a/crates/top/rerun/src/commands/rrd/filter.rs b/crates/top/rerun/src/commands/rrd/filter.rs index 53efe7cf9d4e..b1e9ca2c0e5e 100644 --- a/crates/top/rerun/src/commands/rrd/filter.rs +++ b/crates/top/rerun/src/commands/rrd/filter.rs @@ -60,7 +60,7 @@ impl FilterCommand { .collect(); // TODO(cmc): might want to make this configurable at some point. - let version_policy = re_log_encoding::decoder::VersionPolicy::Warn; + let version_policy = re_log_encoding::VersionPolicy::Warn; let (rx_decoder, rx_size_bytes) = read_rrd_streams_from_file_or_stdin(version_policy, path_to_input_rrds); @@ -83,7 +83,7 @@ impl FilterCommand { let mut encoder = { // TODO(cmc): encoding options & version should match the original. let version = CrateVersion::LOCAL; - let options = re_log_encoding::EncodingOptions::COMPRESSED; + let options = re_log_encoding::EncodingOptions::MSGPACK_COMPRESSED; re_log_encoding::encoder::DroppableEncoder::new(version, options, &mut rrd_out) .context("couldn't init encoder")? }; diff --git a/crates/top/rerun/src/commands/rrd/merge_compact.rs b/crates/top/rerun/src/commands/rrd/merge_compact.rs index 9aa434f84b1a..82a2ffb3cd69 100644 --- a/crates/top/rerun/src/commands/rrd/merge_compact.rs +++ b/crates/top/rerun/src/commands/rrd/merge_compact.rs @@ -157,7 +157,7 @@ fn merge_and_compact( ); // TODO(cmc): might want to make this configurable at some point. - let version_policy = re_log_encoding::decoder::VersionPolicy::Warn; + let version_policy = re_log_encoding::VersionPolicy::Warn; let (rx, rx_size_bytes) = read_rrd_streams_from_file_or_stdin(version_policy, path_to_input_rrds); @@ -215,7 +215,7 @@ fn merge_and_compact( .flat_map(|entity_db| entity_db.to_messages(None /* time selection */)); // TODO(cmc): encoding options should match the original. - let encoding_options = re_log_encoding::EncodingOptions::COMPRESSED; + let encoding_options = re_log_encoding::EncodingOptions::MSGPACK_COMPRESSED; let version = entity_dbs .values() .next() diff --git a/crates/top/rerun/src/commands/rrd/print.rs b/crates/top/rerun/src/commands/rrd/print.rs index 2d513c8fc091..f5145f62fb20 100644 --- a/crates/top/rerun/src/commands/rrd/print.rs +++ b/crates/top/rerun/src/commands/rrd/print.rs @@ -42,7 +42,7 @@ impl PrintCommand { } = self; // TODO(cmc): might want to make this configurable at some point. - let version_policy = re_log_encoding::decoder::VersionPolicy::Warn; + let version_policy = re_log_encoding::VersionPolicy::Warn; let (rx, _) = read_rrd_streams_from_file_or_stdin(version_policy, path_to_input_rrds); for res in rx { diff --git a/crates/top/rerun/src/commands/stdio.rs b/crates/top/rerun/src/commands/stdio.rs index 98599dd7b5eb..e34a67f155c6 100644 --- a/crates/top/rerun/src/commands/stdio.rs +++ b/crates/top/rerun/src/commands/stdio.rs @@ -23,7 +23,7 @@ use re_log_types::LogMsg; /// /// This function is capable of decoding multiple independent recordings from a single stream. pub fn read_rrd_streams_from_file_or_stdin( - version_policy: re_log_encoding::decoder::VersionPolicy, + version_policy: re_log_encoding::VersionPolicy, paths: &[String], ) -> ( channel::Receiver>, diff --git a/crates/top/rerun/src/lib.rs b/crates/top/rerun/src/lib.rs index fb1b3953db98..2f6dbf8f1c8b 100644 --- a/crates/top/rerun/src/lib.rs +++ b/crates/top/rerun/src/lib.rs @@ -133,6 +133,8 @@ pub use log_integration::Logger; #[cfg(feature = "run")] pub use commands::{run, CallSource}; +pub use re_log_encoding::VersionPolicy; + #[cfg(feature = "sdk")] pub use sdk::*; @@ -145,7 +147,7 @@ pub mod dataframe { /// Everything needed to build custom `ChunkStoreSubscriber`s. pub use re_entity_db::external::re_chunk_store::{ ChunkStore, ChunkStoreConfig, ChunkStoreDiff, ChunkStoreDiffKind, ChunkStoreEvent, - ChunkStoreGeneration, ChunkStoreHandle, ChunkStoreSubscriber, VersionPolicy, + ChunkStoreGeneration, ChunkStoreHandle, ChunkStoreSubscriber, }; pub use re_log_types::StoreKind; diff --git a/crates/utils/re_tuid/src/protobuf_conversions.rs b/crates/utils/re_tuid/src/protobuf_conversions.rs index 2dfd04627d4b..a04dba09ddbf 100644 --- a/crates/utils/re_tuid/src/protobuf_conversions.rs +++ b/crates/utils/re_tuid/src/protobuf_conversions.rs @@ -15,3 +15,14 @@ impl From for re_protos::common::v0::Tuid { } } } + +#[cfg(test)] +mod tests { + #[test] + fn test_tuid_conversion() { + let tuid = crate::Tuid::new(); + let proto_tuid: re_protos::common::v0::Tuid = tuid.into(); + let tuid2: crate::Tuid = proto_tuid.into(); + assert_eq!(tuid, tuid2); + } +} diff --git a/crates/viewer/re_viewer/src/app.rs b/crates/viewer/re_viewer/src/app.rs index 870e52527f4c..6de723f67dca 100644 --- a/crates/viewer/re_viewer/src/app.rs +++ b/crates/viewer/re_viewer/src/app.rs @@ -2283,7 +2283,7 @@ async fn async_save_dialog( let bytes = re_log_encoding::encoder::encode_as_bytes( rrd_version, - re_log_encoding::EncodingOptions::COMPRESSED, + re_log_encoding::EncodingOptions::MSGPACK_COMPRESSED, messages, )?; file_handle.write(&bytes).await.context("Failed to save") diff --git a/crates/viewer/re_viewer/src/loading.rs b/crates/viewer/re_viewer/src/loading.rs index a6e2c5317718..476e3d969afb 100644 --- a/crates/viewer/re_viewer/src/loading.rs +++ b/crates/viewer/re_viewer/src/loading.rs @@ -25,7 +25,7 @@ pub fn load_blueprint_file( // Blueprint files change often. Be strict about the version, and then ignore any errors. // See https://github.com/rerun-io/rerun/issues/2830 - let version_policy = re_log_encoding::decoder::VersionPolicy::Error; + let version_policy = re_log_encoding::VersionPolicy::Error; Ok(StoreBundle::from_rrd(version_policy, file)?) } diff --git a/crates/viewer/re_viewer/src/saving.rs b/crates/viewer/re_viewer/src/saving.rs index 142fda1997df..001912449730 100644 --- a/crates/viewer/re_viewer/src/saving.rs +++ b/crates/viewer/re_viewer/src/saving.rs @@ -67,7 +67,7 @@ pub fn encode_to_file( let mut file = std::fs::File::create(path) .with_context(|| format!("Failed to create file at {path:?}"))?; - let encoding_options = re_log_encoding::EncodingOptions::COMPRESSED; + let encoding_options = re_log_encoding::EncodingOptions::MSGPACK_COMPRESSED; re_log_encoding::encoder::encode(version, encoding_options, messages, &mut file) .map(|_| ()) .context("Message encode") diff --git a/rerun_py/src/dataframe.rs b/rerun_py/src/dataframe.rs index 3a66680f2114..3f75a459039e 100644 --- a/rerun_py/src/dataframe.rs +++ b/rerun_py/src/dataframe.rs @@ -21,9 +21,10 @@ use pyo3::{ use re_chunk_store::{ ChunkStore, ChunkStoreConfig, ChunkStoreHandle, ColumnDescriptor, ColumnSelector, ComponentColumnDescriptor, ComponentColumnSelector, QueryExpression, SparseFillStrategy, - TimeColumnDescriptor, TimeColumnSelector, VersionPolicy, ViewContentsSelector, + TimeColumnDescriptor, TimeColumnSelector, ViewContentsSelector, }; use re_dataframe::{QueryEngine, StorageEngine}; +use re_log_encoding::VersionPolicy; use re_log_types::{EntityPathFilter, ResolvedTimeRange, TimeType}; use re_sdk::{ComponentName, EntityPath, StoreId, StoreKind}; From bee0f81ffaca45e5184674f9b9ace106d0cd99d8 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:33:44 +0100 Subject: [PATCH 47/71] Update test snapshots invalidated by #8408 (#8434) --- .../re_time_panel/tests/snapshots/time_panel_dense_data.png | 4 ++-- .../re_time_panel/tests/snapshots/time_panel_two_sections.png | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/viewer/re_time_panel/tests/snapshots/time_panel_dense_data.png b/crates/viewer/re_time_panel/tests/snapshots/time_panel_dense_data.png index 7eea4ae888f9..fac3cedd2a1c 100644 --- a/crates/viewer/re_time_panel/tests/snapshots/time_panel_dense_data.png +++ b/crates/viewer/re_time_panel/tests/snapshots/time_panel_dense_data.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2965a2ad75997674a64481d9a82d2eb7d64d1fdf09f2cf47ad87e150a8f1fd91 -size 27566 +oid sha256:726b5f7329830053efc11acac5d291420b1c2d689e9d51aa85a5723085ad1bb2 +size 27588 diff --git a/crates/viewer/re_time_panel/tests/snapshots/time_panel_two_sections.png b/crates/viewer/re_time_panel/tests/snapshots/time_panel_two_sections.png index 2542f4c6339b..3797bd35c3da 100644 --- a/crates/viewer/re_time_panel/tests/snapshots/time_panel_two_sections.png +++ b/crates/viewer/re_time_panel/tests/snapshots/time_panel_two_sections.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:38d1bdf41d8ccc4b6ee9ea43c51fa2c16a3cf94071bd9e9a2cd57f649d268a17 -size 31954 +oid sha256:2e98e0f51b2648032d926d8f3ad4dc6adb45ab6cb5366fbee79d4832548d3ba4 +size 32184 From 931561e7c4f7f93b90947e6a162358d705e6451a Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Thu, 12 Dec 2024 14:35:30 +0100 Subject: [PATCH 48/71] Fix links to blueprint components/archetype that don't show up in our reference yet (#8430) --- crates/build/re_types_builder/src/docs.rs | 11 +++++++++-- crates/store/re_types/src/reflection/mod.rs | 8 ++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/crates/build/re_types_builder/src/docs.rs b/crates/build/re_types_builder/src/docs.rs index 37aeb14633c1..4b8f6bae8d6e 100644 --- a/crates/build/re_types_builder/src/docs.rs +++ b/crates/build/re_types_builder/src/docs.rs @@ -417,6 +417,13 @@ mod doclink_translation { } } Target::WebDocsMarkdown => { + let kind_and_type = format!("{kind}.{type_name}"); + + // TODO(andreas): We don't show blueprint components & archetypes in the web docs yet. + if scope == "blueprint" && (kind == "components" || kind == "archetypes") { + return Ok(kind_and_type); + } + // For instance, https://rerun.io/docs/reference/types/views/spatial2d_view // TODO(emilk): relative links would be nicer for the local markdown files let type_name_snake_case = re_case::to_snake_case(type_name); @@ -430,9 +437,9 @@ mod doclink_translation { "https://rerun.io/docs/reference/types/{kind}/{type_name_snake_case}{query}" ); if let Some(field_or_enum_name) = field_or_enum_name { - format!("[`{kind}.{type_name}#{field_or_enum_name}`]({url})") + format!("[`{kind_and_type}#{field_or_enum_name}`]({url})") } else { - format!("[`{kind}.{type_name}`]({url})") + format!("[`{kind_and_type}`]({url})") } } }) diff --git a/crates/store/re_types/src/reflection/mod.rs b/crates/store/re_types/src/reflection/mod.rs index ee95b1db1c8f..0484bec5fa73 100644 --- a/crates/store/re_types/src/reflection/mod.rs +++ b/crates/store/re_types/src/reflection/mod.rs @@ -222,7 +222,7 @@ fn generate_component_reflection() -> Result::name(), ComponentReflection { - docstring_md: "An individual query expression used to filter a set of [`datatypes.EntityPath`](https://rerun.io/docs/reference/types/datatypes/entity_path)s.\n\nEach expression is either an inclusion or an exclusion expression.\nInclusions start with an optional `+` and exclusions must start with a `-`.\n\nMultiple expressions are combined together as part of [`archetypes.ViewContents`](https://rerun.io/docs/reference/types/archetypes/view_contents).\n\nThe `/**` suffix matches the whole subtree, i.e. self and any child, recursively\n(`/world/**` matches both `/world` and `/world/car/driver`).\nOther uses of `*` are not (yet) supported.", + docstring_md: "An individual query expression used to filter a set of [`datatypes.EntityPath`](https://rerun.io/docs/reference/types/datatypes/entity_path)s.\n\nEach expression is either an inclusion or an exclusion expression.\nInclusions start with an optional `+` and exclusions must start with a `-`.\n\nMultiple expressions are combined together as part of archetypes.ViewContents.\n\nThe `/**` suffix matches the whole subtree, i.e. self and any child, recursively\n(`/world/**` matches both `/world` and `/world/car/driver`).\nOther uses of `*` are not (yet) supported.", custom_placeholder: Some(QueryExpression::default().to_arrow2()?), datatype: QueryExpression::arrow2_datatype(), }, @@ -1934,11 +1934,11 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { is_required : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.ColumnShare".into(), display_name : "Col shares", docstring_md : - "The layout shares of each column in the container.\n\nFor [`components.ContainerKind#Horizontal`](https://rerun.io/docs/reference/types/components/container_kind) containers, the length of this list should always match the number of contents.\n\nIgnored for [`components.ContainerKind#Vertical`](https://rerun.io/docs/reference/types/components/container_kind) containers.", + "The layout shares of each column in the container.\n\nFor components.ContainerKind containers, the length of this list should always match the number of contents.\n\nIgnored for components.ContainerKind containers.", is_required : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.RowShare".into(), display_name : "Row shares", docstring_md : - "The layout shares of each row of the container.\n\nFor [`components.ContainerKind#Vertical`](https://rerun.io/docs/reference/types/components/container_kind) containers, the length of this list should always match the number of contents.\n\nIgnored for [`components.ContainerKind#Horizontal`](https://rerun.io/docs/reference/types/components/container_kind) containers.", + "The layout shares of each row of the container.\n\nFor components.ContainerKind containers, the length of this list should always match the number of contents.\n\nIgnored for components.ContainerKind containers.", is_required : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.ActiveTab".into(), display_name : "Active tab", docstring_md : @@ -1950,7 +1950,7 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { is_required : false, }, ArchetypeFieldReflection { component_name : "rerun.blueprint.components.GridColumns".into(), display_name : "Grid columns", docstring_md : - "How many columns this grid should have.\n\nIf unset, the grid layout will be auto.\n\nIgnored for [`components.ContainerKind#Horizontal`](https://rerun.io/docs/reference/types/components/container_kind)/[`components.ContainerKind#Vertical`](https://rerun.io/docs/reference/types/components/container_kind) containers.", + "How many columns this grid should have.\n\nIf unset, the grid layout will be auto.\n\nIgnored for components.ContainerKind/components.ContainerKind containers.", is_required : false, }, ], }, From e1aea95ec90ac9f1b32d23bb1aa556f8c1edfdf2 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Thu, 12 Dec 2024 16:36:12 +0100 Subject: [PATCH 49/71] Fix broken notebook loading on firefox by compressing the encoded wasm payload (#8426) ### Related - Resolves: https://github.com/rerun-io/rerun/issues/8154 ### What It turns out firefox doesn't let you create a dataurl larger than 32MB. Although our `.wasm` was under this threshold, the overhead of base64-encoding pushed us over the threshold. However, as we were encoding the raw, uncompressed .wasm, we still actually have plenty of margin... we just need to jump through more hoops to use it now. Using DecompressionStream like this seems to be generally available across our target browsers so I think we should be good? --- rerun_js/web-viewer/bundle.mjs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/rerun_js/web-viewer/bundle.mjs b/rerun_js/web-viewer/bundle.mjs index c93feaf232b1..ac79ec9611f8 100644 --- a/rerun_js/web-viewer/bundle.mjs +++ b/rerun_js/web-viewer/bundle.mjs @@ -6,12 +6,13 @@ import { fileURLToPath } from "node:url"; import * as path from "node:path"; import * as fs from "node:fs"; +import * as zlib from "node:zlib"; import * as util from "node:util"; const __filename = path.resolve(fileURLToPath(import.meta.url)); const __dirname = path.dirname(__filename); -const wasm = fs.readFileSync(path.join(__dirname, "re_viewer_bg.wasm")); +const wasm = zlib.gzipSync(fs.readFileSync(path.join(__dirname, "re_viewer_bg.wasm"))); const js = fs.readFileSync(path.join(__dirname, "re_viewer.js"), "utf-8"); const index = fs.readFileSync(path.join(__dirname, "index.js"), "utf-8"); @@ -19,12 +20,17 @@ const INLINE_MARKER = "/**/"; /** @param {Buffer} buffer */ function buffer_to_data_url(buffer) { - return `data:application/wasm;base64,${buffer.toString("base64")}`; + return `data:application/octet-stream;gzip;base64,${buffer.toString("base64")}`; } -async function data_url_to_buffer(dataUrl) { - const response = await fetch(dataUrl); - return response.arrayBuffer(); +async function compressed_data_url_to_buffer(dataUrl) { + const response = await fetch(dataUrl); + const blob = await response.blob(); + + let ds = new DecompressionStream("gzip"); + let decompressedStream = blob.stream().pipeThrough(ds); + + return new Response(decompressedStream).arrayBuffer(); } const inlined_js = js.replace("export default function", "return function"); @@ -35,9 +41,9 @@ async function fetch_viewer_js() { } async function fetch_viewer_wasm() { - ${data_url_to_buffer.toString()} + ${compressed_data_url_to_buffer.toString()} const dataUrl = ${JSON.stringify(buffer_to_data_url(wasm))}; - const buffer = await data_url_to_buffer(dataUrl); + const buffer = await compressed_data_url_to_buffer(dataUrl); return new Response(buffer, { "headers": { "Content-Type": "application/wasm" } }); } `; From abccbe45e62c494dbb1046bab55cbf3fe421b106 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Thu, 12 Dec 2024 16:53:25 +0100 Subject: [PATCH 50/71] Improved reflection (#8432) Misc improvements to the reflection that I had to implement while investigating forward-compat, migration scripts, etc. --- .../src/codegen/rust/reflection.rs | 12 +- crates/store/re_types/src/reflection/mod.rs | 1392 +++++++++-------- crates/store/re_types_core/src/reflection.rs | 12 +- 3 files changed, 755 insertions(+), 661 deletions(-) diff --git a/crates/build/re_types_builder/src/codegen/rust/reflection.rs b/crates/build/re_types_builder/src/codegen/rust/reflection.rs index c3c7739001a1..4ab765164698 100644 --- a/crates/build/re_types_builder/src/codegen/rust/reflection.rs +++ b/crates/build/re_types_builder/src/codegen/rust/reflection.rs @@ -178,6 +178,7 @@ fn generate_archetype_reflection(reporter: &Reporter, objects: &Objects) -> Toke let Some(component_name) = field.typ.fqname() else { panic!("archetype field must be an object/union or an array/vector of such") }; + let name = &field.name; let display_name = re_case::to_human_case(&field.name); let docstring_md = doc_as_lines( reporter, @@ -193,8 +194,9 @@ fn generate_archetype_reflection(reporter: &Reporter, objects: &Objects) -> Toke quote! { ArchetypeFieldReflection { - component_name: #component_name.into(), + name: #name, display_name: #display_name, + component_name: #component_name.into(), docstring_md: #docstring_md, is_required: #required, } @@ -220,6 +222,12 @@ fn generate_archetype_reflection(reporter: &Reporter, objects: &Objects) -> Toke .join("\n"); } + let scope = if let Some(scope) = obj.scope() { + quote!(Some(#scope)) + } else { + quote!(None) + }; + let quoted_view_types = obj .archetype_view_types() .unwrap_or_default() @@ -234,6 +242,8 @@ fn generate_archetype_reflection(reporter: &Reporter, objects: &Objects) -> Toke ArchetypeReflection { display_name: #display_name, + scope: #scope, + view_types: &[ #(#quoted_view_types,)* ], diff --git a/crates/store/re_types/src/reflection/mod.rs b/crates/store/re_types/src/reflection/mod.rs index 0484bec5fa73..13a12e4af4fb 100644 --- a/crates/store/re_types/src/reflection/mod.rs +++ b/crates/store/re_types/src/reflection/mod.rs @@ -936,11 +936,12 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.AnnotationContext"), ArchetypeReflection { display_name: "Annotation context", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.AnnotationContext".into(), display_name : - "Context", docstring_md : + ArchetypeFieldReflection { name : "context", display_name : + "Context", component_name : "rerun.components.AnnotationContext" + .into(), docstring_md : "List of class descriptions, mapping class indices to class names, colors etc.", is_required : true, }, ], @@ -950,37 +951,38 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Arrows2D"), ArchetypeReflection { display_name: "Arrows 2D", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.Vector2D".into(), display_name : "Vectors", + ArchetypeFieldReflection { name : "vectors", display_name : + "Vectors", component_name : "rerun.components.Vector2D".into(), docstring_md : "All the vectors for each arrow in the batch.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Position2D".into(), display_name : "Origins", - docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : "origins", + display_name : "Origins", component_name : + "rerun.components.Position2D".into(), docstring_md : "All the origin (base) positions for each arrow in the batch.\n\nIf no origins are set, (0, 0) is used as the origin for each arrow.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "radii", + display_name : "Radii", component_name : "rerun.components.Radius" + .into(), docstring_md : "Optional radii for the arrows.\n\nThe shaft is rendered as a line with `radius = 0.5 * radius`.\nThe tip is rendered with `height = 2.0 * radius` and `radius = 1.0 * radius`.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the points.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the points.", + is_required : false, }, ArchetypeFieldReflection { name : "labels", + display_name : "Labels", component_name : "rerun.components.Text" + .into(), docstring_md : "Optional text labels for the arrows.\n\nIf there's a single label present, it will be placed at the center of the entity.\nOtherwise, each instance will have its own label.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.DrawOrder".into(), display_name : "Draw order", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "draw_order", display_name : "Draw order", component_name : + "rerun.components.DrawOrder".into(), docstring_md : "An optional floating point value that specifies the 2D drawing order.\n\nObjects with higher values are drawn on top of those with lower values.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional class Ids for the points.\n\nThe [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) provides colors and labels if not specified explicitly.", is_required : false, }, ], @@ -990,33 +992,34 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Arrows3D"), ArchetypeReflection { display_name: "Arrows 3D", + scope: None, view_types: &["Spatial3DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.Vector3D".into(), display_name : "Vectors", + ArchetypeFieldReflection { name : "vectors", display_name : + "Vectors", component_name : "rerun.components.Vector3D".into(), docstring_md : "All the vectors for each arrow in the batch.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Position3D".into(), display_name : "Origins", - docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : "origins", + display_name : "Origins", component_name : + "rerun.components.Position3D".into(), docstring_md : "All the origin (base) positions for each arrow in the batch.\n\nIf no origins are set, (0, 0, 0) is used as the origin for each arrow.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "radii", + display_name : "Radii", component_name : "rerun.components.Radius" + .into(), docstring_md : "Optional radii for the arrows.\n\nThe shaft is rendered as a line with `radius = 0.5 * radius`.\nThe tip is rendered with `height = 2.0 * radius` and `radius = 1.0 * radius`.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the points.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the points.", + is_required : false, }, ArchetypeFieldReflection { name : "labels", + display_name : "Labels", component_name : "rerun.components.Text" + .into(), docstring_md : "Optional text labels for the arrows.\n\nIf there's a single label present, it will be placed at the center of the entity.\nOtherwise, each instance will have its own label.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional class Ids for the points.\n\nThe [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) provides colors and labels if not specified explicitly.", is_required : false, }, ], @@ -1026,17 +1029,18 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Asset3D"), ArchetypeReflection { display_name: "Asset 3D", + scope: None, view_types: &["Spatial3DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : "rerun.components.Blob" - .into(), display_name : "Blob", docstring_md : "The asset's bytes.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.MediaType".into(), display_name : "Media type", - docstring_md : + ArchetypeFieldReflection { name : "blob", display_name : "Blob", + component_name : "rerun.components.Blob".into(), docstring_md : + "The asset's bytes.", is_required : true, }, ArchetypeFieldReflection + { name : "media_type", display_name : "Media type", component_name : + "rerun.components.MediaType".into(), docstring_md : "The Media Type of the asset.\n\nSupported values:\n* `model/gltf-binary`\n* `model/gltf+json`\n* `model/obj` (.mtl material files are not supported yet, references are silently ignored)\n* `model/stl`\n\nIf omitted, the viewer will try to guess from the data blob.\nIf it cannot guess, it won't be able to render the asset.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.AlbedoFactor".into(), display_name : - "Albedo factor", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "albedo_factor", display_name : "Albedo factor", component_name : + "rerun.components.AlbedoFactor".into(), docstring_md : "A color multiplier applied to the whole asset.\n\nFor mesh who already have `albedo_factor` in materials,\nit will be overwritten by actual `albedo_factor` of [`archetypes.Asset3D`](https://rerun.io/docs/reference/types/archetypes/asset3d) (if specified).", is_required : false, }, ], @@ -1046,13 +1050,14 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.AssetVideo"), ArchetypeReflection { display_name: "Asset video", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : "rerun.components.Blob" - .into(), display_name : "Blob", docstring_md : "The asset's bytes.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.MediaType".into(), display_name : "Media type", - docstring_md : + ArchetypeFieldReflection { name : "blob", display_name : "Blob", + component_name : "rerun.components.Blob".into(), docstring_md : + "The asset's bytes.", is_required : true, }, ArchetypeFieldReflection + { name : "media_type", display_name : "Media type", component_name : + "rerun.components.MediaType".into(), docstring_md : "The Media Type of the asset.\n\nSupported values:\n* `video/mp4`\n\nIf omitted, the viewer will try to guess from the data blob.\nIf it cannot guess, it won't be able to render the asset.", is_required : false, }, ], @@ -1062,15 +1067,16 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.BarChart"), ArchetypeReflection { display_name: "Bar chart", + scope: None, view_types: &["BarChartView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.TensorData".into(), display_name : "Values", - docstring_md : + ArchetypeFieldReflection { name : "values", display_name : "Values", + component_name : "rerun.components.TensorData".into(), docstring_md : "The values. Should always be a 1-dimensional tensor (i.e. a vector).", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Color", docstring_md - : "The color of the bar chart", is_required : false, }, + is_required : true, }, ArchetypeFieldReflection { name : "color", + display_name : "Color", component_name : "rerun.components.Color" + .into(), docstring_md : "The color of the bar chart", is_required : + false, }, ], }, ), @@ -1078,36 +1084,37 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Boxes2D"), ArchetypeReflection { display_name: "Boxes 2D", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.HalfSize2D".into(), display_name : "Half sizes", + ArchetypeFieldReflection { name : "half_sizes", display_name : + "Half sizes", component_name : "rerun.components.HalfSize2D".into(), docstring_md : "All half-extents that make up the batch of boxes.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Position2D".into(), display_name : "Centers", - docstring_md : "Optional center positions of the boxes.", is_required - : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the boxes.", is_required : false, - }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", - docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : "centers", + display_name : "Centers", component_name : + "rerun.components.Position2D".into(), docstring_md : + "Optional center positions of the boxes.", is_required : false, }, + ArchetypeFieldReflection { name : "colors", display_name : "Colors", + component_name : "rerun.components.Color".into(), docstring_md : + "Optional colors for the boxes.", is_required : false, }, + ArchetypeFieldReflection { name : "radii", display_name : "Radii", + component_name : "rerun.components.Radius".into(), docstring_md : "Optional radii for the lines that make up the boxes.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : - "Optional text labels for the boxes.\n\nIf there's a single label present, it will be placed at the center of the entity.\nOtherwise, each instance will have its own label.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", + false, }, ArchetypeFieldReflection { name : "labels", display_name : + "Labels", component_name : "rerun.components.Text".into(), docstring_md : + "Optional text labels for the boxes.\n\nIf there's a single label present, it will be placed at the center of the entity.\nOtherwise, each instance will have its own label.", + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.DrawOrder".into(), display_name : "Draw order", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "draw_order", display_name : "Draw order", component_name : + "rerun.components.DrawOrder".into(), docstring_md : "An optional floating point value that specifies the 2D drawing order.\n\nObjects with higher values are drawn on top of those with lower values.\n\nThe default for 2D boxes is 10.0.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id)s for the boxes.\n\nThe [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) provides colors and labels if not specified explicitly.", is_required : false, }, ], @@ -1117,45 +1124,47 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Boxes3D"), ArchetypeReflection { display_name: "Boxes 3D", + scope: None, view_types: &["Spatial3DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.HalfSize3D".into(), display_name : "Half sizes", + ArchetypeFieldReflection { name : "half_sizes", display_name : + "Half sizes", component_name : "rerun.components.HalfSize3D".into(), docstring_md : "All half-extents that make up the batch of boxes.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseTranslation3D".into(), display_name : - "Centers", docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : "centers", + display_name : "Centers", component_name : + "rerun.components.PoseTranslation3D".into(), docstring_md : "Optional center positions of the boxes.\n\nIf not specified, the centers will be at (0, 0, 0).\nNote that this uses a [`components.PoseTranslation3D`](https://rerun.io/docs/reference/types/components/pose_translation3d) which is also used by [`archetypes.InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseRotationAxisAngle".into(), display_name : - "Rotation axis angles", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "rotation_axis_angles", display_name : "Rotation axis angles", + component_name : "rerun.components.PoseRotationAxisAngle".into(), + docstring_md : "Rotations via axis + angle.\n\nIf no rotation is specified, the axes of the boxes align with the axes of the local coordinate system.\nNote that this uses a [`components.PoseRotationAxisAngle`](https://rerun.io/docs/reference/types/components/pose_rotation_axis_angle) which is also used by [`archetypes.InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseRotationQuat".into(), display_name : - "Quaternions", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "quaternions", display_name : "Quaternions", component_name : + "rerun.components.PoseRotationQuat".into(), docstring_md : "Rotations via quaternion.\n\nIf no rotation is specified, the axes of the boxes align with the axes of the local coordinate system.\nNote that this uses a [`components.PoseRotationQuat`](https://rerun.io/docs/reference/types/components/pose_rotation_quat) which is also used by [`archetypes.InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the boxes.", is_required : false, - }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the boxes.", is_required + : false, }, ArchetypeFieldReflection { name : "radii", display_name : + "Radii", component_name : "rerun.components.Radius".into(), docstring_md : "Optional radii for the lines that make up the boxes.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.FillMode".into(), display_name : "Fill mode", + false, }, ArchetypeFieldReflection { name : "fill_mode", display_name + : "Fill mode", component_name : "rerun.components.FillMode".into(), docstring_md : "Optionally choose whether the boxes are drawn with lines or solid.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : + is_required : false, }, ArchetypeFieldReflection { name : "labels", + display_name : "Labels", component_name : "rerun.components.Text" + .into(), docstring_md : "Optional text labels for the boxes.\n\nIf there's a single label present, it will be placed at the center of the entity.\nOtherwise, each instance will have its own label.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id)s for the boxes.\n\nThe [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) provides colors and labels if not specified explicitly.", is_required : false, }, ], @@ -1165,40 +1174,43 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Capsules3D"), ArchetypeReflection { display_name: "Capsules 3D", + scope: None, view_types: &["Spatial3DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : "rerun.components.Length" - .into(), display_name : "Lengths", docstring_md : + ArchetypeFieldReflection { name : "lengths", display_name : + "Lengths", component_name : "rerun.components.Length".into(), + docstring_md : "Lengths of the capsules, defined as the distance between the centers of the endcaps.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", - docstring_md : "Radii of the capsules.", is_required : true, }, - ArchetypeFieldReflection { component_name : - "rerun.components.PoseTranslation3D".into(), display_name : - "Translations", docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : "radii", + display_name : "Radii", component_name : "rerun.components.Radius" + .into(), docstring_md : "Radii of the capsules.", is_required : true, + }, ArchetypeFieldReflection { name : "translations", display_name : + "Translations", component_name : "rerun.components.PoseTranslation3D" + .into(), docstring_md : "Optional translations of the capsules.\n\nIf not specified, one end of each capsule will be at (0, 0, 0).\nNote that this uses a [`components.PoseTranslation3D`](https://rerun.io/docs/reference/types/components/pose_translation3d) which is also used by [`archetypes.InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseRotationAxisAngle".into(), display_name : - "Rotation axis angles", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "rotation_axis_angles", display_name : "Rotation axis angles", + component_name : "rerun.components.PoseRotationAxisAngle".into(), + docstring_md : "Rotations via axis + angle.\n\nIf no rotation is specified, the capsules align with the +Z axis of the local coordinate system.\nNote that this uses a [`components.PoseRotationAxisAngle`](https://rerun.io/docs/reference/types/components/pose_rotation_axis_angle) which is also used by [`archetypes.InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseRotationQuat".into(), display_name : - "Quaternions", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "quaternions", display_name : "Quaternions", component_name : + "rerun.components.PoseRotationQuat".into(), docstring_md : "Rotations via quaternion.\n\nIf no rotation is specified, the capsules align with the +Z axis of the local coordinate system.\nNote that this uses a [`components.PoseRotationQuat`](https://rerun.io/docs/reference/types/components/pose_rotation_quat) which is also used by [`archetypes.InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the capsules.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the capsules.", + is_required : false, }, ArchetypeFieldReflection { name : "labels", + display_name : "Labels", component_name : "rerun.components.Text" + .into(), docstring_md : "Optional text labels for the capsules, which will be located at their centers.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional class ID for the ellipsoids.\n\nThe class ID provides colors and labels if not specified explicitly.", is_required : false, }, ], @@ -1208,11 +1220,12 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Clear"), ArchetypeReflection { display_name: "Clear", + scope: None, view_types: &["Spatial2DView", "Spatial3DView", "TimeSeriesView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.ClearIsRecursive".into(), display_name : - "Is recursive", docstring_md : "", is_required : true, }, + ArchetypeFieldReflection { name : "is_recursive", display_name : + "Is recursive", component_name : "rerun.components.ClearIsRecursive" + .into(), docstring_md : "", is_required : true, }, ], }, ), @@ -1220,33 +1233,33 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.DepthImage"), ArchetypeReflection { display_name: "Depth image", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.ImageBuffer".into(), display_name : "Buffer", - docstring_md : "The raw depth image data.", is_required : true, }, - ArchetypeFieldReflection { component_name : - "rerun.components.ImageFormat".into(), display_name : "Format", - docstring_md : "The format of the image.", is_required : true, }, - ArchetypeFieldReflection { component_name : - "rerun.components.DepthMeter".into(), display_name : "Meter", - docstring_md : + ArchetypeFieldReflection { name : "buffer", display_name : "Buffer", + component_name : "rerun.components.ImageBuffer".into(), docstring_md + : "The raw depth image data.", is_required : true, }, + ArchetypeFieldReflection { name : "format", display_name : "Format", + component_name : "rerun.components.ImageFormat".into(), docstring_md + : "The format of the image.", is_required : true, }, + ArchetypeFieldReflection { name : "meter", display_name : "Meter", + component_name : "rerun.components.DepthMeter".into(), docstring_md : "An optional floating point value that specifies how long a meter is in the native depth units.\n\nFor instance: with uint16, perhaps meter=1000 which would mean you have millimeter precision\nand a range of up to ~65 meters (2^16 / 1000).\n\nNote that the only effect on 2D views is the physical depth values shown when hovering the image.\nIn 3D views on the other hand, this affects where the points of the point cloud are placed.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Colormap".into(), display_name : "Colormap", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "colormap", + display_name : "Colormap", component_name : + "rerun.components.Colormap".into(), docstring_md : "Colormap to use for rendering the depth image.\n\nIf not set, the depth image will be rendered using the Turbo colormap.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ValueRange".into(), display_name : "Depth range", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "depth_range", display_name : "Depth range", component_name : + "rerun.components.ValueRange".into(), docstring_md : "The expected range of depth values.\n\nThis is typically the expected range of valid values.\nEverything outside of the range is clamped to the range for the purpose of colormpaping.\nNote that point clouds generated from this image will still display all points, regardless of this range.\n\nIf not specified, the range will be automatically estimated from the data.\nNote that the Viewer may try to guess a wider range than the minimum/maximum of values\nin the contents of the depth image.\nE.g. if all values are positive, some bigger than 1.0 and all smaller than 255.0,\nthe Viewer will guess that the data likely came from an 8bit image, thus assuming a range of 0-255.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.FillRatio".into(), display_name : - "Point fill ratio", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "point_fill_ratio", display_name : "Point fill ratio", component_name + : "rerun.components.FillRatio".into(), docstring_md : "Scale the radii of the points in the point cloud generated from this image.\n\nA fill ratio of 1.0 (the default) means that each point is as big as to touch the center of its neighbor\nif it is at the same depth, leaving no gaps.\nA fill ratio of 0.5 means that each point touches the edge of its neighbor if it has the same depth.\n\nTODO(#6744): This applies only to 3D views!", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.DrawOrder".into(), display_name : "Draw order", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "draw_order", display_name : "Draw order", component_name : + "rerun.components.DrawOrder".into(), docstring_md : "An optional floating point value that specifies the 2D drawing order, used only if the depth image is shown as a 2D image.\n\nObjects with higher values are drawn on top of those with lower values.", is_required : false, }, ], @@ -1256,11 +1269,12 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.DisconnectedSpace"), ArchetypeReflection { display_name: "Disconnected space", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.DisconnectedSpace".into(), display_name : - "Disconnected space", docstring_md : + ArchetypeFieldReflection { name : "disconnected_space", display_name + : "Disconnected space", component_name : + "rerun.components.DisconnectedSpace".into(), docstring_md : "Whether the entity path at which this is logged is disconnected from its parent.", is_required : true, }, ], @@ -1270,45 +1284,47 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Ellipsoids3D"), ArchetypeReflection { display_name: "Ellipsoids 3D", + scope: None, view_types: &["Spatial3DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.HalfSize3D".into(), display_name : "Half sizes", + ArchetypeFieldReflection { name : "half_sizes", display_name : + "Half sizes", component_name : "rerun.components.HalfSize3D".into(), docstring_md : "For each ellipsoid, half of its size on its three axes.\n\nIf all components are equal, then it is a sphere with that radius.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseTranslation3D".into(), display_name : - "Centers", docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : "centers", + display_name : "Centers", component_name : + "rerun.components.PoseTranslation3D".into(), docstring_md : "Optional center positions of the ellipsoids.\n\nIf not specified, the centers will be at (0, 0, 0).\nNote that this uses a [`components.PoseTranslation3D`](https://rerun.io/docs/reference/types/components/pose_translation3d) which is also used by [`archetypes.InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseRotationAxisAngle".into(), display_name : - "Rotation axis angles", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "rotation_axis_angles", display_name : "Rotation axis angles", + component_name : "rerun.components.PoseRotationAxisAngle".into(), + docstring_md : "Rotations via axis + angle.\n\nIf no rotation is specified, the axes of the ellipsoid align with the axes of the local coordinate system.\nNote that this uses a [`components.PoseRotationAxisAngle`](https://rerun.io/docs/reference/types/components/pose_rotation_axis_angle) which is also used by [`archetypes.InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseRotationQuat".into(), display_name : - "Quaternions", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "quaternions", display_name : "Quaternions", component_name : + "rerun.components.PoseRotationQuat".into(), docstring_md : "Rotations via quaternion.\n\nIf no rotation is specified, the axes of the ellipsoid align with the axes of the local coordinate system.\nNote that this uses a [`components.PoseRotationQuat`](https://rerun.io/docs/reference/types/components/pose_rotation_quat) which is also used by [`archetypes.InstancePoses3D`](https://rerun.io/docs/reference/types/archetypes/instance_poses3d).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the ellipsoids.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Line radii", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the ellipsoids.", + is_required : false, }, ArchetypeFieldReflection { name : + "line_radii", display_name : "Line radii", component_name : + "rerun.components.Radius".into(), docstring_md : "Optional radii for the lines used when the ellipsoid is rendered as a wireframe.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.FillMode".into(), display_name : "Fill mode", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "fill_mode", display_name : "Fill mode", component_name : + "rerun.components.FillMode".into(), docstring_md : "Optionally choose whether the ellipsoids are drawn with lines or solid.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : "Optional text labels for the ellipsoids.", is_required : false, }, - ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "labels", + display_name : "Labels", component_name : "rerun.components.Text" + .into(), docstring_md : "Optional text labels for the ellipsoids.", + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional class ID for the ellipsoids.\n\nThe class ID provides colors and labels if not specified explicitly.", is_required : false, }, ], @@ -1318,22 +1334,23 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.EncodedImage"), ArchetypeReflection { display_name: "Encoded image", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : "rerun.components.Blob" - .into(), display_name : "Blob", docstring_md : + ArchetypeFieldReflection { name : "blob", display_name : "Blob", + component_name : "rerun.components.Blob".into(), docstring_md : "The encoded content of some image file, e.g. a PNG or JPEG.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.MediaType".into(), display_name : "Media type", - docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : + "media_type", display_name : "Media type", component_name : + "rerun.components.MediaType".into(), docstring_md : "The Media Type of the asset.\n\nSupported values:\n* `image/jpeg`\n* `image/png`\n\nIf omitted, the viewer will try to guess from the data blob.\nIf it cannot guess, it won't be able to render the asset.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Opacity".into(), display_name : "Opacity", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "opacity", + display_name : "Opacity", component_name : "rerun.components.Opacity" + .into(), docstring_md : "Opacity of the image, useful for layering several images.\n\nDefaults to 1.0 (fully opaque).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.DrawOrder".into(), display_name : "Draw order", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "draw_order", display_name : "Draw order", component_name : + "rerun.components.DrawOrder".into(), docstring_md : "An optional floating point value that specifies the 2D drawing order.\n\nObjects with higher values are drawn on top of those with lower values.", is_required : false, }, ], @@ -1343,20 +1360,21 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.GeoLineStrings"), ArchetypeReflection { display_name: "Geo line strings", + scope: None, view_types: &["MapView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.GeoLineString".into(), display_name : - "Line strings", docstring_md : + ArchetypeFieldReflection { name : "line_strings", display_name : + "Line strings", component_name : "rerun.components.GeoLineString" + .into(), docstring_md : "The line strings, expressed in [EPSG:4326](https://epsg.io/4326) coordinates (North/East-positive degrees).", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", - docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : "radii", + display_name : "Radii", component_name : "rerun.components.Radius" + .into(), docstring_md : "Optional radii for the line strings.\n\n*Note*: scene units radiii are interpreted as meters. Currently, the display scale only considers the latitude of\nthe first vertex of each line string (see [this issue](https://github.com/rerun-io/rerun/issues/8013)).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the line strings.", is_required : - false, }, + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the line strings.", + is_required : false, }, ], }, ), @@ -1364,21 +1382,23 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.GeoPoints"), ArchetypeReflection { display_name: "Geo points", + scope: None, view_types: &["MapView"], fields: vec![ - ArchetypeFieldReflection { component_name : "rerun.components.LatLon" - .into(), display_name : "Positions", docstring_md : - "The [EPSG:4326](https://epsg.io/4326) coordinates for the points (North/East-positive degrees).", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", + ArchetypeFieldReflection { name : "positions", display_name : + "Positions", component_name : "rerun.components.LatLon".into(), docstring_md : + "The [EPSG:4326](https://epsg.io/4326) coordinates for the points (North/East-positive degrees).", + is_required : true, }, ArchetypeFieldReflection { name : "radii", + display_name : "Radii", component_name : "rerun.components.Radius" + .into(), docstring_md : "Optional radii for the points, effectively turning them into circles.\n\n*Note*: scene units radiii are interpreted as meters.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the points.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the points.", + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional class Ids for the points.\n\nThe [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) provides colors if not specified explicitly.", is_required : false, }, ], @@ -1388,15 +1408,15 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.GraphEdges"), ArchetypeReflection { display_name: "Graph edges", + scope: None, view_types: &["GraphView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.GraphEdge".into(), display_name : "Edges", - docstring_md : + ArchetypeFieldReflection { name : "edges", display_name : "Edges", + component_name : "rerun.components.GraphEdge".into(), docstring_md : "A list of node tuples.\n\n⚠\u{fe0f} **This type is experimental and may be removed in future versions**", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.GraphType".into(), display_name : "Graph type", - docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : + "graph_type", display_name : "Graph type", component_name : + "rerun.components.GraphType".into(), docstring_md : "Specifies if the graph is directed or undirected.\n\nIf no [`components.GraphType`](https://rerun.io/docs/reference/types/components/graph_type?speculative-link) is provided, the graph is assumed to be undirected.\n\n⚠\u{fe0f} **This type is experimental and may be removed in future versions**", is_required : false, }, ], @@ -1406,31 +1426,32 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.GraphNodes"), ArchetypeReflection { display_name: "Graph nodes", + scope: None, view_types: &["GraphView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.GraphNode".into(), display_name : "Node ids", + ArchetypeFieldReflection { name : "node_ids", display_name : + "Node ids", component_name : "rerun.components.GraphNode".into(), docstring_md : "A list of node IDs.\n\n⚠\u{fe0f} **This type is experimental and may be removed in future versions**", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Position2D".into(), display_name : "Positions", - docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : "positions", + display_name : "Positions", component_name : + "rerun.components.Position2D".into(), docstring_md : "Optional center positions of the nodes.\n\n⚠\u{fe0f} **This type is experimental and may be removed in future versions**", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the boxes.\n\n⚠\u{fe0f} **This type is experimental and may be removed in future versions**", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : + is_required : false, }, ArchetypeFieldReflection { name : "labels", + display_name : "Labels", component_name : "rerun.components.Text" + .into(), docstring_md : "Optional text labels for the node.\n\n⚠\u{fe0f} **This type is experimental and may be removed in future versions**", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.\n\n⚠\u{fe0f} **This type is experimental and may be removed in future versions**", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "radii", + display_name : "Radii", component_name : "rerun.components.Radius" + .into(), docstring_md : "Optional radii for nodes.\n\n⚠\u{fe0f} **This type is experimental and may be removed in future versions**", is_required : false, }, ], @@ -1440,21 +1461,22 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Image"), ArchetypeReflection { display_name: "Image", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.ImageBuffer".into(), display_name : "Buffer", - docstring_md : "The raw image data.", is_required : true, }, - ArchetypeFieldReflection { component_name : - "rerun.components.ImageFormat".into(), display_name : "Format", - docstring_md : "The format of the image.", is_required : true, }, - ArchetypeFieldReflection { component_name : - "rerun.components.Opacity".into(), display_name : "Opacity", + ArchetypeFieldReflection { name : "buffer", display_name : "Buffer", + component_name : "rerun.components.ImageBuffer".into(), docstring_md + : "The raw image data.", is_required : true, }, + ArchetypeFieldReflection { name : "format", display_name : "Format", + component_name : "rerun.components.ImageFormat".into(), docstring_md + : "The format of the image.", is_required : true, }, + ArchetypeFieldReflection { name : "opacity", display_name : + "Opacity", component_name : "rerun.components.Opacity".into(), docstring_md : "Opacity of the image, useful for layering several images.\n\nDefaults to 1.0 (fully opaque).", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.DrawOrder".into(), display_name : "Draw order", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "draw_order", display_name : "Draw order", component_name : + "rerun.components.DrawOrder".into(), docstring_md : "An optional floating point value that specifies the 2D drawing order.\n\nObjects with higher values are drawn on top of those with lower values.", is_required : false, }, ], @@ -1464,24 +1486,26 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.InstancePoses3D"), ArchetypeReflection { display_name: "Instance poses 3D", + scope: None, view_types: &["Spatial3DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.PoseTranslation3D".into(), display_name : - "Translations", docstring_md : "Translation vectors.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseRotationAxisAngle".into(), display_name : - "Rotation axis angles", docstring_md : "Rotations via axis + angle.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseRotationQuat".into(), display_name : - "Quaternions", docstring_md : "Rotations via quaternion.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.PoseScale3D".into(), display_name : "Scales", + ArchetypeFieldReflection { name : "translations", display_name : + "Translations", component_name : "rerun.components.PoseTranslation3D" + .into(), docstring_md : "Translation vectors.", is_required : false, + }, ArchetypeFieldReflection { name : "rotation_axis_angles", + display_name : "Rotation axis angles", component_name : + "rerun.components.PoseRotationAxisAngle".into(), docstring_md : + "Rotations via axis + angle.", is_required : false, }, + ArchetypeFieldReflection { name : "quaternions", display_name : + "Quaternions", component_name : "rerun.components.PoseRotationQuat" + .into(), docstring_md : "Rotations via quaternion.", is_required : + false, }, ArchetypeFieldReflection { name : "scales", display_name : + "Scales", component_name : "rerun.components.PoseScale3D".into(), docstring_md : "Scaling factors.", is_required : false, }, - ArchetypeFieldReflection { component_name : - "rerun.components.PoseTransformMat3x3".into(), display_name : - "Mat 3x 3", docstring_md : "3x3 transformation matrices.", - is_required : false, }, + ArchetypeFieldReflection { name : "mat3x3", display_name : + "Mat 3x 3", component_name : "rerun.components.PoseTransformMat3x3" + .into(), docstring_md : "3x3 transformation matrices.", is_required : + false, }, ], }, ), @@ -1489,33 +1513,33 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.LineStrips2D"), ArchetypeReflection { display_name: "Line strips 2D", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.LineStrip2D".into(), display_name : "Strips", - docstring_md : - "All the actual 2D line strips that make up the batch.", is_required - : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", - docstring_md : "Optional radii for the line strips.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the line strips.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : + ArchetypeFieldReflection { name : "strips", display_name : "Strips", + component_name : "rerun.components.LineStrip2D".into(), docstring_md + : "All the actual 2D line strips that make up the batch.", + is_required : true, }, ArchetypeFieldReflection { name : "radii", + display_name : "Radii", component_name : "rerun.components.Radius" + .into(), docstring_md : "Optional radii for the line strips.", + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the line strips.", + is_required : false, }, ArchetypeFieldReflection { name : "labels", + display_name : "Labels", component_name : "rerun.components.Text" + .into(), docstring_md : "Optional text labels for the line strips.\n\nIf there's a single label present, it will be placed at the center of the entity.\nOtherwise, each instance will have its own label.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.DrawOrder".into(), display_name : "Draw order", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "draw_order", display_name : "Draw order", component_name : + "rerun.components.DrawOrder".into(), docstring_md : "An optional floating point value that specifies the 2D drawing order of each line strip.\n\nObjects with higher values are drawn on top of those with lower values.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id)s for the lines.\n\nThe [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) provides colors and labels if not specified explicitly.", is_required : false, }, ], @@ -1525,29 +1549,29 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.LineStrips3D"), ArchetypeReflection { display_name: "Line strips 3D", + scope: None, view_types: &["Spatial3DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.LineStrip3D".into(), display_name : "Strips", - docstring_md : - "All the actual 3D line strips that make up the batch.", is_required - : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", - docstring_md : "Optional radii for the line strips.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the line strips.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : + ArchetypeFieldReflection { name : "strips", display_name : "Strips", + component_name : "rerun.components.LineStrip3D".into(), docstring_md + : "All the actual 3D line strips that make up the batch.", + is_required : true, }, ArchetypeFieldReflection { name : "radii", + display_name : "Radii", component_name : "rerun.components.Radius" + .into(), docstring_md : "Optional radii for the line strips.", + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the line strips.", + is_required : false, }, ArchetypeFieldReflection { name : "labels", + display_name : "Labels", component_name : "rerun.components.Text" + .into(), docstring_md : "Optional text labels for the line strips.\n\nIf there's a single label present, it will be placed at the center of the entity.\nOtherwise, each instance will have its own label.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id)s for the lines.\n\nThe [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) provides colors and labels if not specified explicitly.", is_required : false, }, ], @@ -1557,40 +1581,42 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Mesh3D"), ArchetypeReflection { display_name: "Mesh 3D", + scope: None, view_types: &["Spatial3DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.Position3D".into(), display_name : - "Vertex positions", docstring_md : + ArchetypeFieldReflection { name : "vertex_positions", display_name : + "Vertex positions", component_name : "rerun.components.Position3D" + .into(), docstring_md : "The positions of each vertex.\n\nIf no `triangle_indices` are specified, then each triplet of positions is interpreted as a triangle.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.TriangleIndices".into(), display_name : - "Triangle indices", docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : + "triangle_indices", display_name : "Triangle indices", component_name + : "rerun.components.TriangleIndices".into(), docstring_md : "Optional indices for the triangles that make up the mesh.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Vector3D".into(), display_name : "Vertex normals", - docstring_md : "An optional normal for each vertex.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Vertex colors", + is_required : false, }, ArchetypeFieldReflection { name : + "vertex_normals", display_name : "Vertex normals", component_name : + "rerun.components.Vector3D".into(), docstring_md : + "An optional normal for each vertex.", is_required : false, }, + ArchetypeFieldReflection { name : "vertex_colors", display_name : + "Vertex colors", component_name : "rerun.components.Color".into(), docstring_md : "An optional color for each vertex.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Texcoord2D".into(), display_name : - "Vertex texcoords", docstring_md : + false, }, ArchetypeFieldReflection { name : "vertex_texcoords", + display_name : "Vertex texcoords", component_name : + "rerun.components.Texcoord2D".into(), docstring_md : "An optional uv texture coordinate for each vertex.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.AlbedoFactor".into(), display_name : - "Albedo factor", docstring_md : + false, }, ArchetypeFieldReflection { name : "albedo_factor", + display_name : "Albedo factor", component_name : + "rerun.components.AlbedoFactor".into(), docstring_md : "A color multiplier applied to the whole mesh.", is_required : false, - }, ArchetypeFieldReflection { component_name : - "rerun.components.ImageBuffer".into(), display_name : - "Albedo texture buffer", docstring_md : + }, ArchetypeFieldReflection { name : "albedo_texture_buffer", + display_name : "Albedo texture buffer", component_name : + "rerun.components.ImageBuffer".into(), docstring_md : "Optional albedo texture.\n\nUsed with the [`components.Texcoord2D`](https://rerun.io/docs/reference/types/components/texcoord2d) of the mesh.\n\nCurrently supports only sRGB(A) textures, ignoring alpha.\n(meaning that the tensor must have 3 or 4 channels and use the `u8` format)", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ImageFormat".into(), display_name : - "Albedo texture format", docstring_md : - "The format of the `albedo_texture_buffer`, if any.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", + is_required : false, }, ArchetypeFieldReflection { name : + "albedo_texture_format", display_name : "Albedo texture format", + component_name : "rerun.components.ImageFormat".into(), docstring_md + : "The format of the `albedo_texture_buffer`, if any.", is_required : + false, }, ArchetypeFieldReflection { name : "class_ids", display_name + : "Class ids", component_name : "rerun.components.ClassId".into(), docstring_md : "Optional class Ids for the vertices.\n\nThe [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) provides colors and labels if not specified explicitly.", is_required : false, }, @@ -1601,23 +1627,25 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Pinhole"), ArchetypeReflection { display_name: "Pinhole", + scope: None, view_types: &["Spatial2DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.PinholeProjection".into(), display_name : - "Image from camera", docstring_md : + ArchetypeFieldReflection { name : "image_from_camera", display_name : + "Image from camera", component_name : + "rerun.components.PinholeProjection".into(), docstring_md : "Camera projection, from image coordinates to view coordinates.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Resolution".into(), display_name : "Resolution", - docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : + "resolution", display_name : "Resolution", component_name : + "rerun.components.Resolution".into(), docstring_md : "Pixel resolution (usually integers) of child image space. Width and height.\n\nExample:\n```text\n[1920.0, 1440.0]\n```\n\n`image_from_camera` project onto the space spanned by `(0,0)` and `resolution - 1`.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ViewCoordinates".into(), display_name : - "Camera xyz", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "camera_xyz", display_name : "Camera xyz", component_name : + "rerun.components.ViewCoordinates".into(), docstring_md : "Sets the view coordinates for the camera.\n\nAll common values are available as constants on the [`components.ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates) class.\n\nThe default is `ViewCoordinates::RDF`, i.e. X=Right, Y=Down, Z=Forward, and this is also the recommended setting.\nThis means that the camera frustum will point along the positive Z axis of the parent space,\nand the cameras \"up\" direction will be along the negative Y axis of the parent space.\n\nThe camera frustum will point whichever axis is set to `F` (or the opposite of `B`).\nWhen logging a depth image under this entity, this is the direction the point cloud will be projected.\nWith `RDF`, the default forward is +Z.\n\nThe frustum's \"up\" direction will be whichever axis is set to `U` (or the opposite of `D`).\nThis will match the negative Y direction of pixel space (all images are assumed to have xyz=RDF).\nWith `RDF`, the default is up is -Y.\n\nThe frustum's \"right\" direction will be whichever axis is set to `R` (or the opposite of `L`).\nThis will match the positive X direction of pixel space (all images are assumed to have xyz=RDF).\nWith `RDF`, the default right is +x.\n\nOther common formats are `RUB` (X=Right, Y=Up, Z=Back) and `FLU` (X=Forward, Y=Left, Z=Up).\n\nNOTE: setting this to something else than `RDF` (the default) will change the orientation of the camera frustum,\nand make the pinhole matrix not match up with the coordinate system of the pinhole entity.\n\nThe pinhole matrix (the `image_from_camera` argument) always project along the third (Z) axis,\nbut will be re-oriented to project along the forward axis of the `camera_xyz` argument.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ImagePlaneDistance".into(), display_name : - "Image plane distance", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "image_plane_distance", display_name : "Image plane distance", + component_name : "rerun.components.ImagePlaneDistance".into(), + docstring_md : "The distance from the camera origin to the image plane when the projection is shown in a 3D viewer.\n\nThis is only used for visualization purposes, and does not affect the projection itself.", is_required : false, }, ], @@ -1627,38 +1655,39 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Points2D"), ArchetypeReflection { display_name: "Points 2D", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.Position2D".into(), display_name : "Positions", + ArchetypeFieldReflection { name : "positions", display_name : + "Positions", component_name : "rerun.components.Position2D".into(), docstring_md : "All the 2D positions at which the point cloud shows points.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", - docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : "radii", + display_name : "Radii", component_name : "rerun.components.Radius" + .into(), docstring_md : "Optional radii for the points, effectively turning them into circles.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the points.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the points.", + is_required : false, }, ArchetypeFieldReflection { name : "labels", + display_name : "Labels", component_name : "rerun.components.Text" + .into(), docstring_md : "Optional text labels for the points.\n\nIf there's a single label present, it will be placed at the center of the entity.\nOtherwise, each instance will have its own label.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.DrawOrder".into(), display_name : "Draw order", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "draw_order", display_name : "Draw order", component_name : + "rerun.components.DrawOrder".into(), docstring_md : "An optional floating point value that specifies the 2D drawing order.\n\nObjects with higher values are drawn on top of those with lower values.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional class Ids for the points.\n\nThe [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) provides colors and labels if not specified explicitly.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.KeypointId".into(), display_name : "Keypoint ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "keypoint_ids", display_name : "Keypoint ids", component_name : + "rerun.components.KeypointId".into(), docstring_md : "Optional keypoint IDs for the points, identifying them within a class.\n\nIf keypoint IDs are passed in but no [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id)s were specified, the [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) will\ndefault to 0.\nThis is useful to identify points within a single classification (which is identified\nwith `class_id`).\nE.g. the classification might be 'Person' and the keypoints refer to joints on a\ndetected skeleton.", is_required : false, }, ], @@ -1668,34 +1697,35 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Points3D"), ArchetypeReflection { display_name: "Points 3D", + scope: None, view_types: &["Spatial3DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.Position3D".into(), display_name : "Positions", + ArchetypeFieldReflection { name : "positions", display_name : + "Positions", component_name : "rerun.components.Position3D".into(), docstring_md : "All the 3D positions at which the point cloud shows points.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Radius".into(), display_name : "Radii", - docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : "radii", + display_name : "Radii", component_name : "rerun.components.Radius" + .into(), docstring_md : "Optional radii for the points, effectively turning them into circles.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Colors", - docstring_md : "Optional colors for the points.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Text".into(), display_name : "Labels", docstring_md - : + is_required : false, }, ArchetypeFieldReflection { name : "colors", + display_name : "Colors", component_name : "rerun.components.Color" + .into(), docstring_md : "Optional colors for the points.", + is_required : false, }, ArchetypeFieldReflection { name : "labels", + display_name : "Labels", component_name : "rerun.components.Text" + .into(), docstring_md : "Optional text labels for the points.\n\nIf there's a single label present, it will be placed at the center of the entity.\nOtherwise, each instance will have its own label.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ShowLabels".into(), display_name : "Show labels", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "show_labels", display_name : "Show labels", component_name : + "rerun.components.ShowLabels".into(), docstring_md : "Optional choice of whether the text labels should be shown by default.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.ClassId".into(), display_name : "Class ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "class_ids", display_name : "Class ids", component_name : + "rerun.components.ClassId".into(), docstring_md : "Optional class Ids for the points.\n\nThe [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) provides colors and labels if not specified explicitly.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.KeypointId".into(), display_name : "Keypoint ids", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "keypoint_ids", display_name : "Keypoint ids", component_name : + "rerun.components.KeypointId".into(), docstring_md : "Optional keypoint IDs for the points, identifying them within a class.\n\nIf keypoint IDs are passed in but no [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id)s were specified, the [`components.ClassId`](https://rerun.io/docs/reference/types/components/class_id) will\ndefault to 0.\nThis is useful to identify points within a single classification (which is identified\nwith `class_id`).\nE.g. the classification might be 'Person' and the keypoints refer to joints on a\ndetected skeleton.", is_required : false, }, ], @@ -1705,10 +1735,11 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Scalar"), ArchetypeReflection { display_name: "Scalar", + scope: None, view_types: &["TimeSeriesView"], fields: vec![ - ArchetypeFieldReflection { component_name : "rerun.components.Scalar" - .into(), display_name : "Scalar", docstring_md : + ArchetypeFieldReflection { name : "scalar", display_name : "Scalar", + component_name : "rerun.components.Scalar".into(), docstring_md : "The scalar value to log.", is_required : true, }, ], }, @@ -1717,21 +1748,22 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.SegmentationImage"), ArchetypeReflection { display_name: "Segmentation image", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.ImageBuffer".into(), display_name : "Buffer", - docstring_md : "The raw image data.", is_required : true, }, - ArchetypeFieldReflection { component_name : - "rerun.components.ImageFormat".into(), display_name : "Format", - docstring_md : "The format of the image.", is_required : true, }, - ArchetypeFieldReflection { component_name : - "rerun.components.Opacity".into(), display_name : "Opacity", + ArchetypeFieldReflection { name : "buffer", display_name : "Buffer", + component_name : "rerun.components.ImageBuffer".into(), docstring_md + : "The raw image data.", is_required : true, }, + ArchetypeFieldReflection { name : "format", display_name : "Format", + component_name : "rerun.components.ImageFormat".into(), docstring_md + : "The format of the image.", is_required : true, }, + ArchetypeFieldReflection { name : "opacity", display_name : + "Opacity", component_name : "rerun.components.Opacity".into(), docstring_md : "Opacity of the image, useful for layering the segmentation image on top of another image.\n\nDefaults to 0.5 if there's any other images in the scene, otherwise 1.0.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.DrawOrder".into(), display_name : "Draw order", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "draw_order", display_name : "Draw order", component_name : + "rerun.components.DrawOrder".into(), docstring_md : "An optional floating point value that specifies the 2D drawing order.\n\nObjects with higher values are drawn on top of those with lower values.", is_required : false, }, ], @@ -1741,20 +1773,21 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.SeriesLine"), ArchetypeReflection { display_name: "Series line", + scope: None, view_types: &["TimeSeriesView"], fields: vec![ - ArchetypeFieldReflection { component_name : "rerun.components.Color" - .into(), display_name : "Color", docstring_md : + ArchetypeFieldReflection { name : "color", display_name : "Color", + component_name : "rerun.components.Color".into(), docstring_md : "Color for the corresponding series.", is_required : false, }, - ArchetypeFieldReflection { component_name : - "rerun.components.StrokeWidth".into(), display_name : "Width", - docstring_md : "Stroke width for the corresponding series.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Name".into(), display_name : "Name", docstring_md : + ArchetypeFieldReflection { name : "width", display_name : "Width", + component_name : "rerun.components.StrokeWidth".into(), docstring_md + : "Stroke width for the corresponding series.", is_required : false, + }, ArchetypeFieldReflection { name : "name", display_name : "Name", + component_name : "rerun.components.Name".into(), docstring_md : "Display name of the series.\n\nUsed in the legend.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.AggregationPolicy".into(), display_name : - "Aggregation policy", docstring_md : + false, }, ArchetypeFieldReflection { name : "aggregation_policy", + display_name : "Aggregation policy", component_name : + "rerun.components.AggregationPolicy".into(), docstring_md : "Configures the zoom-dependent scalar aggregation.\n\nThis is done only if steps on the X axis go below a single pixel,\ni.e. a single pixel covers more than one tick worth of data. It can greatly improve performance\n(and readability) in such situations as it prevents overdraw.", is_required : false, }, ], @@ -1764,20 +1797,22 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.SeriesPoint"), ArchetypeReflection { display_name: "Series point", + scope: None, view_types: &["TimeSeriesView"], fields: vec![ - ArchetypeFieldReflection { component_name : "rerun.components.Color" - .into(), display_name : "Color", docstring_md : + ArchetypeFieldReflection { name : "color", display_name : "Color", + component_name : "rerun.components.Color".into(), docstring_md : "Color for the corresponding series.", is_required : false, }, - ArchetypeFieldReflection { component_name : - "rerun.components.MarkerShape".into(), display_name : "Marker", - docstring_md : "What shape to use to represent the point", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Name".into(), display_name : "Name", docstring_md : + ArchetypeFieldReflection { name : "marker", display_name : "Marker", + component_name : "rerun.components.MarkerShape".into(), docstring_md + : "What shape to use to represent the point", is_required : false, }, + ArchetypeFieldReflection { name : "name", display_name : "Name", + component_name : "rerun.components.Name".into(), docstring_md : "Display name of the series.\n\nUsed in the legend.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.MarkerSize".into(), display_name : "Marker size", - docstring_md : "Size of the marker.", is_required : false, }, + false, }, ArchetypeFieldReflection { name : "marker_size", + display_name : "Marker size", component_name : + "rerun.components.MarkerSize".into(), docstring_md : + "Size of the marker.", is_required : false, }, ], }, ), @@ -1785,14 +1820,14 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Tensor"), ArchetypeReflection { display_name: "Tensor", + scope: None, view_types: &["TensorView", "BarChartView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.TensorData".into(), display_name : "Data", - docstring_md : "The tensor data", is_required : true, }, - ArchetypeFieldReflection { component_name : - "rerun.components.ValueRange".into(), display_name : "Value range", - docstring_md : + ArchetypeFieldReflection { name : "data", display_name : "Data", + component_name : "rerun.components.TensorData".into(), docstring_md : + "The tensor data", is_required : true, }, ArchetypeFieldReflection { + name : "value_range", display_name : "Value range", component_name : + "rerun.components.ValueRange".into(), docstring_md : "The expected range of values.\n\nThis is typically the expected range of valid values.\nEverything outside of the range is clamped to the range for the purpose of colormpaping.\nAny colormap applied for display, will map this range.\n\nIf not specified, the range will be automatically estimated from the data.\nNote that the Viewer may try to guess a wider range than the minimum/maximum of values\nin the contents of the tensor.\nE.g. if all values are positive, some bigger than 1.0 and all smaller than 255.0,\nthe Viewer will guess that the data likely came from an 8bit image, thus assuming a range of 0-255.", is_required : false, }, ], @@ -1802,13 +1837,14 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.TextDocument"), ArchetypeReflection { display_name: "Text document", + scope: None, view_types: &["TextDocumentView"], fields: vec![ - ArchetypeFieldReflection { component_name : "rerun.components.Text" - .into(), display_name : "Text", docstring_md : + ArchetypeFieldReflection { name : "text", display_name : "Text", + component_name : "rerun.components.Text".into(), docstring_md : "Contents of the text document.", is_required : true, }, - ArchetypeFieldReflection { component_name : - "rerun.components.MediaType".into(), display_name : "Media type", + ArchetypeFieldReflection { name : "media_type", display_name : + "Media type", component_name : "rerun.components.MediaType".into(), docstring_md : "The Media Type of the text.\n\nFor instance:\n* `text/plain`\n* `text/markdown`\n\nIf omitted, `text/plain` is assumed.", is_required : false, }, @@ -1819,18 +1855,20 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.TextLog"), ArchetypeReflection { display_name: "Text log", + scope: None, view_types: &["TextLogView"], fields: vec![ - ArchetypeFieldReflection { component_name : "rerun.components.Text" - .into(), display_name : "Text", docstring_md : + ArchetypeFieldReflection { name : "text", display_name : "Text", + component_name : "rerun.components.Text".into(), docstring_md : "The body of the message.", is_required : true, }, - ArchetypeFieldReflection { component_name : - "rerun.components.TextLogLevel".into(), display_name : "Level", - docstring_md : + ArchetypeFieldReflection { name : "level", display_name : "Level", + component_name : "rerun.components.TextLogLevel".into(), docstring_md + : "The verbosity level of the message.\n\nThis can be used to filter the log messages in the Rerun Viewer.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Color", docstring_md - : "Optional color to use for the log line in the Rerun Viewer.", + is_required : false, }, ArchetypeFieldReflection { name : "color", + display_name : "Color", component_name : "rerun.components.Color" + .into(), docstring_md : + "Optional color to use for the log line in the Rerun Viewer.", is_required : false, }, ], }, @@ -1839,30 +1877,32 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.Transform3D"), ArchetypeReflection { display_name: "Transform 3D", + scope: None, view_types: &["Spatial3DView", "Spatial2DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.Translation3D".into(), display_name : - "Translation", docstring_md : "Translation vector.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.RotationAxisAngle".into(), display_name : - "Rotation axis angle", docstring_md : "Rotation via axis + angle.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.RotationQuat".into(), display_name : "Quaternion", - docstring_md : "Rotation via quaternion.", is_required : false, }, - ArchetypeFieldReflection { component_name : - "rerun.components.Scale3D".into(), display_name : "Scale", + ArchetypeFieldReflection { name : "translation", display_name : + "Translation", component_name : "rerun.components.Translation3D" + .into(), docstring_md : "Translation vector.", is_required : false, + }, ArchetypeFieldReflection { name : "rotation_axis_angle", + display_name : "Rotation axis angle", component_name : + "rerun.components.RotationAxisAngle".into(), docstring_md : + "Rotation via axis + angle.", is_required : false, }, + ArchetypeFieldReflection { name : "quaternion", display_name : + "Quaternion", component_name : "rerun.components.RotationQuat" + .into(), docstring_md : "Rotation via quaternion.", is_required : + false, }, ArchetypeFieldReflection { name : "scale", display_name : + "Scale", component_name : "rerun.components.Scale3D".into(), docstring_md : "Scaling factor.", is_required : false, }, - ArchetypeFieldReflection { component_name : - "rerun.components.TransformMat3x3".into(), display_name : "Mat 3x 3", - docstring_md : "3x3 transformation matrix.", is_required : false, }, - ArchetypeFieldReflection { component_name : - "rerun.components.TransformRelation".into(), display_name : - "Relation", docstring_md : + ArchetypeFieldReflection { name : "mat3x3", display_name : + "Mat 3x 3", component_name : "rerun.components.TransformMat3x3" + .into(), docstring_md : "3x3 transformation matrix.", is_required : + false, }, ArchetypeFieldReflection { name : "relation", display_name + : "Relation", component_name : "rerun.components.TransformRelation" + .into(), docstring_md : "Specifies the relation this transform establishes between this entity and its parent.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.AxisLength".into(), display_name : "Axis length", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "axis_length", display_name : "Axis length", component_name : + "rerun.components.AxisLength".into(), docstring_md : "Visual length of the 3 axes.\n\nThe length is interpreted in the local coordinate system of the transform.\nIf the transform is scaled, the axes will be scaled accordingly.", is_required : false, }, ], @@ -1872,15 +1912,16 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.VideoFrameReference"), ArchetypeReflection { display_name: "Video frame reference", + scope: None, view_types: &["Spatial2DView", "Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.VideoTimestamp".into(), display_name : "Timestamp", - docstring_md : + ArchetypeFieldReflection { name : "timestamp", display_name : + "Timestamp", component_name : "rerun.components.VideoTimestamp" + .into(), docstring_md : "References the closest video frame to this timestamp.\n\nNote that this uses the closest video frame instead of the latest at this timestamp\nin order to be more forgiving of rounding errors for inprecise timestamp types.\n\nTimestamps are relative to the start of the video, i.e. a timestamp of 0 always corresponds to the first frame.\nThis is oftentimes equivalent to presentation timestamps (known as PTS), but in the presence of B-frames\n(bidirectionally predicted frames) there may be an offset on the first presentation timestamp in the video.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.EntityPath".into(), display_name : - "Video reference", docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : + "video_reference", display_name : "Video reference", component_name : + "rerun.components.EntityPath".into(), docstring_md : "Optional reference to an entity with a [`archetypes.AssetVideo`](https://rerun.io/docs/reference/types/archetypes/asset_video).\n\nIf none is specified, the video is assumed to be at the same entity.\nNote that blueprint overrides on the referenced video will be ignored regardless,\nas this is always interpreted as a reference to the data store.\n\nFor a series of video frame references, it is recommended to specify this path only once\nat the beginning of the series and then rely on latest-at query semantics to\nkeep the video reference active.", is_required : false, }, ], @@ -1890,10 +1931,11 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.archetypes.ViewCoordinates"), ArchetypeReflection { display_name: "View coordinates", + scope: None, view_types: &["Spatial3DView"], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.ViewCoordinates".into(), display_name : "Xyz", + ArchetypeFieldReflection { name : "xyz", display_name : "Xyz", + component_name : "rerun.components.ViewCoordinates".into(), docstring_md : "The directions of the [x, y, z] axes.", is_required : true, }, ], @@ -1903,15 +1945,15 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.Background"), ArchetypeReflection { display_name: "Background", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.BackgroundKind".into(), display_name : - "Kind", docstring_md : "The type of the background.", is_required : - true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Color", docstring_md - : "Color used for the solid background type.", is_required : false, - }, + ArchetypeFieldReflection { name : "kind", display_name : "Kind", + component_name : "rerun.blueprint.components.BackgroundKind".into(), + docstring_md : "The type of the background.", is_required : true, }, + ArchetypeFieldReflection { name : "color", display_name : "Color", + component_name : "rerun.components.Color".into(), docstring_md : + "Color used for the solid background type.", is_required : false, }, ], }, ), @@ -1919,37 +1961,39 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.ContainerBlueprint"), ArchetypeReflection { display_name: "Container blueprint", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ContainerKind".into(), display_name : - "Container kind", docstring_md : "The class of the view.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Name".into(), display_name : "Display name", + ArchetypeFieldReflection { name : "container_kind", display_name : + "Container kind", component_name : + "rerun.blueprint.components.ContainerKind".into(), docstring_md : + "The class of the view.", is_required : true, }, + ArchetypeFieldReflection { name : "display_name", display_name : + "Display name", component_name : "rerun.components.Name".into(), docstring_md : "The name of the container.", is_required : false, }, - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.IncludedContent".into(), display_name : - "Contents", docstring_md : + ArchetypeFieldReflection { name : "contents", display_name : + "Contents", component_name : + "rerun.blueprint.components.IncludedContent".into(), docstring_md : "`ContainerId`s or `ViewId`s that are children of this container.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ColumnShare".into(), display_name : - "Col shares", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "col_shares", display_name : "Col shares", component_name : + "rerun.blueprint.components.ColumnShare".into(), docstring_md : "The layout shares of each column in the container.\n\nFor components.ContainerKind containers, the length of this list should always match the number of contents.\n\nIgnored for components.ContainerKind containers.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.RowShare".into(), display_name : - "Row shares", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "row_shares", display_name : "Row shares", component_name : + "rerun.blueprint.components.RowShare".into(), docstring_md : "The layout shares of each row of the container.\n\nFor components.ContainerKind containers, the length of this list should always match the number of contents.\n\nIgnored for components.ContainerKind containers.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ActiveTab".into(), display_name : - "Active tab", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "active_tab", display_name : "Active tab", component_name : + "rerun.blueprint.components.ActiveTab".into(), docstring_md : "Which tab is active.\n\nOnly applies to `Tabs` containers.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Visible".into(), display_name : - "Visible", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "visible", + display_name : "Visible", component_name : + "rerun.blueprint.components.Visible".into(), docstring_md : "Whether this container is visible.\n\nDefaults to true if not specified.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.GridColumns".into(), display_name : - "Grid columns", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "grid_columns", display_name : "Grid columns", component_name : + "rerun.blueprint.components.GridColumns".into(), docstring_md : "How many columns this grid should have.\n\nIf unset, the grid layout will be auto.\n\nIgnored for components.ContainerKind/components.ContainerKind containers.", is_required : false, }, ], @@ -1959,27 +2003,29 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.DataframeQuery"), ArchetypeReflection { display_name: "Dataframe query", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.TimelineName".into(), display_name : - "Timeline", docstring_md : + ArchetypeFieldReflection { name : "timeline", display_name : + "Timeline", component_name : + "rerun.blueprint.components.TimelineName".into(), docstring_md : "The timeline for this query.\n\nIf unset, the timeline currently active on the time panel is used.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.FilterByRange".into(), display_name : - "Filter by range", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "filter_by_range", display_name : "Filter by range", component_name : + "rerun.blueprint.components.FilterByRange".into(), docstring_md : "If provided, only rows whose timestamp is within this range will be shown.\n\nNote: will be unset as soon as `timeline` is changed.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.FilterIsNotNull".into(), display_name : - "Filter is not null", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "filter_is_not_null", display_name : "Filter is not null", + component_name : "rerun.blueprint.components.FilterIsNotNull".into(), + docstring_md : "If provided, only show rows which contains a logged event for the specified component.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ApplyLatestAt".into(), display_name : - "Apply latest at", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "apply_latest_at", display_name : "Apply latest at", component_name : + "rerun.blueprint.components.ApplyLatestAt".into(), docstring_md : "Should empty cells be filled with latest-at queries?", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.SelectedColumns".into(), display_name : - "Select", docstring_md : + false, }, ArchetypeFieldReflection { name : "select", display_name : + "Select", component_name : + "rerun.blueprint.components.SelectedColumns".into(), docstring_md : "Selected columns. If unset, all columns are selected.", is_required : false, }, ], @@ -1989,15 +2035,16 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.ForceCenter"), ArchetypeReflection { display_name: "Force center", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Enabled".into(), display_name : - "Enabled", docstring_md : "Whether the force is enabled.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ForceStrength".into(), display_name : - "Strength", docstring_md : "The strength of the force.", is_required - : false, }, + ArchetypeFieldReflection { name : "enabled", display_name : + "Enabled", component_name : "rerun.blueprint.components.Enabled" + .into(), docstring_md : "Whether the force is enabled.", is_required + : false, }, ArchetypeFieldReflection { name : "strength", + display_name : "Strength", component_name : + "rerun.blueprint.components.ForceStrength".into(), docstring_md : + "The strength of the force.", is_required : false, }, ], }, ), @@ -2005,17 +2052,19 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.ForceCollisionRadius"), ArchetypeReflection { display_name: "Force collision radius", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Enabled".into(), display_name : - "Enabled", docstring_md : "Whether the force is enabled.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ForceStrength".into(), display_name : - "Strength", docstring_md : "The strength of the force.", is_required - : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ForceIterations".into(), display_name : - "Iterations", docstring_md : + ArchetypeFieldReflection { name : "enabled", display_name : + "Enabled", component_name : "rerun.blueprint.components.Enabled" + .into(), docstring_md : "Whether the force is enabled.", is_required + : false, }, ArchetypeFieldReflection { name : "strength", + display_name : "Strength", component_name : + "rerun.blueprint.components.ForceStrength".into(), docstring_md : + "The strength of the force.", is_required : false, }, + ArchetypeFieldReflection { name : "iterations", display_name : + "Iterations", component_name : + "rerun.blueprint.components.ForceIterations".into(), docstring_md : "Specifies how often this force should be applied per iteration.\n\nIncreasing this parameter can lead to better results at the cost of longer computation time.", is_required : false, }, ], @@ -2025,17 +2074,19 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.ForceLink"), ArchetypeReflection { display_name: "Force link", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Enabled".into(), display_name : - "Enabled", docstring_md : "Whether the force is enabled.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ForceDistance".into(), display_name : - "Distance", docstring_md : "The target distance between two nodes.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ForceIterations".into(), display_name : - "Iterations", docstring_md : + ArchetypeFieldReflection { name : "enabled", display_name : + "Enabled", component_name : "rerun.blueprint.components.Enabled" + .into(), docstring_md : "Whether the force is enabled.", is_required + : false, }, ArchetypeFieldReflection { name : "distance", + display_name : "Distance", component_name : + "rerun.blueprint.components.ForceDistance".into(), docstring_md : + "The target distance between two nodes.", is_required : false, }, + ArchetypeFieldReflection { name : "iterations", display_name : + "Iterations", component_name : + "rerun.blueprint.components.ForceIterations".into(), docstring_md : "Specifies how often this force should be applied per iteration.\n\nIncreasing this parameter can lead to better results at the cost of longer computation time.", is_required : false, }, ], @@ -2045,14 +2096,15 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.ForceManyBody"), ArchetypeReflection { display_name: "Force many body", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Enabled".into(), display_name : - "Enabled", docstring_md : "Whether the force is enabled.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ForceStrength".into(), display_name : - "Strength", docstring_md : + ArchetypeFieldReflection { name : "enabled", display_name : + "Enabled", component_name : "rerun.blueprint.components.Enabled" + .into(), docstring_md : "Whether the force is enabled.", is_required + : false, }, ArchetypeFieldReflection { name : "strength", + display_name : "Strength", component_name : + "rerun.blueprint.components.ForceStrength".into(), docstring_md : "The strength of the force.\n\nIf `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together.", is_required : false, }, ], @@ -2062,16 +2114,18 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.ForcePosition"), ArchetypeReflection { display_name: "Force position", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Enabled".into(), display_name : - "Enabled", docstring_md : "Whether the force is enabled.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ForceStrength".into(), display_name : - "Strength", docstring_md : "The strength of the force.", is_required - : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Position2D".into(), display_name : "Position", + ArchetypeFieldReflection { name : "enabled", display_name : + "Enabled", component_name : "rerun.blueprint.components.Enabled" + .into(), docstring_md : "Whether the force is enabled.", is_required + : false, }, ArchetypeFieldReflection { name : "strength", + display_name : "Strength", component_name : + "rerun.blueprint.components.ForceStrength".into(), docstring_md : + "The strength of the force.", is_required : false, }, + ArchetypeFieldReflection { name : "position", display_name : + "Position", component_name : "rerun.components.Position2D".into(), docstring_md : "The position where the nodes should be pulled towards.", is_required : false, }, @@ -2082,27 +2136,28 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.LineGrid3D"), ArchetypeReflection { display_name: "Line grid 3D", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Visible".into(), display_name : - "Visible", docstring_md : + ArchetypeFieldReflection { name : "visible", display_name : + "Visible", component_name : "rerun.blueprint.components.Visible" + .into(), docstring_md : "Whether the grid is visible.\n\nDefaults to true.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.GridSpacing".into(), display_name : - "Spacing", docstring_md : + false, }, ArchetypeFieldReflection { name : "spacing", display_name : + "Spacing", component_name : "rerun.blueprint.components.GridSpacing" + .into(), docstring_md : "Space between grid lines spacing of one line to the next in scene units.\n\nAs you zoom out, successively only every tenth line is shown.\nThis controls the closest zoom level.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Plane3D".into(), display_name : "Plane", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "plane", + display_name : "Plane", component_name : "rerun.components.Plane3D" + .into(), docstring_md : "In what plane the grid is drawn.\n\nDefaults to whatever plane is determined as the plane at zero units up/down as defined by [`components.ViewCoordinates`](https://rerun.io/docs/reference/types/components/view_coordinates) if present.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.StrokeWidth".into(), display_name : "Stroke width", - docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "stroke_width", display_name : "Stroke width", component_name : + "rerun.components.StrokeWidth".into(), docstring_md : "How thick the lines should be in ui units.\n\nDefault is 1.0 ui unit.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Color".into(), display_name : "Color", docstring_md - : + is_required : false, }, ArchetypeFieldReflection { name : "color", + display_name : "Color", component_name : "rerun.components.Color" + .into(), docstring_md : "Color used for the grid.\n\nTransparency via alpha channel is supported.\nDefaults to a slightly transparent light gray.", is_required : false, }, ], @@ -2112,11 +2167,12 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.MapBackground"), ArchetypeReflection { display_name: "Map background", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.MapProvider".into(), display_name : - "Provider", docstring_md : + ArchetypeFieldReflection { name : "provider", display_name : + "Provider", component_name : "rerun.blueprint.components.MapProvider" + .into(), docstring_md : "Map provider and style to use.\n\n**Note**: Requires a Mapbox API key in the `RERUN_MAPBOX_ACCESS_TOKEN` environment variable.", is_required : false, }, ], @@ -2126,10 +2182,11 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.MapZoom"), ArchetypeReflection { display_name: "Map zoom", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ZoomLevel".into(), display_name : "Zoom", + ArchetypeFieldReflection { name : "zoom", display_name : "Zoom", + component_name : "rerun.blueprint.components.ZoomLevel".into(), docstring_md : "Zoom level for the map.\n\nZoom level follow the [`OpenStreetMap` definition](https://wiki.openstreetmap.org/wiki/Zoom_levels).", is_required : false, }, @@ -2140,12 +2197,13 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.PanelBlueprint"), ArchetypeReflection { display_name: "Panel blueprint", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.PanelState".into(), display_name : - "State", docstring_md : "Current state of the panels.", is_required : - false, }, + ArchetypeFieldReflection { name : "state", display_name : "State", + component_name : "rerun.blueprint.components.PanelState".into(), + docstring_md : "Current state of the panels.", is_required : false, + }, ], }, ), @@ -2153,15 +2211,16 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.PlotLegend"), ArchetypeReflection { display_name: "Plot legend", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Corner2D".into(), display_name : - "Corner", docstring_md : + ArchetypeFieldReflection { name : "corner", display_name : "Corner", + component_name : "rerun.blueprint.components.Corner2D".into(), + docstring_md : "To what corner the legend is aligned.\n\nDefaults to the right bottom corner.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Visible".into(), display_name : - "Visible", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "visible", + display_name : "Visible", component_name : + "rerun.blueprint.components.Visible".into(), docstring_md : "Whether the legend is shown at all.\n\nTrue by default.", is_required : false, }, ], @@ -2171,15 +2230,16 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.ScalarAxis"), ArchetypeReflection { display_name: "Scalar axis", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.Range1D".into(), display_name : "Range", - docstring_md : + ArchetypeFieldReflection { name : "range", display_name : "Range", + component_name : "rerun.components.Range1D".into(), docstring_md : "The range of the axis.\n\nIf unset, the range well be automatically determined based on the queried data.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.LockRangeDuringZoom".into(), display_name - : "Zoom lock", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "zoom_lock", display_name : "Zoom lock", component_name : + "rerun.blueprint.components.LockRangeDuringZoom".into(), docstring_md + : "If enabled, the Y axis range will remain locked to the specified range when zooming.", is_required : false, }, ], @@ -2189,17 +2249,19 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.TensorScalarMapping"), ArchetypeReflection { display_name: "Tensor scalar mapping", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.MagnificationFilter".into(), display_name : - "Mag filter", docstring_md : + ArchetypeFieldReflection { name : "mag_filter", display_name : + "Mag filter", component_name : "rerun.components.MagnificationFilter" + .into(), docstring_md : "Filter used when zooming in on the tensor.\n\nNote that the filter is applied to the scalar values *before* they are mapped to color.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.Colormap".into(), display_name : "Colormap", - docstring_md : "How scalar values map to colors.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.components.GammaCorrection".into(), display_name : "Gamma", + is_required : false, }, ArchetypeFieldReflection { name : "colormap", + display_name : "Colormap", component_name : + "rerun.components.Colormap".into(), docstring_md : + "How scalar values map to colors.", is_required : false, }, + ArchetypeFieldReflection { name : "gamma", display_name : "Gamma", + component_name : "rerun.components.GammaCorrection".into(), docstring_md : "Gamma exponent applied to normalized values before mapping to color.\n\nRaises the normalized values to the power of this value before mapping to color.\nActs like an inverse brightness. Defaults to 1.0.\n\nThe final value for display is set as:\n`colormap( ((value - data_display_range.min) / (data_display_range.max - data_display_range.min)) ** gamma )`", is_required : false, }, @@ -2210,23 +2272,26 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.TensorSliceSelection"), ArchetypeReflection { display_name: "Tensor slice selection", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.components.TensorWidthDimension".into(), display_name : - "Width", docstring_md : + ArchetypeFieldReflection { name : "width", display_name : "Width", + component_name : "rerun.components.TensorWidthDimension".into(), + docstring_md : "Which dimension to map to width.\n\nIf not specified, the height will be determined automatically based on the name and index of the dimension.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.TensorHeightDimension".into(), display_name : - "Height", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "height", + display_name : "Height", component_name : + "rerun.components.TensorHeightDimension".into(), docstring_md : "Which dimension to map to height.\n\nIf not specified, the height will be determined automatically based on the name and index of the dimension.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.components.TensorDimensionIndexSelection".into(), display_name - : "Indices", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "indices", + display_name : "Indices", component_name : + "rerun.components.TensorDimensionIndexSelection".into(), docstring_md + : "Selected indices for all other dimensions.\n\nIf any of the here listed dimensions is equal to `width` or `height`, it will be ignored.", - is_required : false, }, ArchetypeFieldReflection { component_name : + is_required : false, }, ArchetypeFieldReflection { name : "slider", + display_name : "Slider", component_name : "rerun.blueprint.components.TensorDimensionIndexSlider".into(), - display_name : "Slider", docstring_md : + docstring_md : "Any dimension listed here will have a slider for the index.\n\nEdits to the sliders will directly manipulate dimensions on the `indices` list.\nIf any of the here listed dimensions is equal to `width` or `height`, it will be ignored.\nIf not specified, adds slides for any dimension in `indices`.", is_required : false, }, ], @@ -2236,11 +2301,12 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.TensorViewFit"), ArchetypeReflection { display_name: "Tensor view fit", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ViewFit".into(), display_name : - "Scaling", docstring_md : "How the image is scaled to fit the view.", + ArchetypeFieldReflection { name : "scaling", display_name : + "Scaling", component_name : "rerun.blueprint.components.ViewFit" + .into(), docstring_md : "How the image is scaled to fit the view.", is_required : false, }, ], }, @@ -2249,21 +2315,23 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.ViewBlueprint"), ArchetypeReflection { display_name: "View blueprint", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ViewClass".into(), display_name : - "Class identifier", docstring_md : "The class of the view.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.components.Name".into(), display_name : "Display name", + ArchetypeFieldReflection { name : "class_identifier", display_name : + "Class identifier", component_name : + "rerun.blueprint.components.ViewClass".into(), docstring_md : + "The class of the view.", is_required : true, }, + ArchetypeFieldReflection { name : "display_name", display_name : + "Display name", component_name : "rerun.components.Name".into(), docstring_md : "The name of the view.", is_required : false, }, - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ViewOrigin".into(), display_name : - "Space origin", docstring_md : + ArchetypeFieldReflection { name : "space_origin", display_name : + "Space origin", component_name : + "rerun.blueprint.components.ViewOrigin".into(), docstring_md : "The \"anchor point\" of this view.\n\nDefaults to the root path '/' if not specified.\n\nThe transform at this path forms the reference point for all scene->world transforms in this view.\nI.e. the position of this entity path in space forms the origin of the coordinate system in this view.\nFurthermore, this is the primary indicator for heuristics on what entities we show in this view.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.Visible".into(), display_name : - "Visible", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : "visible", + display_name : "Visible", component_name : + "rerun.blueprint.components.Visible".into(), docstring_md : "Whether this view is visible.\n\nDefaults to true if not specified.", is_required : false, }, ], @@ -2273,11 +2341,12 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.ViewContents"), ArchetypeReflection { display_name: "View contents", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.QueryExpression".into(), display_name : - "Query", docstring_md : + ArchetypeFieldReflection { name : "query", display_name : "Query", + component_name : "rerun.blueprint.components.QueryExpression".into(), + docstring_md : "The `QueryExpression` that populates the contents for the view.\n\nThey determine which entities are part of the view.", is_required : false, }, ], @@ -2287,25 +2356,30 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.ViewportBlueprint"), ArchetypeReflection { display_name: "Viewport blueprint", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.RootContainer".into(), display_name : - "Root container", docstring_md : "The layout of the views", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.ViewMaximized".into(), display_name : - "Maximized", docstring_md : "Show one tab as maximized?", is_required - : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.AutoLayout".into(), display_name : - "Auto layout", docstring_md : + ArchetypeFieldReflection { name : "root_container", display_name : + "Root container", component_name : + "rerun.blueprint.components.RootContainer".into(), docstring_md : + "The layout of the views", is_required : false, }, + ArchetypeFieldReflection { name : "maximized", display_name : + "Maximized", component_name : + "rerun.blueprint.components.ViewMaximized".into(), docstring_md : + "Show one tab as maximized?", is_required : false, }, + ArchetypeFieldReflection { name : "auto_layout", display_name : + "Auto layout", component_name : + "rerun.blueprint.components.AutoLayout".into(), docstring_md : "Whether the viewport layout is determined automatically.\n\nIf `true`, the container layout will be reset whenever a new view is added or removed.\nThis defaults to `false` and is automatically set to `false` when there is user determined layout.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.AutoViews".into(), display_name : - "Auto views", docstring_md : + is_required : false, }, ArchetypeFieldReflection { name : + "auto_views", display_name : "Auto views", component_name : + "rerun.blueprint.components.AutoViews".into(), docstring_md : "Whether or not views should be created automatically.\n\nIf `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`)\nand which aren't deemed redundant to existing views.\nThis defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer.", - is_required : false, }, ArchetypeFieldReflection { component_name : + is_required : false, }, ArchetypeFieldReflection { name : + "past_viewer_recommendations", display_name : + "Past viewer recommendations", component_name : "rerun.blueprint.components.ViewerRecommendationHash".into(), - display_name : "Past viewer recommendations", docstring_md : + docstring_md : "Hashes of all recommended views the viewer has already added and that should not be added again.\n\nThis is an internal field and should not be set usually.\nIf you want the viewer from stopping to add views, you should set `auto_views` to `false`.\n\nThe viewer uses this to determine whether it should keep adding views.", is_required : false, }, ], @@ -2315,11 +2389,12 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.VisibleTimeRanges"), ArchetypeReflection { display_name: "Visible time ranges", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.VisibleTimeRange".into(), display_name : - "Ranges", docstring_md : + ArchetypeFieldReflection { name : "ranges", display_name : "Ranges", + component_name : "rerun.blueprint.components.VisibleTimeRange" + .into(), docstring_md : "The time ranges to show for each timeline unless specified otherwise on a per-entity basis.\n\nIf a timeline is specified more than once, the first entry will be used.", is_required : true, }, ], @@ -2329,15 +2404,16 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ArchetypeName::new("rerun.blueprint.archetypes.VisualBounds2D"), ArchetypeReflection { display_name: "Visual bounds 2D", + scope: Some("blueprint"), view_types: &[], fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.VisualBounds2D".into(), display_name : - "Range", docstring_md : + ArchetypeFieldReflection { name : "range", display_name : "Range", + component_name : "rerun.blueprint.components.VisualBounds2D".into(), + docstring_md : "Controls the visible range of a 2D view.\n\nUse this to control pan & zoom of the view.", - is_required : true, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.NearClipPlane".into(), display_name : - "Near clip plane", docstring_md : + is_required : true, }, ArchetypeFieldReflection { name : + "near_clip_plane", display_name : "Near clip plane", component_name : + "rerun.blueprint.components.NearClipPlane".into(), docstring_md : "Controls the distance to the near clip plane in 3D scene units.\n\nContent closer than this distance will not be visible.", is_required : false, }, ], diff --git a/crates/store/re_types_core/src/reflection.rs b/crates/store/re_types_core/src/reflection.rs index 5d1c633b97cf..9fc71d5b4fdf 100644 --- a/crates/store/re_types_core/src/reflection.rs +++ b/crates/store/re_types_core/src/reflection.rs @@ -238,6 +238,11 @@ pub struct ArchetypeReflection { /// e.g. `Spatial3DView`. pub view_types: &'static [&'static str], + /// Does this have a particular scope? + /// + /// e.g. `"blueprint"`. + pub scope: Option<&'static str>, + /// All the component fields of the archetype, in the order they appear in the archetype. pub fields: Vec, } @@ -253,12 +258,15 @@ impl ArchetypeReflection { /// Additional information about an archetype's field. #[derive(Clone, Debug)] pub struct ArchetypeFieldReflection { - /// The type of the field (it's always a component). - pub component_name: ComponentName, + /// The name of the field (i.e. same as `ComponentDescriptor::archetype_field_name`). + pub name: &'static str, /// The name of the field in human case. pub display_name: &'static str, + /// The type of the field (it's always a component). + pub component_name: ComponentName, + /// Markdown docstring for the field (not for the component type). pub docstring_md: &'static str, From e85cc13f3b221e03207d0ed3247cd0d748637781 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Thu, 12 Dec 2024 18:47:32 +0100 Subject: [PATCH 51/71] Migration kernel for the blueprint space-view-related breaking changes (#8439) Our first migration kernel! This makes it possible to load <0.21 blueprints into Rerun 0.21, transparently, without user intervention. More importantly, this marks the first step in exploring these kinds of tools, as part of our general promise of becoming more and more stable over time. Basically a gloried search and replace. To test it, save any blueprint from 0.20 (https://app.rerun.io/version/0.20.3/index.html), and load it into 0.21. --- crates/store/re_chunk/src/lib.rs | 1 + crates/store/re_chunk/src/migration.rs | 95 +++++++++++++++++++++++ crates/store/re_chunk_store/src/writes.rs | 4 +- 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 crates/store/re_chunk/src/migration.rs diff --git a/crates/store/re_chunk/src/lib.rs b/crates/store/re_chunk/src/lib.rs index 0963ef5f93b2..159b47d44ca5 100644 --- a/crates/store/re_chunk/src/lib.rs +++ b/crates/store/re_chunk/src/lib.rs @@ -11,6 +11,7 @@ mod id; mod iter; mod latest_at; mod merge; +mod migration; mod range; mod shuffle; mod slice; diff --git a/crates/store/re_chunk/src/migration.rs b/crates/store/re_chunk/src/migration.rs new file mode 100644 index 000000000000..0728b859edf8 --- /dev/null +++ b/crates/store/re_chunk/src/migration.rs @@ -0,0 +1,95 @@ +use arrow2::array::{Array, Utf8Array}; + +use itertools::Itertools; +use nohash_hasher::IntMap; + +use crate::Chunk; + +impl Chunk { + /// A temporary migration kernel for blueprint data. + /// + /// Deals with all the space-view terminology breaking changes (`SpaceView`->`View`, `space_view`->`view`, etc). + #[inline] + pub fn patched_for_blueprint_021_compat(&self) -> Self { + let mut chunk = self.clone(); + + const PATCHES: &[(&str, &str)] = &[("SpaceView", "View"), ("space_view", "view")]; + + // First, patch any entity path that still use space-view terminology. + // We expect this to only ever be called for blueprint data, so these entity paths + // are all builtin ones -- we're not overriding any user data. + let mut entity_path = chunk.entity_path.to_string(); + for (from, to) in PATCHES { + entity_path = entity_path.replace(from, to); + } + chunk.entity_path = entity_path.into(); + + let mut components_patched = IntMap::default(); + for (component_name, per_desc) in chunk.components.iter_mut() { + if PATCHES + .iter() + .any(|(from, _to)| component_name.contains(from)) + { + // Second, patch all descriptors that still use space-view terminology. + for (mut descriptor, list_array) in std::mem::take(per_desc) { + for (from, to) in PATCHES { + if let Some(archetype_name) = descriptor.archetype_name.as_mut() { + *archetype_name = archetype_name.replace(from, to).into(); + } + descriptor.component_name = + descriptor.component_name.replace(from, to).into(); + } + components_patched.insert(descriptor, list_array.clone()); + } + } + + // Finally, patch actual data that still uses space-view terminology. + // As far as we know, this only concerns `IncludedContent` specifically. + if component_name == "rerun.blueprint.components.IncludedContent" { + for list_array in per_desc.values_mut() { + let arrays = list_array + .iter() + .map(|utf8_array| { + utf8_array.map(|array| { + let Some(array) = array.as_any().downcast_ref::>() + else { + // Unreachable, just avoiding unwraps. + return array; + }; + + array + .iter() + .map(|s| { + s.map(|s| { + let mut s = s.to_owned(); + for (from, to) in PATCHES { + s = s.replace(from, to); + } + s + }) + }) + .collect::>() + .to_boxed() + }) + }) + .collect_vec(); + let arrays = arrays + .iter() + .map(|a| a.as_deref() as Option<&dyn Array>) + .collect_vec(); + + if let Some(list_array_patched) = crate::util::arrays_to_list_array_opt(&arrays) + { + *list_array = list_array_patched; + } + } + } + } + + for (desc, list_array) in components_patched { + chunk.components.insert_descriptor(desc, list_array); + } + + chunk + } +} diff --git a/crates/store/re_chunk_store/src/writes.rs b/crates/store/re_chunk_store/src/writes.rs index db7c2f7cf1c3..e8967047392e 100644 --- a/crates/store/re_chunk_store/src/writes.rs +++ b/crates/store/re_chunk_store/src/writes.rs @@ -62,7 +62,9 @@ impl ChunkStore { // * Somebody loads an old .rbl from somewhere and starts logging new blueprint data to it. // * Etc. if self.id.kind == re_log_types::StoreKind::Blueprint { - chunk = Arc::new(chunk.clone_as_untagged()); + let patched = chunk.patched_for_blueprint_021_compat(); + let patched = patched.clone_as_untagged(); + chunk = Arc::new(patched); } #[cfg(debug_assertions)] From 342b6d5ccc7874058de358aee39917df0d855755 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Thu, 12 Dec 2024 19:04:11 +0100 Subject: [PATCH 52/71] Improved assertion for wrongully tagged chunks (#8444) --- crates/store/re_chunk_store/src/writes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/store/re_chunk_store/src/writes.rs b/crates/store/re_chunk_store/src/writes.rs index e8967047392e..28546832796c 100644 --- a/crates/store/re_chunk_store/src/writes.rs +++ b/crates/store/re_chunk_store/src/writes.rs @@ -71,7 +71,7 @@ impl ChunkStore { for (component_name, per_desc) in chunk.components().iter() { assert!( per_desc.len() <= 1, - "[DEBUG ONLY] Insert Chunk with multiple values for component named `{component_name}`: this is currently UB", + "[DEBUG ONLY] Insert Chunk with multiple values for component named `{component_name}`: this is currently UB\n{chunk}", ); } From 4889f8563ecd4d78f78e5afe04842663a3b5cbbf Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:14:50 +0100 Subject: [PATCH 53/71] Fix another snapshot image (#8445) --- crates/viewer/re_ui/tests/snapshots/list_items.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/viewer/re_ui/tests/snapshots/list_items.png b/crates/viewer/re_ui/tests/snapshots/list_items.png index f64376dc31f6..97fc4ef77e39 100644 --- a/crates/viewer/re_ui/tests/snapshots/list_items.png +++ b/crates/viewer/re_ui/tests/snapshots/list_items.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2ecf134236201c4a465acc86af15e2e60b788e6a23177563c21e3e7c7a7aaab -size 84798 +oid sha256:26149698716ece2e1be2b9795ebd3ef493ccf625fa433128e8aabe4f92492bc8 +size 84776 From 084a1e2cd6b6c21573cb37e67a01648c8c074e8f Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Fri, 13 Dec 2024 09:15:53 +0100 Subject: [PATCH 54/71] Enable remote feature in all pypi builds (#8446) ### What - Make it so `remote` is enabled in wheels for release/nightly - Still stays off for PRs, etc, to keep build times down - Also `pypi,extra` seemed more clear to me than `extra` implying `pypi` --- rerun_py/Cargo.toml | 4 ++-- scripts/ci/build_and_upload_wheels.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rerun_py/Cargo.toml b/rerun_py/Cargo.toml index b9c5db4e9840..5357d7e53a8d 100644 --- a/rerun_py/Cargo.toml +++ b/rerun_py/Cargo.toml @@ -18,11 +18,11 @@ name = "rerun_bindings" # name of the .so library that the Python module will im default = ["extension-module"] ## Extra features that aren't ready to be included in release builds yet. -extra = ["pypi", "remote"] +extra = [] ## The features we turn on when building the `rerun-sdk` PyPi package ## for . -pypi = ["extension-module", "nasm", "web_viewer"] +pypi = ["extension-module", "nasm", "web_viewer", "remote"] ## We need to enable the `pyo3/extension-module` when building the SDK, ## but we cannot enable it when building tests and benchmarks, so we diff --git a/scripts/ci/build_and_upload_wheels.py b/scripts/ci/build_and_upload_wheels.py index 6e62fec57f0d..0de8495db3f8 100755 --- a/scripts/ci/build_and_upload_wheels.py +++ b/scripts/ci/build_and_upload_wheels.py @@ -72,7 +72,7 @@ def build_and_upload(bucket: Bucket | None, mode: BuildMode, gcs_dir: str, targe elif mode is BuildMode.PR: maturin_feature_flags = "--no-default-features --features extension-module" elif mode is BuildMode.EXTRA: - maturin_feature_flags = "--no-default-features --features extra" + maturin_feature_flags = "--no-default-features --features pypi,extra" dist = f"dist/{target}" From 98152a7a2383bdfe5087bd3c964887a75d77dd73 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Fri, 13 Dec 2024 09:20:16 +0100 Subject: [PATCH 55/71] Fix out of bounds access in data density graph (#8441) Regressed this somewhat recently during perf optimizations in the data_density_graph: it was possible to get into an out of bounds access when zooming in. Cleaned it up a bit overall and fixed a subtle bug for when there's only fractional buckets filled in the density graph --- .../re_time_panel/src/data_density_graph.rs | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/crates/viewer/re_time_panel/src/data_density_graph.rs b/crates/viewer/re_time_panel/src/data_density_graph.rs index 89a7487c99b5..866ae385861f 100644 --- a/crates/viewer/re_time_panel/src/data_density_graph.rs +++ b/crates/viewer/re_time_panel/src/data_density_graph.rs @@ -147,6 +147,10 @@ impl DensityGraph { pub fn add_range(&mut self, (min_x, max_x): (f32, f32), count: f32) { debug_assert!(min_x <= max_x); + if max_x < self.min_x || self.max_x < min_x { + return; + } + if min_x == max_x { let center_x = lerp(min_x..=max_x, 0.5); self.add_point(center_x, count); @@ -162,29 +166,39 @@ impl DensityGraph { // We then want to add to the buckets [3, 4, 5, 6], // but not in equal amounts. - let first_bucket_factor = 1.0 - (min_bucket - min_bucket.floor()); - let num_full_buckets = 1.0 + max_bucket.floor() - min_bucket.ceil(); - let last_bucket_factor = 1.0 - (max_bucket.ceil() - max_bucket); + let min_full_bucket = min_bucket.ceil(); + let first_bucket = min_bucket.floor(); + let max_full_bucket = max_bucket.floor(); + let last_bucket = max_bucket.ceil(); + let first_bucket_factor = 1.0 - (min_bucket - first_bucket); + let num_full_buckets = 1.0 + max_full_bucket - min_full_bucket; + let last_bucket_factor = 1.0 - (last_bucket - max_bucket); let count_per_bucket = count / (first_bucket_factor + num_full_buckets + last_bucket_factor); + // For filling self.buckets, we need to account for min_bucket/max_bucket being out of range! + // (everything before & beyond can be seen as a "virtual" bucket that we can't fill) + // first bucket, partially filled: - if let Ok(i) = usize::try_from(min_bucket.floor() as i64) { + if let Ok(i) = usize::try_from(first_bucket as i64) { if let Some(bucket) = self.buckets.get_mut(i) { *bucket += first_bucket_factor * count_per_bucket; } } // full buckets: - let min_full_bucket_idx = (min_bucket.ceil() as i64).at_least(0) as usize; - let max_full_bucket_idx = - (max_bucket.floor() as i64).at_most(self.buckets.len() as i64 - 1) as usize; - for bucket in &mut self.buckets[min_full_bucket_idx..=max_full_bucket_idx] { - *bucket += count_per_bucket; + if min_full_bucket != max_full_bucket { + let min_full_bucket_idx = + (min_full_bucket as i64).clamp(0, self.buckets.len() as i64 - 1) as usize; + let max_full_bucket_idx = + (max_full_bucket as i64).clamp(0, self.buckets.len() as i64 - 1) as usize; + for bucket in &mut self.buckets[min_full_bucket_idx..=max_full_bucket_idx] { + *bucket += count_per_bucket; + } } // last bucket, partially filled: - if let Ok(i) = usize::try_from(max_bucket.ceil() as i64) { + if let Ok(i) = usize::try_from(last_bucket as i64) { if let Some(bucket) = self.buckets.get_mut(i) { *bucket += last_bucket_factor * count_per_bucket; } From a02c262db38456151e7356394dd3549be70bd371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Fri, 13 Dec 2024 09:29:27 +0100 Subject: [PATCH 56/71] Improve `VisualBounds2D` behavior in graph view (#8438) * Closes #8429 This implements improved handling of `VisualBounds2D`. Specifically, it: * Always defaults to the data bounds when user has not modified the view (@nikolausWest's suggestion). * Zooms in and out of view when resizing the view (@abey79's suggestion). * Fixes the `VisualBounds2D` selection panel bug (submitted by @Wumpf) --------- Co-authored-by: Andreas Reich --- crates/viewer/re_ui/src/zoom_pan_area.rs | 14 ++++++++++---- crates/viewer/re_view_graph/src/ui/state.rs | 5 ++--- crates/viewer/re_view_graph/src/view.rs | 19 +++++-------------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/crates/viewer/re_ui/src/zoom_pan_area.rs b/crates/viewer/re_ui/src/zoom_pan_area.rs index 46020aa15c34..bfb97c1ef597 100644 --- a/crates/viewer/re_ui/src/zoom_pan_area.rs +++ b/crates/viewer/re_ui/src/zoom_pan_area.rs @@ -5,7 +5,7 @@ //! * `view`-space: The space where the pan-and-zoom area is drawn. //! * `scene`-space: The space where the actual content is drawn. -use egui::{emath::TSTransform, Area, Rect, Response, Ui, UiKind}; +use egui::{emath::TSTransform, Area, Rect, Response, Ui, UiKind, Vec2}; /// Helper function to handle pan and zoom interactions on a response. fn register_pan_and_zoom(ui: &Ui, resp: &Response, ui_from_scene: &mut TSTransform) { @@ -19,16 +19,22 @@ fn register_pan_and_zoom(ui: &Ui, resp: &Response, ui_from_scene: &mut TSTransfo let zoom_delta = ui.ctx().input(|i| i.zoom_delta()); let pan_delta = ui.ctx().input(|i| i.smooth_scroll_delta); + // Most of the time we can return early. This is also important to + // avoid `ui_from_scene` to change slightly due to floating point errors. + if zoom_delta == 1.0 && pan_delta == Vec2::ZERO { + return; + } + // Zoom in on pointer, but only if we are not zoomed out too far. if zoom_delta < 1.0 || ui_from_scene.scaling < 1.0 { *ui_from_scene = *ui_from_scene * TSTransform::from_translation(pointer_in_scene.to_vec2()) * TSTransform::from_scaling(zoom_delta) * TSTransform::from_translation(-pointer_in_scene.to_vec2()); - } - // We clamp the resulting scaling to avoid zooming out too far. - ui_from_scene.scaling = ui_from_scene.scaling.min(1.0); + // We clamp the resulting scaling to avoid zooming out too far. + ui_from_scene.scaling = ui_from_scene.scaling.min(1.0); + } // Pan: *ui_from_scene = TSTransform::from_translation(pan_delta) * *ui_from_scene; diff --git a/crates/viewer/re_view_graph/src/ui/state.rs b/crates/viewer/re_view_graph/src/ui/state.rs index 05eff3718fbc..d8dce815d1df 100644 --- a/crates/viewer/re_view_graph/src/ui/state.rs +++ b/crates/viewer/re_view_graph/src/ui/state.rs @@ -1,4 +1,4 @@ -use egui::{emath::TSTransform, Rect}; +use egui::Rect; use re_format::format_f32; use re_types::blueprint::components::VisualBounds2D; use re_ui::UiExt; @@ -16,7 +16,6 @@ pub struct GraphViewState { pub show_debug: bool, pub visual_bounds: Option, - pub ui_from_world: Option, pub rect_in_ui: Option, } @@ -25,7 +24,7 @@ impl GraphViewState { let Some(rect) = self.layout_state.bounding_rect() else { return; }; - ui.grid_left_hand_label("Layout") + ui.grid_left_hand_label("Bounding box") .on_hover_text("The bounding box encompassing all entities in the view right now"); ui.vertical(|ui| { ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend); diff --git a/crates/viewer/re_view_graph/src/view.rs b/crates/viewer/re_view_graph/src/view.rs index 8948a343c423..581dd8bdcec9 100644 --- a/crates/viewer/re_view_graph/src/view.rs +++ b/crates/viewer/re_view_graph/src/view.rs @@ -183,22 +183,14 @@ Display a graph of nodes and edges. let layout = state.layout_state.get(request, params); // Prepare the view and the transformations. - let prev_rect_in_ui = state.rect_in_ui; let rect_in_ui = *state.rect_in_ui.insert(ui.max_rect()); - let ui_from_world = state - .ui_from_world - .get_or_insert_with(|| fit_to_rect_in_scene(rect_in_ui, rect_in_scene.into())); + let mut ui_from_world = fit_to_rect_in_scene(rect_in_ui, rect_in_scene.into()); - // We ensure that the view's center is kept during resizing. - if let Some(prev) = prev_rect_in_ui { - if prev != rect_in_ui { - let delta = rect_in_ui.center() - prev.center(); - ui_from_world.translation += delta; - } - } + // We store a copy of the transformation to see if it has changed. + let ui_from_world_ref = ui_from_world; - let resp = zoom_pan_area(ui, rect_in_ui, ui_from_world, |ui| { + let resp = zoom_pan_area(ui, rect_in_ui, &mut ui_from_world, |ui| { let mut world_bounding_rect = egui::Rect::NOTHING; for graph in &graphs { @@ -217,8 +209,7 @@ Display a graph of nodes and edges. blueprint::components::VisualBounds2D::from(ui_from_world.inverse() * rect_in_ui); if resp.double_clicked() { bounds_property.reset_blueprint_component::(ctx); - state.ui_from_world = None; - } else if rect_in_scene != updated_rect_in_scene { + } else if ui_from_world != ui_from_world_ref { bounds_property.save_blueprint_component(ctx, &updated_rect_in_scene); } // Update stored bounds on the state, so visualizers see an up-to-date value. From ad6b15105842d14d73f076828c1567c5bc28386f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Fri, 13 Dec 2024 12:56:21 +0100 Subject: [PATCH 57/71] Improve graph view documentation (#8436) ### What Title. --- crates/viewer/re_view_graph/src/properties.rs | 2 +- examples/manifest.toml | 1 - examples/python/graph_lattice/README.md | 1 - examples/python/graphs/README.md | 42 ++++++++++++++----- examples/rust/graph_lattice/README.md | 1 - 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/crates/viewer/re_view_graph/src/properties.rs b/crates/viewer/re_view_graph/src/properties.rs index 3a99d6c777f0..35ad81696095 100644 --- a/crates/viewer/re_view_graph/src/properties.rs +++ b/crates/viewer/re_view_graph/src/properties.rs @@ -55,7 +55,7 @@ impl TypedComponentFallbackProvider for GraphView { impl TypedComponentFallbackProvider for GraphView { fn fallback_for(&self, ctx: &re_viewer_context::QueryContext<'_>) -> ForceStrength { match ctx.archetype_name { - Some(name) if name == archetypes::ForceManyBody::name() => (-60.).into(), + Some(name) if name == archetypes::ForceManyBody::name() => (-60.0).into(), Some(name) if name == archetypes::ForcePosition::name() => (0.01).into(), _ => (1.0).into(), } diff --git a/examples/manifest.toml b/examples/manifest.toml index b229b765acd5..a5ef1ebb1152 100644 --- a/examples/manifest.toml +++ b/examples/manifest.toml @@ -168,7 +168,6 @@ examples = [ "drone_lidar", "extend_viewer_ui", "external_data_loader", - "graph_binary_tree", "graph_lattice", "incremental_logging", "minimal_serve", diff --git a/examples/python/graph_lattice/README.md b/examples/python/graph_lattice/README.md index 8ffe2530634f..a44ec2eeab8d 100644 --- a/examples/python/graph_lattice/README.md +++ b/examples/python/graph_lattice/README.md @@ -3,7 +3,6 @@ title = "Graph lattice" tags = ["Graph", "Layout"] thumbnail = "https://static.rerun.io/graph_lattice/f9169da9c3f35b7260c9d74cd5be5fe710aec6a8/480w.png" thumbnail_dimensions = [480, 269] -channel = "main" --> This example shows different attributes that you can associate with nodes in a graph. diff --git a/examples/python/graphs/README.md b/examples/python/graphs/README.md index 245143a18cc0..b06d813bd166 100644 --- a/examples/python/graphs/README.md +++ b/examples/python/graphs/README.md @@ -1,29 +1,51 @@ -This example shows different attributes that you can associate with nodes in a graph. -Since no explicit positions are passed for the nodes, Rerun will layout the graph automatically. +This example shows different types of graphs (and layouts) that you can visualize using Rerun. - - - - - + + + + + +Rerun ships with an integrated engine to produce [force-based layouts](https://en.wikipedia.org/wiki/Force-directed_graph_drawing) to visualize graphs. +Force-directed layout approaches have to advantage that they are flexible and can therefore be used to create different kinds of visualizations. +This example shows different types of layouts: + +* Regular force-directed layouts of node-link diagrams +* Bubble charts, which are based on packing circles + ## Used Rerun types + [`GraphNodes`](https://www.rerun.io/docs/reference/types/archetypes/graph_nodes?speculative-link), [`GraphEdges`](https://www.rerun.io/docs/reference/types/archetypes/graph_edges?speculative-link) +## Force-based layouts + +To compute the graph layouts, Rerun implements a physics simulation that is very similar to [`d3-force`](https://d3js.org/d3-force). In particular, we implement the following forces: + +* Centering force, which shifts the center of mass of the entire graph. +* Collision radius force, which resolves collisions between nodes in the graph, taking their radius into account. +* Many-Body force, which can be used to create attraction or repulsion between nodes. +* Link force, which acts like a spring between two connected nodes. +* Position force, which pull all nodes towards a given position, similar to gravity. + +If you want to learn more about these forces, we recommend looking at the [D3 documentation](https://d3js.org/d3-force) as well. + +Our implementation of the physics simulation is called _Fjädra_. You can find it on [GitHub](https://github.com/grtlr/fjadra) and on [`crates.io`](https://crates.io/crates/fjadra). + ## Run the code ```bash pip install -e examples/python/graphs python -m graphs ``` + diff --git a/examples/rust/graph_lattice/README.md b/examples/rust/graph_lattice/README.md index a4ebaa3a477f..0f3e4ea460f9 100644 --- a/examples/rust/graph_lattice/README.md +++ b/examples/rust/graph_lattice/README.md @@ -3,7 +3,6 @@ title = "Graph lattice" tags = ["Graph", "Layout"] thumbnail = "https://static.rerun.io/graph_lattice/f9169da9c3f35b7260c9d74cd5be5fe710aec6a8/480w.png" thumbnail_dimensions = [480, 269] -channel = "main" --> This example shows different attributes that you can associate with nodes in a graph. From 0c13f9665b5c5424cd3654e5967f6fffed75765d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Fri, 13 Dec 2024 16:13:51 +0100 Subject: [PATCH 58/71] Factor out `NearClipPlane` from `VisualBounds2D` (#8433) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Related * Closes #8415 ### What Title. It looks like we never had a fallback provider for `NearClipPlane`. @Wumpf can you please confirm that this is correct? 🙏 --- .../rerun/blueprint/archetypes.fbs | 1 + .../blueprint/archetypes/near_clip_plane.fbs | 13 ++ .../blueprint/archetypes/visual_bounds2d.fbs | 6 - .../src/blueprint/archetypes/.gitattributes | 1 + .../re_types/src/blueprint/archetypes/mod.rs | 2 + .../blueprint/archetypes/near_clip_plane.rs | 186 ++++++++++++++++++ .../blueprint/archetypes/visual_bounds2d.rs | 63 +----- crates/store/re_types/src/reflection/mod.rs | 21 +- crates/viewer/re_view_spatial/src/ui_2d.rs | 9 +- crates/viewer/re_view_spatial/src/view_2d.rs | 3 +- .../reference/types/views/graph_view.md | 3 - .../reference/types/views/spatial2d_view.md | 3 - rerun_cpp/src/rerun/blueprint/archetypes.hpp | 1 + .../rerun/blueprint/archetypes/.gitattributes | 2 + .../blueprint/archetypes/near_clip_plane.cpp | 41 ++++ .../blueprint/archetypes/near_clip_plane.hpp | 54 +++++ .../blueprint/archetypes/visual_bounds2d.cpp | 14 +- .../blueprint/archetypes/visual_bounds2d.hpp | 13 +- .../rerun/blueprint/archetypes/.gitattributes | 1 + .../rerun/blueprint/archetypes/__init__.py | 2 + .../blueprint/archetypes/near_clip_plane.py | 69 +++++++ .../blueprint/archetypes/visual_bounds2d.py | 11 -- .../archetypes/visual_bounds2d_ext.py | 4 - 23 files changed, 409 insertions(+), 114 deletions(-) create mode 100644 crates/store/re_types/definitions/rerun/blueprint/archetypes/near_clip_plane.fbs create mode 100644 crates/store/re_types/src/blueprint/archetypes/near_clip_plane.rs create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/near_clip_plane.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/near_clip_plane.hpp create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/archetypes/near_clip_plane.py diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs index fbbed167ca0c..832d2487a112 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs @@ -11,6 +11,7 @@ include "./archetypes/force_position.fbs"; include "./archetypes/line_grid3d.fbs"; include "./archetypes/map_background.fbs"; include "./archetypes/map_zoom.fbs"; +include "./archetypes/near_clip_plane.fbs"; include "./archetypes/panel_blueprint.fbs"; include "./archetypes/plot_legend.fbs"; include "./archetypes/scalar_axis.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/near_clip_plane.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/near_clip_plane.fbs new file mode 100644 index 000000000000..a157d67a2982 --- /dev/null +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/near_clip_plane.fbs @@ -0,0 +1,13 @@ +namespace rerun.blueprint.archetypes; + +/// Controls the distance to the near clip plane in 3D scene units. +table NearClipPlane ( + "attr.docs.unreleased", + "attr.rerun.scope": "blueprint", + "attr.rust.derive": "Copy" +) { + /// Controls the distance to the near clip plane in 3D scene units. + /// + /// Content closer than this distance will not be visible. + near_clip_plane: rerun.blueprint.components.NearClipPlane ("attr.rerun.component_optional", order: 1000); +} diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/visual_bounds2d.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/visual_bounds2d.fbs index 21b8599e5383..38c38541640c 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/visual_bounds2d.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/visual_bounds2d.fbs @@ -1,6 +1,5 @@ namespace rerun.blueprint.archetypes; - /// Controls the visual bounds of a 2D view. /// /// Everything within these bounds are guaranteed to be visible. @@ -16,9 +15,4 @@ table VisualBounds2D ( /// /// Use this to control pan & zoom of the view. range: rerun.blueprint.components.VisualBounds2D ("attr.rerun.component_required", order: 1000); - - /// Controls the distance to the near clip plane in 3D scene units. - /// - /// Content closer than this distance will not be visible. - near_clip_plane: rerun.blueprint.components.NearClipPlane ("attr.rerun.component_optional", order: 2000); } diff --git a/crates/store/re_types/src/blueprint/archetypes/.gitattributes b/crates/store/re_types/src/blueprint/archetypes/.gitattributes index e8331953aab0..bb60dc4d4d53 100644 --- a/crates/store/re_types/src/blueprint/archetypes/.gitattributes +++ b/crates/store/re_types/src/blueprint/archetypes/.gitattributes @@ -13,6 +13,7 @@ line_grid3d.rs linguist-generated=true map_background.rs linguist-generated=true map_zoom.rs linguist-generated=true mod.rs linguist-generated=true +near_clip_plane.rs linguist-generated=true panel_blueprint.rs linguist-generated=true plot_legend.rs linguist-generated=true scalar_axis.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/archetypes/mod.rs b/crates/store/re_types/src/blueprint/archetypes/mod.rs index c0b54d19a91d..92d1c164ee4e 100644 --- a/crates/store/re_types/src/blueprint/archetypes/mod.rs +++ b/crates/store/re_types/src/blueprint/archetypes/mod.rs @@ -11,6 +11,7 @@ mod force_position; mod line_grid3d; mod map_background; mod map_zoom; +mod near_clip_plane; mod panel_blueprint; mod plot_legend; mod scalar_axis; @@ -35,6 +36,7 @@ pub use self::force_position::ForcePosition; pub use self::line_grid3d::LineGrid3D; pub use self::map_background::MapBackground; pub use self::map_zoom::MapZoom; +pub use self::near_clip_plane::NearClipPlane; pub use self::panel_blueprint::PanelBlueprint; pub use self::plot_legend::PlotLegend; pub use self::scalar_axis::ScalarAxis; diff --git a/crates/store/re_types/src/blueprint/archetypes/near_clip_plane.rs b/crates/store/re_types/src/blueprint/archetypes/near_clip_plane.rs new file mode 100644 index 000000000000..9714d55ddff1 --- /dev/null +++ b/crates/store/re_types/src/blueprint/archetypes/near_clip_plane.rs @@ -0,0 +1,186 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/near_clip_plane.fbs". + +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::cloned_instead_of_copied)] +#![allow(clippy::map_flatten)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, ComponentBatchCowWithDescriptor}; +use ::re_types_core::{ComponentDescriptor, ComponentName}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Archetype**: Controls the distance to the near clip plane in 3D scene units. +#[derive(Clone, Debug, Copy)] +pub struct NearClipPlane { + /// Controls the distance to the near clip plane in 3D scene units. + /// + /// Content closer than this distance will not be visible. + pub near_clip_plane: crate::blueprint::components::NearClipPlane, +} + +static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = + once_cell::sync::Lazy::new(|| []); + +static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.NearClipPlane".into()), + component_name: "rerun.blueprint.components.NearClipPlaneIndicator".into(), + archetype_field_name: None, + }] + }); + +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = + once_cell::sync::Lazy::new(|| { + [ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.NearClipPlane".into()), + component_name: "rerun.blueprint.components.NearClipPlane".into(), + archetype_field_name: Some("near_clip_plane".into()), + }] + }); + +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = + once_cell::sync::Lazy::new(|| { + [ + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.NearClipPlane".into()), + component_name: "rerun.blueprint.components.NearClipPlaneIndicator".into(), + archetype_field_name: None, + }, + ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.NearClipPlane".into()), + component_name: "rerun.blueprint.components.NearClipPlane".into(), + archetype_field_name: Some("near_clip_plane".into()), + }, + ] + }); + +impl NearClipPlane { + /// The total number of components in the archetype: 0 required, 1 recommended, 1 optional + pub const NUM_COMPONENTS: usize = 2usize; +} + +/// Indicator component for the [`NearClipPlane`] [`::re_types_core::Archetype`] +pub type NearClipPlaneIndicator = ::re_types_core::GenericIndicatorComponent; + +impl ::re_types_core::Archetype for NearClipPlane { + type Indicator = NearClipPlaneIndicator; + + #[inline] + fn name() -> ::re_types_core::ArchetypeName { + "rerun.blueprint.archetypes.NearClipPlane".into() + } + + #[inline] + fn display_name() -> &'static str { + "Near clip plane" + } + + #[inline] + fn indicator() -> ComponentBatchCowWithDescriptor<'static> { + static INDICATOR: NearClipPlaneIndicator = NearClipPlaneIndicator::DEFAULT; + ComponentBatchCowWithDescriptor::new(&INDICATOR as &dyn ::re_types_core::ComponentBatch) + } + + #[inline] + fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + REQUIRED_COMPONENTS.as_slice().into() + } + + #[inline] + fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + RECOMMENDED_COMPONENTS.as_slice().into() + } + + #[inline] + fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + OPTIONAL_COMPONENTS.as_slice().into() + } + + #[inline] + fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> { + ALL_COMPONENTS.as_slice().into() + } + + #[inline] + fn from_arrow2_components( + arrow_data: impl IntoIterator)>, + ) -> DeserializationResult { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data + .into_iter() + .map(|(name, array)| (name.full_name(), array)) + .collect(); + let near_clip_plane = { + let array = arrays_by_name + .get("rerun.blueprint.components.NearClipPlane") + .ok_or_else(DeserializationError::missing_data) + .with_context("rerun.blueprint.archetypes.NearClipPlane#near_clip_plane")?; + ::from_arrow2_opt(&**array) + .with_context("rerun.blueprint.archetypes.NearClipPlane#near_clip_plane")? + .into_iter() + .next() + .flatten() + .ok_or_else(DeserializationError::missing_data) + .with_context("rerun.blueprint.archetypes.NearClipPlane#near_clip_plane")? + }; + Ok(Self { near_clip_plane }) + } +} + +impl ::re_types_core::AsComponents for NearClipPlane { + fn as_component_batches(&self) -> Vec> { + re_tracing::profile_function!(); + use ::re_types_core::Archetype as _; + [ + Some(Self::indicator()), + (Some(&self.near_clip_plane as &dyn ComponentBatch)).map(|batch| { + ::re_types_core::ComponentBatchCowWithDescriptor { + batch: batch.into(), + descriptor_override: Some(ComponentDescriptor { + archetype_name: Some("rerun.blueprint.archetypes.NearClipPlane".into()), + archetype_field_name: Some(("near_clip_plane").into()), + component_name: ("rerun.blueprint.components.NearClipPlane").into(), + }), + } + }), + ] + .into_iter() + .flatten() + .collect() + } +} + +impl ::re_types_core::ArchetypeReflectionMarker for NearClipPlane {} + +impl NearClipPlane { + /// Create a new `NearClipPlane`. + #[inline] + pub fn new(near_clip_plane: impl Into) -> Self { + Self { + near_clip_plane: near_clip_plane.into(), + } + } +} + +impl ::re_types_core::SizeBytes for NearClipPlane { + #[inline] + fn heap_size_bytes(&self) -> u64 { + self.near_clip_plane.heap_size_bytes() + } + + #[inline] + fn is_pod() -> bool { + ::is_pod() + } +} diff --git a/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs b/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs index 48072b0eedf8..e409e5dbd94a 100644 --- a/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs +++ b/crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs @@ -31,11 +31,6 @@ pub struct VisualBounds2D { /// /// Use this to control pan & zoom of the view. pub range: crate::blueprint::components::VisualBounds2D, - - /// Controls the distance to the near clip plane in 3D scene units. - /// - /// Content closer than this distance will not be visible. - pub near_clip_plane: crate::blueprint::components::NearClipPlane, } static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = @@ -56,16 +51,10 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usiz }] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> = - once_cell::sync::Lazy::new(|| { - [ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), - component_name: "rerun.blueprint.components.NearClipPlane".into(), - archetype_field_name: Some("near_clip_plane".into()), - }] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 0usize]> = + once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 2usize]> = once_cell::sync::Lazy::new(|| { [ ComponentDescriptor { @@ -78,17 +67,12 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> = component_name: "rerun.blueprint.components.VisualBounds2DIndicator".into(), archetype_field_name: None, }, - ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), - component_name: "rerun.blueprint.components.NearClipPlane".into(), - archetype_field_name: Some("near_clip_plane".into()), - }, ] }); impl VisualBounds2D { - /// The total number of components in the archetype: 1 required, 1 recommended, 1 optional - pub const NUM_COMPONENTS: usize = 3usize; + /// The total number of components in the archetype: 1 required, 1 recommended, 0 optional + pub const NUM_COMPONENTS: usize = 2usize; } /// Indicator component for the [`VisualBounds2D`] [`::re_types_core::Archetype`] @@ -156,23 +140,7 @@ impl ::re_types_core::Archetype for VisualBounds2D { .ok_or_else(DeserializationError::missing_data) .with_context("rerun.blueprint.archetypes.VisualBounds2D#range")? }; - let near_clip_plane = { - let array = arrays_by_name - .get("rerun.blueprint.components.NearClipPlane") - .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.archetypes.VisualBounds2D#near_clip_plane")?; - ::from_arrow2_opt(&**array) - .with_context("rerun.blueprint.archetypes.VisualBounds2D#near_clip_plane")? - .into_iter() - .next() - .flatten() - .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.archetypes.VisualBounds2D#near_clip_plane")? - }; - Ok(Self { - range, - near_clip_plane, - }) + Ok(Self { range }) } } @@ -192,16 +160,6 @@ impl ::re_types_core::AsComponents for VisualBounds2D { }), } }), - (Some(&self.near_clip_plane as &dyn ComponentBatch)).map(|batch| { - ::re_types_core::ComponentBatchCowWithDescriptor { - batch: batch.into(), - descriptor_override: Some(ComponentDescriptor { - archetype_name: Some("rerun.blueprint.archetypes.VisualBounds2D".into()), - archetype_field_name: Some(("near_clip_plane").into()), - component_name: ("rerun.blueprint.components.NearClipPlane").into(), - }), - } - }), ] .into_iter() .flatten() @@ -214,13 +172,9 @@ impl ::re_types_core::ArchetypeReflectionMarker for VisualBounds2D {} impl VisualBounds2D { /// Create a new `VisualBounds2D`. #[inline] - pub fn new( - range: impl Into, - near_clip_plane: impl Into, - ) -> Self { + pub fn new(range: impl Into) -> Self { Self { range: range.into(), - near_clip_plane: near_clip_plane.into(), } } } @@ -228,12 +182,11 @@ impl VisualBounds2D { impl ::re_types_core::SizeBytes for VisualBounds2D { #[inline] fn heap_size_bytes(&self) -> u64 { - self.range.heap_size_bytes() + self.near_clip_plane.heap_size_bytes() + self.range.heap_size_bytes() } #[inline] fn is_pod() -> bool { ::is_pod() - && ::is_pod() } } diff --git a/crates/store/re_types/src/reflection/mod.rs b/crates/store/re_types/src/reflection/mod.rs index 13a12e4af4fb..c9c15388e158 100644 --- a/crates/store/re_types/src/reflection/mod.rs +++ b/crates/store/re_types/src/reflection/mod.rs @@ -2193,6 +2193,21 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ], }, ), + ( + ArchetypeName::new("rerun.blueprint.archetypes.NearClipPlane"), + ArchetypeReflection { + display_name: "Near clip plane", + scope: Some("blueprint"), + view_types: &[], + fields: vec![ + ArchetypeFieldReflection { name : "near_clip_plane", display_name : + "Near clip plane", component_name : + "rerun.blueprint.components.NearClipPlane".into(), docstring_md : + "Controls the distance to the near clip plane in 3D scene units.\n\nContent closer than this distance will not be visible.", + is_required : false, }, + ], + }, + ), ( ArchetypeName::new("rerun.blueprint.archetypes.PanelBlueprint"), ArchetypeReflection { @@ -2411,11 +2426,7 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { component_name : "rerun.blueprint.components.VisualBounds2D".into(), docstring_md : "Controls the visible range of a 2D view.\n\nUse this to control pan & zoom of the view.", - is_required : true, }, ArchetypeFieldReflection { name : - "near_clip_plane", display_name : "Near clip plane", component_name : - "rerun.blueprint.components.NearClipPlane".into(), docstring_md : - "Controls the distance to the near clip plane in 3D scene units.\n\nContent closer than this distance will not be visible.", - is_required : false, }, + is_required : true, }, ], }, ), diff --git a/crates/viewer/re_view_spatial/src/ui_2d.rs b/crates/viewer/re_view_spatial/src/ui_2d.rs index bf557b8a6a07..d58897e90ac5 100644 --- a/crates/viewer/re_view_spatial/src/ui_2d.rs +++ b/crates/viewer/re_view_spatial/src/ui_2d.rs @@ -7,7 +7,7 @@ use re_renderer::view_builder::{TargetConfiguration, ViewBuilder}; use re_types::{ archetypes::Pinhole, blueprint::{ - archetypes::{Background, VisualBounds2D}, + archetypes::{Background, NearClipPlane, VisualBounds2D}, components as blueprint_components, }, components::ViewCoordinates, @@ -168,12 +168,17 @@ impl SpatialView2D { ctx.blueprint_query, query.view_id, ); + let clip_property = ViewProperty::from_archetype::( + ctx.blueprint_db(), + ctx.blueprint_query, + query.view_id, + ); // Convert ui coordinates to/from scene coordinates. let ui_from_scene = ui_from_scene(ctx, &response, self, state, &bounds_property); let scene_from_ui = ui_from_scene.inverse(); - let near_clip_plane: blueprint_components::NearClipPlane = bounds_property + let near_clip_plane: blueprint_components::NearClipPlane = clip_property .component_or_fallback(ctx, self, state) .ok_or_log_error() .unwrap_or_default(); diff --git a/crates/viewer/re_view_spatial/src/view_2d.rs b/crates/viewer/re_view_spatial/src/view_2d.rs index 89fb14ea39a3..724118f27275 100644 --- a/crates/viewer/re_view_spatial/src/view_2d.rs +++ b/crates/viewer/re_view_spatial/src/view_2d.rs @@ -6,7 +6,7 @@ use re_log_types::EntityPath; use re_types::View; use re_types::{ archetypes::{DepthImage, Image}, - blueprint::archetypes::{Background, VisualBounds2D}, + blueprint::archetypes::{Background, NearClipPlane, VisualBounds2D}, Archetype, ComponentName, ViewClassIdentifier, }; use re_ui::UiExt as _; @@ -246,6 +246,7 @@ impl ViewClass for SpatialView2D { re_ui::list_item::list_item_scope(ui, "spatial_view2d_selection_ui", |ui| { view_property_ui::(ctx, ui, view_id, self, state); + view_property_ui::(ctx, ui, view_id, self, state); view_property_ui::(ctx, ui, view_id, self, state); }); diff --git a/docs/content/reference/types/views/graph_view.md b/docs/content/reference/types/views/graph_view.md index 90a12b048c15..7e39cfc769e4 100644 --- a/docs/content/reference/types/views/graph_view.md +++ b/docs/content/reference/types/views/graph_view.md @@ -11,9 +11,6 @@ A graph view to display time-variying, directed or undirected graph visualizatio Everything within these bounds is guaranteed to be visible. Somethings outside of these bounds may also be visible due to letterboxing. - -* `range`: Controls the visible range of a 2D view. -* `near_clip_plane`: Controls the distance to the near clip plane in 3D scene units. ### `force_link` Allows to control the interaction between two nodes connected by an edge. diff --git a/docs/content/reference/types/views/spatial2d_view.md b/docs/content/reference/types/views/spatial2d_view.md index afcc55b75980..5bb3a50596e9 100644 --- a/docs/content/reference/types/views/spatial2d_view.md +++ b/docs/content/reference/types/views/spatial2d_view.md @@ -17,9 +17,6 @@ The visible parts of the scene, in the coordinate space of the scene. Everything within these bounds are guaranteed to be visible. Somethings outside of these bounds may also be visible due to letterboxing. - -* `range`: Controls the visible range of a 2D view. -* `near_clip_plane`: Controls the distance to the near clip plane in 3D scene units. ### `time_ranges` Configures which range on each timeline is shown by this view (unless specified differently per entity). diff --git a/rerun_cpp/src/rerun/blueprint/archetypes.hpp b/rerun_cpp/src/rerun/blueprint/archetypes.hpp index f29777108ae4..83bfdf51b7bd 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes.hpp @@ -13,6 +13,7 @@ #include "blueprint/archetypes/line_grid3d.hpp" #include "blueprint/archetypes/map_background.hpp" #include "blueprint/archetypes/map_zoom.hpp" +#include "blueprint/archetypes/near_clip_plane.hpp" #include "blueprint/archetypes/panel_blueprint.hpp" #include "blueprint/archetypes/plot_legend.hpp" #include "blueprint/archetypes/scalar_axis.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes index 4f4c826ff1bd..eb9e19447493 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes @@ -23,6 +23,8 @@ map_background.cpp linguist-generated=true map_background.hpp linguist-generated=true map_zoom.cpp linguist-generated=true map_zoom.hpp linguist-generated=true +near_clip_plane.cpp linguist-generated=true +near_clip_plane.hpp linguist-generated=true panel_blueprint.cpp linguist-generated=true panel_blueprint.hpp linguist-generated=true plot_legend.cpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/near_clip_plane.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/near_clip_plane.cpp new file mode 100644 index 000000000000..2e16afb302ab --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/near_clip_plane.cpp @@ -0,0 +1,41 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/near_clip_plane.fbs". + +#include "near_clip_plane.hpp" + +#include "../../collection_adapter_builtins.hpp" + +namespace rerun::blueprint::archetypes {} + +namespace rerun { + + Result> + AsComponents::serialize( + const blueprint::archetypes::NearClipPlane& archetype + ) { + using namespace blueprint::archetypes; + std::vector cells; + cells.reserve(2); + + { + auto result = ComponentBatch::from_loggable( + archetype.near_clip_plane, + ComponentDescriptor( + "rerun.blueprint.archetypes.NearClipPlane", + "near_clip_plane", + "rerun.blueprint.components.NearClipPlane" + ) + ); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + { + auto indicator = NearClipPlane::IndicatorComponent(); + auto result = ComponentBatch::from_loggable(indicator); + RR_RETURN_NOT_OK(result.error); + cells.emplace_back(std::move(result.value)); + } + + return cells; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/near_clip_plane.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/near_clip_plane.hpp new file mode 100644 index 000000000000..b01dee338d3c --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/archetypes/near_clip_plane.hpp @@ -0,0 +1,54 @@ +// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/near_clip_plane.fbs". + +#pragma once + +#include "../../blueprint/components/near_clip_plane.hpp" +#include "../../collection.hpp" +#include "../../component_batch.hpp" +#include "../../indicator_component.hpp" +#include "../../result.hpp" + +#include +#include +#include + +namespace rerun::blueprint::archetypes { + /// **Archetype**: Controls the distance to the near clip plane in 3D scene units. + struct NearClipPlane { + /// Controls the distance to the near clip plane in 3D scene units. + /// + /// Content closer than this distance will not be visible. + rerun::blueprint::components::NearClipPlane near_clip_plane; + + public: + static constexpr const char IndicatorComponentName[] = + "rerun.blueprint.components.NearClipPlaneIndicator"; + + /// Indicator component, used to identify the archetype when converting to a list of components. + using IndicatorComponent = rerun::components::IndicatorComponent; + + public: + NearClipPlane() = default; + NearClipPlane(NearClipPlane&& other) = default; + + explicit NearClipPlane(rerun::blueprint::components::NearClipPlane _near_clip_plane) + : near_clip_plane(std::move(_near_clip_plane)) {} + }; + +} // namespace rerun::blueprint::archetypes + +namespace rerun { + /// \private + template + struct AsComponents; + + /// \private + template <> + struct AsComponents { + /// Serialize all set component batches. + static Result> serialize( + const blueprint::archetypes::NearClipPlane& archetype + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.cpp index d5756b46e0ef..9326c22b3548 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.cpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.cpp @@ -15,7 +15,7 @@ namespace rerun { ) { using namespace blueprint::archetypes; std::vector cells; - cells.reserve(3); + cells.reserve(2); { auto result = ComponentBatch::from_loggable( @@ -29,18 +29,6 @@ namespace rerun { RR_RETURN_NOT_OK(result.error); cells.push_back(std::move(result.value)); } - { - auto result = ComponentBatch::from_loggable( - archetype.near_clip_plane, - ComponentDescriptor( - "rerun.blueprint.archetypes.VisualBounds2D", - "near_clip_plane", - "rerun.blueprint.components.NearClipPlane" - ) - ); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } { auto indicator = VisualBounds2D::IndicatorComponent(); auto result = ComponentBatch::from_loggable(indicator); diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.hpp index 0cf72032e464..fc0f11e560f1 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/visual_bounds2d.hpp @@ -3,7 +3,6 @@ #pragma once -#include "../../blueprint/components/near_clip_plane.hpp" #include "../../blueprint/components/visual_bounds2d.hpp" #include "../../collection.hpp" #include "../../component_batch.hpp" @@ -28,11 +27,6 @@ namespace rerun::blueprint::archetypes { /// Use this to control pan & zoom of the view. rerun::blueprint::components::VisualBounds2D range; - /// Controls the distance to the near clip plane in 3D scene units. - /// - /// Content closer than this distance will not be visible. - rerun::blueprint::components::NearClipPlane near_clip_plane; - public: static constexpr const char IndicatorComponentName[] = "rerun.blueprint.components.VisualBounds2DIndicator"; @@ -44,11 +38,8 @@ namespace rerun::blueprint::archetypes { VisualBounds2D() = default; VisualBounds2D(VisualBounds2D&& other) = default; - explicit VisualBounds2D( - rerun::blueprint::components::VisualBounds2D _range, - rerun::blueprint::components::NearClipPlane _near_clip_plane - ) - : range(std::move(_range)), near_clip_plane(std::move(_near_clip_plane)) {} + explicit VisualBounds2D(rerun::blueprint::components::VisualBounds2D _range) + : range(std::move(_range)) {} }; } // namespace rerun::blueprint::archetypes diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes index 7c61132e3f62..1d0779e1ac40 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes @@ -13,6 +13,7 @@ force_position.py linguist-generated=true line_grid3d.py linguist-generated=true map_background.py linguist-generated=true map_zoom.py linguist-generated=true +near_clip_plane.py linguist-generated=true panel_blueprint.py linguist-generated=true plot_legend.py linguist-generated=true scalar_axis.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py index 897b98f6da68..45d0221ebd08 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py @@ -13,6 +13,7 @@ from .line_grid3d import LineGrid3D from .map_background import MapBackground from .map_zoom import MapZoom +from .near_clip_plane import NearClipPlane from .panel_blueprint import PanelBlueprint from .plot_legend import PlotLegend from .scalar_axis import ScalarAxis @@ -37,6 +38,7 @@ "LineGrid3D", "MapBackground", "MapZoom", + "NearClipPlane", "PanelBlueprint", "PlotLegend", "ScalarAxis", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/near_clip_plane.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/near_clip_plane.py new file mode 100644 index 000000000000..dee3bdaccadb --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/near_clip_plane.py @@ -0,0 +1,69 @@ +# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs +# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/near_clip_plane.fbs". + +# You can extend this class by creating a "NearClipPlaneExt" class in "near_clip_plane_ext.py". + +from __future__ import annotations + +from typing import Any + +from attrs import define, field + +from ... import datatypes +from ..._baseclasses import ( + Archetype, +) +from ...blueprint import components as blueprint_components +from ...error_utils import catch_and_log_exceptions + +__all__ = ["NearClipPlane"] + + +@define(str=False, repr=False, init=False) +class NearClipPlane(Archetype): + """**Archetype**: Controls the distance to the near clip plane in 3D scene units.""" + + def __init__(self: Any, near_clip_plane: datatypes.Float32Like): + """ + Create a new instance of the NearClipPlane archetype. + + Parameters + ---------- + near_clip_plane: + Controls the distance to the near clip plane in 3D scene units. + + Content closer than this distance will not be visible. + + """ + + # You can define your own __init__ function as a member of NearClipPlaneExt in near_clip_plane_ext.py + with catch_and_log_exceptions(context=self.__class__.__name__): + self.__attrs_init__(near_clip_plane=near_clip_plane) + return + self.__attrs_clear__() + + def __attrs_clear__(self) -> None: + """Convenience method for calling `__attrs_init__` with all `None`s.""" + self.__attrs_init__( + near_clip_plane=None, # type: ignore[arg-type] + ) + + @classmethod + def _clear(cls) -> NearClipPlane: + """Produce an empty NearClipPlane, bypassing `__init__`.""" + inst = cls.__new__(cls) + inst.__attrs_clear__() + return inst + + near_clip_plane: blueprint_components.NearClipPlaneBatch = field( + metadata={"component": "required"}, + converter=blueprint_components.NearClipPlaneBatch._required, # type: ignore[misc] + ) + # Controls the distance to the near clip plane in 3D scene units. + # + # Content closer than this distance will not be visible. + # + # (Docstring intentionally commented out to hide this field from the docs) + + __str__ = Archetype.__str__ + __repr__ = Archetype.__repr__ # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d.py index 110ebd5c2d69..7a6a5159dc0b 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d.py @@ -34,7 +34,6 @@ def __attrs_clear__(self) -> None: """Convenience method for calling `__attrs_init__` with all `None`s.""" self.__attrs_init__( range=None, # type: ignore[arg-type] - near_clip_plane=None, # type: ignore[arg-type] ) @classmethod @@ -54,15 +53,5 @@ def _clear(cls) -> VisualBounds2D: # # (Docstring intentionally commented out to hide this field from the docs) - near_clip_plane: blueprint_components.NearClipPlaneBatch = field( - metadata={"component": "required"}, - converter=blueprint_components.NearClipPlaneBatch._required, # type: ignore[misc] - ) - # Controls the distance to the near clip plane in 3D scene units. - # - # Content closer than this distance will not be visible. - # - # (Docstring intentionally commented out to hide this field from the docs) - __str__ = Archetype.__str__ __repr__ = Archetype.__repr__ # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d_ext.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d_ext.py index f28c2ae1f359..05a427e30cfe 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d_ext.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/visual_bounds2d_ext.py @@ -15,7 +15,6 @@ def __init__( *, x_range: datatypes.Range1DLike | None = None, y_range: datatypes.Range1DLike | None = None, - near_clip_plane: datatypes.Float32Like | None = None, ): """ Create a new instance of the VisualBounds2D archetype. @@ -26,8 +25,6 @@ def __init__( The minimum visible range of the X-axis (usually left and right bounds). y_range: The minimum visible range of the Y-axis (usually left and right bounds). - near_clip_plane: - The distance to the near clipping plane. """ @@ -41,7 +38,6 @@ def __init__( with catch_and_log_exceptions(context=self.__class__.__name__): self.__attrs_init__( range=range, - near_clip_plane=near_clip_plane, ) return self.__attrs_clear__() From 0f810722bb0f1e434463b655fd642c73da813461 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Sat, 14 Dec 2024 15:29:33 +0100 Subject: [PATCH 59/71] Fix some assorted lints (#8460) ### What Not sure what changed to cause me to start hitting these locally in my pre-push hook, but they all seem valid. --- .../python/arkit_scenes/arkit_scenes/download_dataset.py | 8 ++++---- rerun_py/rerun_sdk/rerun/_send_columns.py | 4 ++-- rerun_py/rerun_sdk/rerun/archetypes/image_ext.py | 9 ++++++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/examples/python/arkit_scenes/arkit_scenes/download_dataset.py b/examples/python/arkit_scenes/arkit_scenes/download_dataset.py index 2ed6ca7797d5..156cf6a1c848 100644 --- a/examples/python/arkit_scenes/arkit_scenes/download_dataset.py +++ b/examples/python/arkit_scenes/arkit_scenes/download_dataset.py @@ -7,7 +7,7 @@ import subprocess import zipfile from pathlib import Path -from typing import Final +from typing import Final, Optional import pandas as pd @@ -196,14 +196,14 @@ def download_laser_scanner_point_clouds(laser_scanner_point_cloud_id: str, visit download_file(file_url, filename, laser_scanner_point_clouds_folder_path) -def get_metadata(dataset: str, download_dir: Path) -> pd.DataFrame: +def get_metadata(dataset: str, download_dir: Path) -> Optional[pd.DataFrame]: filename = "metadata.csv" url = f"{ARkitscense_url}/threedod/{filename}" if "3dod" == dataset else f"{ARkitscense_url}/{dataset}/{filename}" dst_folder = download_dir / dataset dst_file = dst_folder / filename if not download_file(url, filename, dst_folder): - return + return None metadata = pd.read_csv(dst_file) return metadata @@ -235,7 +235,7 @@ def download_data( """ metadata = get_metadata(dataset, download_dir) - if None is metadata: + if metadata is None: print(f"Error retrieving metadata for dataset {dataset}") return diff --git a/rerun_py/rerun_sdk/rerun/_send_columns.py b/rerun_py/rerun_sdk/rerun/_send_columns.py index 888ff21d6648..683d442f6053 100644 --- a/rerun_py/rerun_sdk/rerun/_send_columns.py +++ b/rerun_py/rerun_sdk/rerun/_send_columns.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Iterable, Protocol, TypeVar, Union +from typing import Iterable, Protocol, TypeVar import pyarrow as pa import rerun_bindings as bindings @@ -121,7 +121,7 @@ def as_arrow_array(self) -> pa.Array: def send_columns( entity_path: str, times: Iterable[TimeColumnLike], - components: Iterable[Union[ComponentBatchLike]], + components: Iterable[ComponentBatchLike], recording: RecordingStream | None = None, strict: bool | None = None, ) -> None: diff --git a/rerun_py/rerun_sdk/rerun/archetypes/image_ext.py b/rerun_py/rerun_sdk/rerun/archetypes/image_ext.py index 8e77711a44c7..8c31e41bfe4f 100644 --- a/rerun_py/rerun_sdk/rerun/archetypes/image_ext.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/image_ext.py @@ -18,6 +18,8 @@ from ..error_utils import _send_warning_or_raise, catch_and_log_exceptions if TYPE_CHECKING: + from PIL import Image as PILImage + ImageLike = Union[ npt.NDArray[np.float16], npt.NDArray[np.float32], @@ -30,18 +32,23 @@ npt.NDArray[np.uint32], npt.NDArray[np.uint64], npt.NDArray[np.uint8], + PILImage.Image, ] from . import EncodedImage, Image def _to_numpy(tensor: ImageLike) -> npt.NDArray[Any]: + from PIL import Image as PILImage + # isinstance is 4x faster than catching AttributeError if isinstance(tensor, np.ndarray): return tensor + if isinstance(tensor, PILImage.Image): + return np.array(tensor, copy=False) try: # Make available to the cpu - return tensor.numpy(force=True) # type: ignore[union-attr] + return tensor.numpy(force=True) # type: ignore[union-attr, no-any-return] except AttributeError: return np.array(tensor, copy=False) From b68b4e9c26cbf8bd431ed286253005220a6622f1 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 16 Dec 2024 09:51:03 +0100 Subject: [PATCH 60/71] Update to latest egui (#8469) ### Related * Part of https://github.com/rerun-io/rerun/issues/8454 (but not a complete fix) * Part of https://github.com/rerun-io/rerun/issues/8264 (will try to implement later) --- Cargo.lock | 37 +++++++++++++++--------------- Cargo.toml | 23 +++++++------------ crates/viewer/re_viewer/Cargo.toml | 1 - 3 files changed, 26 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fef05a09e3c4..86e23cf1341b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", @@ -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", @@ -1972,7 +1972,7 @@ dependencies = [ "parking_lot", "percent-encoding", "pollster 0.4.0", - "puffin", + "profiling", "raw-window-handle", "ron", "serde", @@ -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", @@ -1999,7 +1999,7 @@ dependencies = [ "epaint", "log", "nohash-hasher", - "puffin", + "profiling", "ron", "serde", ] @@ -2007,7 +2007,7 @@ dependencies = [ [[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", @@ -2015,7 +2015,7 @@ dependencies = [ "egui", "epaint", "log", - "puffin", + "profiling", "thiserror", "type-map", "web-time", @@ -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", @@ -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", @@ -2077,7 +2077,7 @@ dependencies = [ "image", "log", "mime_guess2", - "puffin", + "profiling", "resvg", "serde", ] @@ -2085,16 +2085,15 @@ dependencies = [ [[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", @@ -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", @@ -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", @@ -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", @@ -2299,7 +2298,7 @@ dependencies = [ "log", "nohash-hasher", "parking_lot", - "puffin", + "profiling", "rayon", "serde", ] @@ -2307,7 +2306,7 @@ dependencies = [ [[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" diff --git a/Cargo.toml b/Cargo.toml index f9093aa23cf5..f66d51928ef2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,7 +127,6 @@ ecolor = "0.29.1" eframe = { version = "0.29.1", default-features = false, features = [ "accesskit", "default_fonts", - "puffin", "wayland", "x11", ] } @@ -135,16 +134,10 @@ 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 @@ -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" } diff --git a/crates/viewer/re_viewer/Cargo.toml b/crates/viewer/re_viewer/Cargo.toml index ae496fc924a6..3b076ba1df97 100644 --- a/crates/viewer/re_viewer/Cargo.toml +++ b/crates/viewer/re_viewer/Cargo.toml @@ -104,7 +104,6 @@ cfg-if.workspace = true eframe = { workspace = true, default-features = false, features = [ "default_fonts", "persistence", - "puffin", "wgpu", ] } egui_plot.workspace = true From 4ccfcef667816792945c55f5d474f732f9b3f685 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:09:19 +0100 Subject: [PATCH 61/71] Add utility to `rr.components.Color` to generate colors from any string (and use it in the air traffic data example) (#8458) ### What It's some time nice to log some color information in multiple entities to make it easier to relate them visually. This PR adds a `rr.components.Color.from_str()` utility that does exactly that: generate a nice color randomly picked up based on the provided string. This PR also updates the air traffic data example so the barometric traces have matching colors with the map data. --------- Co-authored-by: Clement Rey --- .../air_traffic_data/air_traffic_data.py | 27 ++++++++++++------ rerun_py/rerun_sdk/rerun/components/color.py | 3 +- .../rerun_sdk/rerun/components/color_ext.py | 28 +++++++++++++++++++ 3 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 rerun_py/rerun_sdk/rerun/components/color_ext.py diff --git a/examples/python/air_traffic_data/air_traffic_data.py b/examples/python/air_traffic_data/air_traffic_data.py index 911c4423e69d..2e2352e0ef0c 100644 --- a/examples/python/air_traffic_data/air_traffic_data.py +++ b/examples/python/air_traffic_data/air_traffic_data.py @@ -239,6 +239,7 @@ def process_measurement(self, measurement: Measurement) -> None: ) entity_path = f"aircraft/{measurement.icao_id}" + color = rr.components.Color.from_string(entity_path) if ( measurement.latitude is not None @@ -247,13 +248,16 @@ def process_measurement(self, measurement: Measurement) -> None: ): rr.log( entity_path, - rr.Points3D([ - self._proj.transform( - measurement.longitude, - measurement.latitude, - measurement.barometric_altitude, - ) - ]), + rr.Points3D( + [ + self._proj.transform( + measurement.longitude, + measurement.latitude, + measurement.barometric_altitude, + ), + ], + colors=color, + ), rr.GeoPoints(lat_lon=[measurement.latitude, measurement.longitude]), ) @@ -264,6 +268,7 @@ def process_measurement(self, measurement: Measurement) -> None: rr.log( entity_path + "/barometric_altitude", rr.Scalar(measurement.barometric_altitude), + rr.SeriesLine(color=color), ) def flush(self) -> None: @@ -310,7 +315,13 @@ def log_position_and_altitude(self, df: polars.DataFrame, icao_id: str) -> None: return if icao_id not in self._position_indicators: - rr.log(entity_path, [rr.archetypes.Points3D.indicator(), rr.archetypes.GeoPoints.indicator()], static=True) + color = rr.components.Color.from_string(entity_path) + rr.log( + entity_path, + [rr.archetypes.Points3D.indicator(), rr.archetypes.GeoPoints.indicator(), color], + static=True, + ) + rr.log(entity_path + "/barometric_altitude", [rr.archetypes.SeriesLine.indicator(), color], static=True) self._position_indicators.add(icao_id) timestamps = rr.TimeSecondsColumn("unix_time", df["timestamp"].to_numpy()) diff --git a/rerun_py/rerun_sdk/rerun/components/color.py b/rerun_py/rerun_sdk/rerun/components/color.py index 5d72204fde68..122a0a9cfd7f 100644 --- a/rerun_py/rerun_sdk/rerun/components/color.py +++ b/rerun_py/rerun_sdk/rerun/components/color.py @@ -11,11 +11,12 @@ ComponentDescriptor, ComponentMixin, ) +from .color_ext import ColorExt __all__ = ["Color", "ColorBatch"] -class Color(datatypes.Rgba32, ComponentMixin): +class Color(ColorExt, datatypes.Rgba32, ComponentMixin): """ **Component**: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha. diff --git a/rerun_py/rerun_sdk/rerun/components/color_ext.py b/rerun_py/rerun_sdk/rerun/components/color_ext.py new file mode 100644 index 000000000000..b06d2f7c9624 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/components/color_ext.py @@ -0,0 +1,28 @@ +from __future__ import annotations + +import colorsys +import math +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from . import Color + +_GOLDEN_RATIO = (math.sqrt(5.0) - 1.0) / 2.0 + + +class ColorExt: + """Extension for [Color][rerun.components.Color].""" + + @staticmethod + def from_string(s: str) -> Color: + """ + Generate a random yet deterministic color based on a string. + + The color is guaranteed to be identical for the same input string. + """ + + from . import Color + + # adapted from egui::PlotUi + hue = (hash(s) & 0xFFFF) / 2**16 * _GOLDEN_RATIO + return Color([round(comp * 255) for comp in colorsys.hsv_to_rgb(hue, 0.85, 0.5)]) From c439c8abb37964c7fc690d84419fa6a67353db34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Mon, 16 Dec 2024 10:35:21 +0100 Subject: [PATCH 62/71] =?UTF-8?q?Attempt=20to=20fix=20`StorageNodeClient.q?= =?UTF-8?q?uery=5Fcatalog(=E2=80=A6)`=20signature=20mismatch=20(#8468)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Related CI is failing on `nightly`: https://github.com/rerun-io/rerun/actions/runs/12335447188/job/34427482723 ### What Seems to be a mismatch between doc strings. --- rerun_py/src/remote.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rerun_py/src/remote.rs b/rerun_py/src/remote.rs index b8af391dd922..a74f3a1a0666 100644 --- a/rerun_py/src/remote.rs +++ b/rerun_py/src/remote.rs @@ -81,7 +81,7 @@ pub struct PyStorageNodeClient { #[pymethods] impl PyStorageNodeClient { - /// Query the recordings metadata catalog. + /// Get the metadata for all recordings in the storage node. fn query_catalog(&mut self) -> PyResult>> { let reader = self.runtime.block_on(async { // TODO(jleibs): Support column projection and filtering From 8e2cf5f9a03bad498e41eb391e03200223e29af6 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 16 Dec 2024 10:35:41 +0100 Subject: [PATCH 63/71] Fix broken interaction outside of graph views (#8457) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Related * Closes #8454 UI interaction was sometimes broken outside of graph views. This PR is the cure. * Reverts https://github.com/rerun-io/rerun/pull/8416 --------- Co-authored-by: Jochen Görtler --- crates/viewer/re_ui/src/zoom_pan_area.rs | 86 +++++++++++++----------- crates/viewer/re_view_graph/src/view.rs | 2 +- 2 files changed, 47 insertions(+), 41 deletions(-) diff --git a/crates/viewer/re_ui/src/zoom_pan_area.rs b/crates/viewer/re_ui/src/zoom_pan_area.rs index bfb97c1ef597..f3f2530ba571 100644 --- a/crates/viewer/re_ui/src/zoom_pan_area.rs +++ b/crates/viewer/re_ui/src/zoom_pan_area.rs @@ -5,7 +5,7 @@ //! * `view`-space: The space where the pan-and-zoom area is drawn. //! * `scene`-space: The space where the actual content is drawn. -use egui::{emath::TSTransform, Area, Rect, Response, Ui, UiKind, Vec2}; +use egui::{emath::TSTransform, Rect, Response, Ui, UiBuilder, Vec2}; /// Helper function to handle pan and zoom interactions on a response. fn register_pan_and_zoom(ui: &Ui, resp: &Response, ui_from_scene: &mut TSTransform) { @@ -63,46 +63,52 @@ pub fn fit_to_rect_in_scene(rect_in_ui: Rect, rect_in_scene: Rect) -> TSTransfor } /// Provides a zoom-pan area for a given view. +/// +/// Will fill the entire `max_rect` of the `parent_ui`. pub fn zoom_pan_area( - ui: &Ui, - view_bounds_in_ui: Rect, - ui_from_scene: &mut TSTransform, + parent_ui: &mut Ui, + to_global: &mut TSTransform, draw_contents: impl FnOnce(&mut Ui), ) -> Response { - let area_resp = Area::new(ui.id().with("zoom_pan_area")) - .constrain_to(view_bounds_in_ui) - .order(ui.layer_id().order) - .kind(UiKind::GenericArea) - .show(ui.ctx(), |ui| { - // Transform to the scene space: - let visible_rect_in_scene = ui_from_scene.inverse() * view_bounds_in_ui; - - // set proper clip-rect so we can interact with the background. - ui.set_clip_rect(visible_rect_in_scene); - - // A Ui for sensing drag-to-pan, scroll-to-zoom, etc - let mut drag_sense_ui = ui.new_child( - egui::UiBuilder::new() - .sense(egui::Sense::click_and_drag()) - .max_rect(visible_rect_in_scene), - ); - - drag_sense_ui.set_min_size(visible_rect_in_scene.size()); - let pan_response = drag_sense_ui.response(); - - // Update the transform based on the interactions: - register_pan_and_zoom(ui, &pan_response, ui_from_scene); - - // Update the clip-rect with the new transform, to avoid frame-delays - ui.set_clip_rect(ui_from_scene.inverse() * view_bounds_in_ui); - - // Add the actual contents to the area: - draw_contents(ui); - pan_response - }); - - ui.ctx() - .set_transform_layer(area_resp.response.layer_id, *ui_from_scene); - - area_resp.inner + // Create a new egui paint layer, where we can draw our contents: + let zoom_pan_layer_id = egui::LayerId::new( + parent_ui.layer_id().order, + parent_ui.id().with("zoom_pan_area"), + ); + + // Put the layer directly on-top of the main layer of the ui: + parent_ui + .ctx() + .set_sublayer(parent_ui.layer_id(), zoom_pan_layer_id); + + let global_view_bounds = parent_ui.max_rect(); + + let mut local_ui = parent_ui.new_child( + UiBuilder::new() + .layer_id(zoom_pan_layer_id) + .max_rect(to_global.inverse() * global_view_bounds) + .sense(egui::Sense::click_and_drag()), + ); + local_ui.set_min_size(local_ui.max_rect().size()); // Allocate all available space + + // Set proper clip-rect so we can interact with the background: + local_ui.set_clip_rect(local_ui.max_rect()); + + let pan_response = local_ui.response(); + + // Update the `to_global` transform based on use interaction: + register_pan_and_zoom(&local_ui, &pan_response, to_global); + + // Update the clip-rect with the new transform, to avoid frame-delays + local_ui.set_clip_rect(to_global.inverse() * global_view_bounds); + + // Add the actual contents to the area: + draw_contents(&mut local_ui); + + // Tell egui to apply the transform on the layer: + local_ui + .ctx() + .set_transform_layer(zoom_pan_layer_id, *to_global); + + pan_response } diff --git a/crates/viewer/re_view_graph/src/view.rs b/crates/viewer/re_view_graph/src/view.rs index 581dd8bdcec9..edb59eceb27d 100644 --- a/crates/viewer/re_view_graph/src/view.rs +++ b/crates/viewer/re_view_graph/src/view.rs @@ -190,7 +190,7 @@ Display a graph of nodes and edges. // We store a copy of the transformation to see if it has changed. let ui_from_world_ref = ui_from_world; - let resp = zoom_pan_area(ui, rect_in_ui, &mut ui_from_world, |ui| { + let resp = zoom_pan_area(ui, &mut ui_from_world, |ui| { let mut world_bounding_rect = egui::Rect::NOTHING; for graph in &graphs { From 745e6f8d48365c3557d5d6eee0cf66cb00281d4b Mon Sep 17 00:00:00 2001 From: Zeljko Mihaljcic <7150613+zehiko@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:28:15 +0100 Subject: [PATCH 64/71] craft blueprint for Catalog view from raw chunks (#8449) --- crates/store/re_grpc_client/src/lib.rs | 137 +++++++++++++++++++++++-- 1 file changed, 130 insertions(+), 7 deletions(-) diff --git a/crates/store/re_grpc_client/src/lib.rs b/crates/store/re_grpc_client/src/lib.rs index b37c07f20137..5b6f553ee428 100644 --- a/crates/store/re_grpc_client/src/lib.rs +++ b/crates/store/re_grpc_client/src/lib.rs @@ -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; // ---------------------------------------------------------------------------- @@ -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::{ @@ -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. @@ -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, @@ -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) @@ -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, +) -> Result<(), Box> { + 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(()) +} From dd77abac475dc59d3c72f0c1bc7dd7d029b060d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Mon, 16 Dec 2024 11:53:08 +0100 Subject: [PATCH 65/71] Implement level-of-detail on text labels (#8450) ### What @emilk and I discussed level-of-details on the graph. Here is an initial experiment. Overall, I'm not sure the performance improvements warrant this addition. Discussion + video: https://rerunio.slack.com/archives/C041NHU952S/p1734084741247629 --------- Co-authored-by: Antoine Beyeler <49431240+abey79@users.noreply.github.com> --- crates/viewer/re_view_graph/src/ui/draw.rs | 76 ++++++++++++++++++++-- crates/viewer/re_view_graph/src/ui/mod.rs | 2 +- crates/viewer/re_view_graph/src/view.rs | 6 +- 3 files changed, 75 insertions(+), 9 deletions(-) diff --git a/crates/viewer/re_view_graph/src/ui/draw.rs b/crates/viewer/re_view_graph/src/ui/draw.rs index 0916e1026372..2b226f4041ca 100644 --- a/crates/viewer/re_view_graph/src/ui/draw.rs +++ b/crates/viewer/re_view_graph/src/ui/draw.rs @@ -35,6 +35,7 @@ impl DrawableLabel { } pub struct TextLabel { + color: Option, frame: Frame, galley: Arc, } @@ -44,11 +45,27 @@ pub struct CircleLabel { color: Option, } +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum LevelOfDetail { + Full, + Low, +} + +impl LevelOfDetail { + pub fn from_scaling(zoom: f32) -> Self { + if zoom < 0.20 { + Self::Low + } else { + Self::Full + } + } +} + impl DrawableLabel { pub fn size(&self) -> Vec2 { match self { Self::Circle(CircleLabel { radius, .. }) => Vec2::splat(radius * 2.0), - Self::Text(TextLabel { galley, frame }) => { + Self::Text(TextLabel { galley, frame, .. }) => { frame.inner_margin.sum() + galley.size() + Vec2::splat(frame.stroke.width * 2.0) } } @@ -82,7 +99,11 @@ impl DrawableLabel { .fill(ui.style().visuals.widgets.noninteractive.bg_fill) .stroke(Stroke::new(1.0, ui.style().visuals.text_color())); - Self::Text(TextLabel { frame, galley }) + Self::Text(TextLabel { + frame, + galley, + color, + }) } } @@ -115,7 +136,7 @@ fn draw_circle_label( } fn draw_text_label(ui: &mut Ui, label: &TextLabel, highlight: InteractionHighlight) -> Response { - let TextLabel { galley, frame } = label; + let TextLabel { galley, frame, .. } = label; let visuals = &ui.style().visuals; let bg = match highlight.hover { @@ -137,12 +158,48 @@ fn draw_text_label(ui: &mut Ui, label: &TextLabel, highlight: InteractionHighlig .inner } +/// Draw a rectangle to "fake" a label at small scales, where actual text would be unreadable anyways. +fn draw_rect_label(ui: &mut Ui, label: &TextLabel, highlight: InteractionHighlight) -> Response { + let TextLabel { + galley, + frame, + color, + } = label; + let visuals = ui.visuals(); + + let bg = match highlight.hover { + HoverHighlight::None => visuals.widgets.noninteractive.bg_fill, + HoverHighlight::Hovered => visuals.widgets.hovered.bg_fill, + }; + + let stroke = match highlight.selection { + SelectionHighlight::Selection => visuals.selection.stroke, + _ => Stroke::new(1.0, visuals.text_color()), + }; + + // We use `gamma` to correct for the fact that text is not completely solid. + let fill_color = color + .unwrap_or_else(|| visuals.text_color()) + .gamma_multiply(0.5); + + frame + .stroke(stroke) + .fill(bg) + .show(ui, |ui| { + let (resp, painter) = ui.allocate_painter(galley.rect.size(), Sense::click()); + painter.rect_filled(resp.rect, 0.0, fill_color); + resp + }) + .inner +} + /// Draws a node at the given position. fn draw_node( ui: &mut Ui, center: Pos2, node: &DrawableLabel, highlight: InteractionHighlight, + lod: LevelOfDetail, ) -> Response { let builder = UiBuilder::new() .max_rect(Rect::from_center_size(center, node.size())) @@ -152,7 +209,13 @@ fn draw_node( match node { DrawableLabel::Circle(label) => draw_circle_label(&mut node_ui, label, highlight), - DrawableLabel::Text(label) => draw_text_label(&mut node_ui, label, highlight), + DrawableLabel::Text(label) => { + if lod == LevelOfDetail::Full { + draw_text_label(&mut node_ui, label, highlight) + } else { + draw_rect_label(&mut node_ui, label, highlight) + } + } }; node_ui.response() @@ -281,6 +344,7 @@ pub fn draw_graph( graph: &Graph, layout: &Layout, query: &ViewQuery<'_>, + lod: LevelOfDetail, ) -> Rect { let entity_path = graph.entity(); let entity_highlights = query.highlights.entity_highlight(entity_path.hash()); @@ -294,7 +358,7 @@ pub fn draw_graph( let response = match node { Node::Explicit { instance, .. } => { let highlight = entity_highlights.index_highlight(instance.instance_index); - let mut response = draw_node(ui, center, node.label(), highlight); + let mut response = draw_node(ui, center, node.label(), highlight, lod); let instance_path = InstancePath::instance(entity_path.clone(), instance.instance_index); @@ -322,7 +386,7 @@ pub fn draw_graph( response } Node::Implicit { graph_node, .. } => { - draw_node(ui, center, node.label(), Default::default()).on_hover_text(format!( + draw_node(ui, center, node.label(), Default::default(), lod).on_hover_text(format!( "Implicit node {} created via a reference in a GraphEdge component", graph_node.as_str(), )) diff --git a/crates/viewer/re_view_graph/src/ui/mod.rs b/crates/viewer/re_view_graph/src/ui/mod.rs index 4e00cdfe7388..ef5e09d555fa 100644 --- a/crates/viewer/re_view_graph/src/ui/mod.rs +++ b/crates/viewer/re_view_graph/src/ui/mod.rs @@ -2,6 +2,6 @@ mod draw; mod selection; mod state; -pub use draw::{draw_debug, draw_graph, DrawableLabel}; +pub use draw::{draw_debug, draw_graph, DrawableLabel, LevelOfDetail}; pub use selection::view_property_force_ui; pub use state::GraphViewState; diff --git a/crates/viewer/re_view_graph/src/view.rs b/crates/viewer/re_view_graph/src/view.rs index edb59eceb27d..b2dfdc54d7db 100644 --- a/crates/viewer/re_view_graph/src/view.rs +++ b/crates/viewer/re_view_graph/src/view.rs @@ -28,7 +28,7 @@ use re_viewport_blueprint::ViewProperty; use crate::{ graph::Graph, layout::{ForceLayoutParams, LayoutRequest}, - ui::{draw_debug, draw_graph, view_property_force_ui, GraphViewState}, + ui::{draw_debug, draw_graph, view_property_force_ui, GraphViewState, LevelOfDetail}, visualizers::{merge, EdgesVisualizer, NodeVisualizer}, }; @@ -190,11 +190,13 @@ Display a graph of nodes and edges. // We store a copy of the transformation to see if it has changed. let ui_from_world_ref = ui_from_world; + let level_of_detail = LevelOfDetail::from_scaling(ui_from_world.scaling); + let resp = zoom_pan_area(ui, &mut ui_from_world, |ui| { let mut world_bounding_rect = egui::Rect::NOTHING; for graph in &graphs { - let graph_rect = draw_graph(ui, ctx, graph, layout, query); + let graph_rect = draw_graph(ui, ctx, graph, layout, query, level_of_detail); world_bounding_rect = world_bounding_rect.union(graph_rect); } From a8ae6f5a770dcd1ae4c2561c7c16edc25b1fd5a4 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Mon, 16 Dec 2024 14:21:26 +0100 Subject: [PATCH 66/71] Fix `re_renderer`'s wgpu error scopes not handling internal errors (#8473) Wasn't exposed in earlier wgpu versions. Usually not a problem, but when it is it's usually too late ;) --- .../src/error_handling/wgpu_error_scope.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/viewer/re_renderer/src/error_handling/wgpu_error_scope.rs b/crates/viewer/re_renderer/src/error_handling/wgpu_error_scope.rs index e9fdaf29b63b..293ae6900706 100644 --- a/crates/viewer/re_renderer/src/error_handling/wgpu_error_scope.rs +++ b/crates/viewer/re_renderer/src/error_handling/wgpu_error_scope.rs @@ -14,7 +14,7 @@ impl WgpuErrorScope { pub fn start(device: &Arc) -> Self { device.push_error_scope(wgpu::ErrorFilter::Validation); device.push_error_scope(wgpu::ErrorFilter::OutOfMemory); - // TODO(gfx-rs/wgpu#4866): Internal is missing! + device.push_error_scope(wgpu::ErrorFilter::Internal); Self { device: device.clone(), open: true, @@ -23,9 +23,13 @@ impl WgpuErrorScope { pub fn end( mut self, - ) -> [impl std::future::Future> + Send + 'static; 2] { + ) -> [impl std::future::Future> + Send + 'static; 3] { self.open = false; - [self.device.pop_error_scope(), self.device.pop_error_scope()] + [ + self.device.pop_error_scope(), + self.device.pop_error_scope(), + self.device.pop_error_scope(), + ] } } @@ -34,6 +38,7 @@ impl Drop for WgpuErrorScope { if self.open { drop(self.device.pop_error_scope()); drop(self.device.pop_error_scope()); + drop(self.device.pop_error_scope()); } } } From 40338bd3c0cbf294f26bb62e557bd2782dfdb19d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20G=C3=B6rtler?= Date: Mon, 16 Dec 2024 14:35:57 +0100 Subject: [PATCH 67/71] Fix single-click and double-click in the graph view (#8474) ### Related * Closes #8437 * Closes #8442 ### What This implements: * Single-click on empty space to select view. * Double-click on node to select entire entity. Merging @emilk's recent changes (#8469 and #8457) seems to have fixed the flickering on selection too. --- crates/viewer/re_view_graph/src/ui/draw.rs | 20 +++++++++++++++----- crates/viewer/re_view_graph/src/view.rs | 8 +++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/crates/viewer/re_view_graph/src/ui/draw.rs b/crates/viewer/re_view_graph/src/ui/draw.rs index 2b226f4041ca..70d3e03b9f17 100644 --- a/crates/viewer/re_view_graph/src/ui/draw.rs +++ b/crates/viewer/re_view_graph/src/ui/draw.rs @@ -362,11 +362,6 @@ pub fn draw_graph( let instance_path = InstancePath::instance(entity_path.clone(), instance.instance_index); - ctx.handle_select_hover_drag_interactions( - &response, - Item::DataResult(query.view_id, instance_path.clone()), - false, - ); response = response.on_hover_ui_at_pointer(|ui| { list_item::list_item_scope(ui, "graph_node_hover", |ui| { @@ -383,6 +378,21 @@ pub fn draw_graph( }); }); + ctx.handle_select_hover_drag_interactions( + &response, + Item::DataResult(query.view_id, instance_path.clone()), + false, + ); + + // double click selects the entire entity + if response.double_clicked() { + // Select the entire entity + ctx.selection_state().set_selection(Item::DataResult( + query.view_id, + instance_path.entity_path.clone().into(), + )); + } + response } Node::Implicit { graph_node, .. } => { diff --git a/crates/viewer/re_view_graph/src/view.rs b/crates/viewer/re_view_graph/src/view.rs index b2dfdc54d7db..b3227406cd51 100644 --- a/crates/viewer/re_view_graph/src/view.rs +++ b/crates/viewer/re_view_graph/src/view.rs @@ -19,7 +19,7 @@ use re_view::{ view_property_ui, }; use re_viewer_context::{ - IdentifiedViewSystem as _, RecommendedView, SystemExecutionOutput, ViewClass, + IdentifiedViewSystem as _, Item, RecommendedView, SystemExecutionOutput, ViewClass, ViewClassLayoutPriority, ViewClassRegistryError, ViewId, ViewQuery, ViewSpawnHeuristics, ViewState, ViewStateExt as _, ViewSystemExecutionError, ViewSystemRegistrator, ViewerContext, }; @@ -206,6 +206,12 @@ Display a graph of nodes and edges. } }); + if resp.clicked() { + // clicked elsewhere, select the view + ctx.selection_state() + .set_selection(Item::View(query.view_id)); + } + // Update blueprint if changed let updated_rect_in_scene = blueprint::components::VisualBounds2D::from(ui_from_world.inverse() * rect_in_ui); From 69fbaa5a0de9e1a0c73597246153071ebb91aaaa Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 16 Dec 2024 14:38:00 +0100 Subject: [PATCH 68/71] Remove wait-time when opening settings panel (#8464) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Related * Closes https://github.com/rerun-io/rerun/issues/8263 ### What I couldn't stand the half-second delay when opening the options screen. Rerun needs to feel snappy! Gettings the ffmpeg version is now done on a background thread, showing s spinner until it is done. Unfortunately we still have to wait for ffmpeg when starting up an H.264 video on native. We could fix that by pre-warming the cache though 🤔 --------- Co-authored-by: Clement Rey Co-authored-by: Andreas Reich --- Cargo.lock | 1 + crates/utils/re_video/Cargo.toml | 1 + .../re_video/src/decode/ffmpeg_h264/ffmpeg.rs | 2 +- .../src/decode/ffmpeg_h264/version.rs | 143 +++++++++++------- .../re_viewer/src/ui/settings_screen.rs | 13 +- 5 files changed, 103 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86e23cf1341b..f119af130c21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6511,6 +6511,7 @@ dependencies = [ "js-sys", "once_cell", "parking_lot", + "poll-promise", "re_build_info", "re_build_tools", "re_log", diff --git a/crates/utils/re_video/Cargo.toml b/crates/utils/re_video/Cargo.toml index 2188bdb102ed..890c7441faf9 100644 --- a/crates/utils/re_video/Cargo.toml +++ b/crates/utils/re_video/Cargo.toml @@ -53,6 +53,7 @@ econtext.workspace = true itertools.workspace = true once_cell.workspace = true parking_lot.workspace = true +poll-promise.workspace = true re_mp4.workspace = true thiserror.workspace = true diff --git a/crates/utils/re_video/src/decode/ffmpeg_h264/ffmpeg.rs b/crates/utils/re_video/src/decode/ffmpeg_h264/ffmpeg.rs index 3f8775ab8005..d48f647aa979 100644 --- a/crates/utils/re_video/src/decode/ffmpeg_h264/ffmpeg.rs +++ b/crates/utils/re_video/src/decode/ffmpeg_h264/ffmpeg.rs @@ -811,7 +811,7 @@ impl FFmpegCliH264Decoder { // Check the version once ahead of running FFmpeg. // The error is still handled if it happens while running FFmpeg, but it's a bit unclear if we can get it to start in the first place then. - match FFmpegVersion::for_executable(ffmpeg_path.as_deref()) { + match FFmpegVersion::for_executable_blocking(ffmpeg_path.as_deref()) { Ok(version) => { if !version.is_compatible() { return Err(Error::UnsupportedFFmpegVersion { diff --git a/crates/utils/re_video/src/decode/ffmpeg_h264/version.rs b/crates/utils/re_video/src/decode/ffmpeg_h264/version.rs index a23feaaa14e2..5842108d2fac 100644 --- a/crates/utils/re_video/src/decode/ffmpeg_h264/version.rs +++ b/crates/utils/re_video/src/decode/ffmpeg_h264/version.rs @@ -1,7 +1,8 @@ -use std::{collections::HashMap, path::PathBuf}; +use std::{collections::HashMap, path::PathBuf, task::Poll}; use once_cell::sync::Lazy; use parking_lot::Mutex; +use poll_promise::Promise; // FFmpeg 5.1 "Riemann" is from 2022-07-22. // It's simply the oldest I tested manually as of writing. We might be able to go lower. @@ -9,6 +10,8 @@ use parking_lot::Mutex; pub const FFMPEG_MINIMUM_VERSION_MAJOR: u32 = 5; pub const FFMPEG_MINIMUM_VERSION_MINOR: u32 = 1; +pub type FfmpegVersionResult = Result; + /// A successfully parsed `FFmpeg` version. #[derive(Clone, Debug, PartialEq, Eq)] pub struct FFmpegVersion { @@ -78,61 +81,31 @@ impl FFmpegVersion { /// version string. Since version strings can get pretty wild, we don't want to fail in this case. /// /// Internally caches the result per path together with its modification time to re-run/parse the version only if the file has changed. - pub fn for_executable(path: Option<&std::path::Path>) -> Result { - type VersionMap = HashMap< - PathBuf, - ( - Option, - Result, - ), - >; - static CACHE: Lazy> = Lazy::new(|| Mutex::new(HashMap::new())); - + pub fn for_executable_poll(path: Option<&std::path::Path>) -> Poll { re_tracing::profile_function!(); - // Retrieve file modification time first. - let modification_time = if let Some(path) = path { - path.metadata() - .map_err(|err| { - FFmpegVersionParseError::RetrieveFileModificationTime(err.to_string()) - })? - .modified() - .ok() - } else { - None - }; - - // Check first if we already have the version cached. - let mut cache = CACHE.lock(); - let cache_key = path.unwrap_or(std::path::Path::new("ffmpeg")); - if let Some(cached) = cache.get(cache_key) { - if modification_time == cached.0 { - return cached.1.clone(); - } - } - - // Run FFmpeg (or whatever was passed to us) to get the version. - let raw_version = if let Some(path) = path { - ffmpeg_sidecar::version::ffmpeg_version_with_path(path) - } else { - ffmpeg_sidecar::version::ffmpeg_version() - } - .map_err(|err| FFmpegVersionParseError::RunFFmpeg(err.to_string()))?; - - let version = if let Some(version) = Self::parse(&raw_version) { - Ok(version) - } else { - Err(FFmpegVersionParseError::ParseVersion { - raw_version: raw_version.clone(), - }) - }; + let modification_time = file_modification_time(path)?; + VersionCache::global(|cache| { + cache + .version(path, modification_time) + .poll() + .map(|r| r.clone()) + }) + } - cache.insert( - cache_key.to_path_buf(), - (modification_time, version.clone()), - ); + /// Like [`Self::for_executable_poll`], but blocks until the version is ready. + /// + /// WARNING: this blocks for half a second on Mac the first time this is called with a given path, maybe more on other platforms. + pub fn for_executable_blocking(path: Option<&std::path::Path>) -> FfmpegVersionResult { + re_tracing::profile_function!(); - version + let modification_time = file_modification_time(path)?; + VersionCache::global(|cache| { + cache + .version(path, modification_time) + .block_until_ready() + .clone() + }) } /// Returns true if this version is compatible with Rerun's minimum requirements. @@ -143,6 +116,72 @@ impl FFmpegVersion { } } +fn file_modification_time( + path: Option<&std::path::Path>, +) -> Result, FFmpegVersionParseError> { + Ok(if let Some(path) = path { + path.metadata() + .map_err(|err| FFmpegVersionParseError::RetrieveFileModificationTime(err.to_string()))? + .modified() + .ok() + } else { + None + }) +} + +#[derive(Default)] +struct VersionCache( + HashMap, Promise)>, +); + +impl VersionCache { + fn global(f: impl FnOnce(&mut Self) -> R) -> R { + static CACHE: Lazy> = Lazy::new(|| Mutex::new(VersionCache::default())); + f(&mut CACHE.lock()) + } + + fn version( + &mut self, + path: Option<&std::path::Path>, + modification_time: Option, + ) -> &Promise { + let Self(cache) = self; + + let cache_key = path.unwrap_or(std::path::Path::new("ffmpeg")).to_path_buf(); + + match cache.entry(cache_key) { + std::collections::hash_map::Entry::Occupied(entry) => &entry.into_mut().1, + std::collections::hash_map::Entry::Vacant(entry) => { + let path = path.map(|path| path.to_path_buf()); + let version = + Promise::spawn_thread("ffmpeg_version", move || ffmpeg_version(path.as_ref())); + &entry.insert((modification_time, version)).1 + } + } + } +} + +fn ffmpeg_version( + path: Option<&std::path::PathBuf>, +) -> Result { + re_tracing::profile_function!("ffmpeg_version_with_path"); + + let raw_version = if let Some(path) = path { + ffmpeg_sidecar::version::ffmpeg_version_with_path(path) + } else { + ffmpeg_sidecar::version::ffmpeg_version() + } + .map_err(|err| FFmpegVersionParseError::RunFFmpeg(err.to_string()))?; + + if let Some(version) = FFmpegVersion::parse(&raw_version) { + Ok(version) + } else { + Err(FFmpegVersionParseError::ParseVersion { + raw_version: raw_version.clone(), + }) + } +} + #[cfg(test)] mod tests { use crate::decode::ffmpeg_h264::FFmpegVersion; diff --git a/crates/viewer/re_viewer/src/ui/settings_screen.rs b/crates/viewer/re_viewer/src/ui/settings_screen.rs index 2a0aa8b88cf1..21d57618d148 100644 --- a/crates/viewer/re_viewer/src/ui/settings_screen.rs +++ b/crates/viewer/re_viewer/src/ui/settings_screen.rs @@ -203,6 +203,7 @@ fn video_section_ui(ui: &mut Ui, app_options: &mut AppOptions) { #[cfg(not(target_arch = "wasm32"))] fn ffmpeg_path_status_ui(ui: &mut Ui, app_options: &AppOptions) { use re_video::decode::{FFmpegVersion, FFmpegVersionParseError}; + use std::task::Poll; let path = app_options .video_decoder_override_ffmpeg_path @@ -211,17 +212,21 @@ fn ffmpeg_path_status_ui(ui: &mut Ui, app_options: &AppOptions) { if path.is_some_and(|path| !path.is_file()) { ui.error_label("The specified FFmpeg binary path does not exist or is not a file."); } else { - let res = FFmpegVersion::for_executable(path); + let res = FFmpegVersion::for_executable_poll(path); match res { - Ok(version) => { + Poll::Pending => { + ui.spinner(); + } + + Poll::Ready(Ok(version)) => { if version.is_compatible() { ui.success_label(format!("FFmpeg found (version {version})")); } else { ui.error_label(format!("Incompatible FFmpeg version: {version}")); } } - Err(FFmpegVersionParseError::ParseVersion { raw_version }) => { + Poll::Ready(Err(FFmpegVersionParseError::ParseVersion { raw_version })) => { // We make this one a warning instead of an error because version parsing is flaky, and // it might end up still working. ui.warning_label(format!( @@ -229,7 +234,7 @@ fn ffmpeg_path_status_ui(ui: &mut Ui, app_options: &AppOptions) { )); } - Err(err) => { + Poll::Ready(Err(err)) => { ui.error_label(format!("Unable to check FFmpeg version: {err}")); } } From c385877f12b3221a45f163e51cc2bb78b863d3ab Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 16 Dec 2024 14:55:11 +0100 Subject: [PATCH 69/71] Update to re_arrow2 0.18 (#8480) --- Cargo.lock | 5 +++-- Cargo.toml | 6 +----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f119af130c21..1dba7ac4c891 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5527,8 +5527,9 @@ dependencies = [ [[package]] name = "re_arrow2" -version = "0.17.6" -source = "git+https://github.com/rerun-io/re_arrow2?rev=79ba149e823c88c1baa770a33c6ea8b6244d0597#79ba149e823c88c1baa770a33c6ea8b6244d0597" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f046c5679b0f305d610f80d93fd51ad702cfc077bbe16d9553a1660a2505160" dependencies = [ "ahash", "arrow-array", diff --git a/Cargo.toml b/Cargo.toml index f66d51928ef2..da9eb50051ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -152,7 +152,7 @@ arboard = { version = "3.2", default-features = false } argh = "0.1.12" array-init = "2.1" arrow = { version = "53.1", default-features = false } -arrow2 = { package = "re_arrow2", version = "0.17" } +arrow2 = { package = "re_arrow2", version = "0.18" } async-executor = "1.0" backtrace = "0.3" bincode = "1.3" @@ -580,8 +580,4 @@ egui_tiles = { git = "https://github.com/rerun-io/egui_tiles", rev = "48e0ef5664 # walkers = { git = "https://github.com/rerun-io/walkers", rev = "8939cceb3fa49ca8648ee16fe1d8432f5ab0bdcc" } # https://github.com/podusowski/walkers/pull/222 -# commit on `rerun-io/re_arrow2` `main` branch -# https://github.com/rerun-io/re_arrow2/commit/79ba149e823c88c1baa770a33c6ea8b6244d0597 -re_arrow2 = { git = "https://github.com/rerun-io/re_arrow2", rev = "79ba149e823c88c1baa770a33c6ea8b6244d0597" } - # dav1d = { path = "/home/cmc/dev/rerun-io/rav1d", package = "re_rav1d", version = "0.1.1" } From 671b25bfc8abc4d72e02abf2ebf554040b2c5e48 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Mon, 16 Dec 2024 15:23:30 +0100 Subject: [PATCH 70/71] Fix double click no longer selecting the entire entity in 2d/3d views (#8482) * Fixes https://github.com/rerun-io/rerun/issues/8481 --- .../viewer/re_viewer_context/src/viewer_context.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/viewer/re_viewer_context/src/viewer_context.rs b/crates/viewer/re_viewer_context/src/viewer_context.rs index 1b1d470dc7c5..e59ac19ed921 100644 --- a/crates/viewer/re_viewer_context/src/viewer_context.rs +++ b/crates/viewer/re_viewer_context/src/viewer_context.rs @@ -191,12 +191,14 @@ impl ViewerContext<'_> { }; egui::DragAndDrop::set_payload(&response.ctx, payload); - } else if response.double_clicked() { - if let Some(item) = selection.first_item() { - self.command_sender - .send_system(crate::SystemCommand::SetFocus(item.clone())); - } } else if response.clicked() { + if response.double_clicked() { + if let Some(item) = selection.first_item() { + self.command_sender + .send_system(crate::SystemCommand::SetFocus(item.clone())); + } + } + if response.ctx.input(|i| i.modifiers.command) { selection_state.toggle_selection(selection); } else { From 947d708e6394819c3ca8caf0aac51decb038653c Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:32:12 +0100 Subject: [PATCH 71/71] Update thumbnail for air traffic example (#8483) --- examples/python/air_traffic_data/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/python/air_traffic_data/README.md b/examples/python/air_traffic_data/README.md index 547250193364..22601a0d080d 100644 --- a/examples/python/air_traffic_data/README.md +++ b/examples/python/air_traffic_data/README.md @@ -2,8 +2,8 @@ title = "Air traffic data" tags = ["2D", "3D", "map", "crs"] description = "Display aircraft traffic data" -thumbnail = "https://static.rerun.io/air_traffic_data/4a68b46a404c4f9e3c082f57a8a8ed4bf5b9b236/480w.png" -thumbnail_dimensions = [480, 294] +thumbnail = "https://static.rerun.io/air_traffic_data/348dd2def3a55fd0bf481a35a0765eeacfa20b6f/480w.png" +thumbnail_dimensions = [480, 480] channel = "nightly" -->