From ffcd4aeac8c9dbfe14a8bff66ccdc2685488cf59 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 15:46:57 +0100 Subject: [PATCH 01/14] Introduce new attribute for scope --- crates/re_types/definitions/rerun/attributes.fbs | 5 +++++ crates/re_types_builder/src/lib.rs | 1 + 2 files changed, 6 insertions(+) diff --git a/crates/re_types/definitions/rerun/attributes.fbs b/crates/re_types/definitions/rerun/attributes.fbs index e71707e3944e..46feb0e19aa4 100644 --- a/crates/re_types/definitions/rerun/attributes.fbs +++ b/crates/re_types/definitions/rerun/attributes.fbs @@ -24,3 +24,8 @@ attribute "attr.rerun.component_optional"; /// /// For lists this will apply to the inner element. attribute "attr.rerun.override_type"; + +/// Set the scope of the type +/// +/// This is used for example to scope blueprint types. +attribute "attr.rerun.scope"; diff --git a/crates/re_types_builder/src/lib.rs b/crates/re_types_builder/src/lib.rs index 7a380927e54a..c57ffe7bc82a 100644 --- a/crates/re_types_builder/src/lib.rs +++ b/crates/re_types_builder/src/lib.rs @@ -170,6 +170,7 @@ pub const ATTR_RERUN_COMPONENT_OPTIONAL: &str = "attr.rerun.component_optional"; pub const ATTR_RERUN_COMPONENT_RECOMMENDED: &str = "attr.rerun.component_recommended"; pub const ATTR_RERUN_COMPONENT_REQUIRED: &str = "attr.rerun.component_required"; pub const ATTR_RERUN_OVERRIDE_TYPE: &str = "attr.rerun.override_type"; +pub const ATTR_RERUN_SCOPE: &str = "attr.rerun.scope"; pub const ATTR_PYTHON_ALIASES: &str = "attr.python.aliases"; pub const ATTR_PYTHON_ARRAY_ALIASES: &str = "attr.python.array_aliases"; From dceba3762dc5264397c5fc63ed582d0fbfe23950 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 16:15:26 +0100 Subject: [PATCH 02/14] Refactor blueprint as a scope --- .../re_types/definitions/rerun/blueprint.fbs | 19 ++++++++++------ .../{ => components}/auto_space_views.fbs | 3 ++- .../entity_properties_component.fbs | 3 ++- .../blueprint/{ => components}/panel_view.fbs | 3 ++- .../components/query_expressions.fbs | 21 ++++++++++++++++++ .../components/space_view_component.fbs | 22 +++++++++++++++++++ .../{ => components}/space_view_maximized.fbs | 3 ++- .../blueprint/components/viewport_layout.fbs | 21 ++++++++++++++++++ .../{ => datatypes}/query_expressions.fbs | 3 ++- .../{ => datatypes}/space_view_component.fbs | 3 ++- .../{ => datatypes}/viewport_layout.fbs | 3 ++- crates/re_types_builder/src/objects.rs | 21 ++++++++++-------- 12 files changed, 102 insertions(+), 23 deletions(-) rename crates/re_types/definitions/rerun/blueprint/{ => components}/auto_space_views.fbs (88%) rename crates/re_types/definitions/rerun/blueprint/{ => components}/entity_properties_component.fbs (87%) rename crates/re_types/definitions/rerun/blueprint/{ => components}/panel_view.fbs (84%) create mode 100644 crates/re_types/definitions/rerun/blueprint/components/query_expressions.fbs create mode 100644 crates/re_types/definitions/rerun/blueprint/components/space_view_component.fbs rename crates/re_types/definitions/rerun/blueprint/{ => components}/space_view_maximized.fbs (89%) create mode 100644 crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs rename crates/re_types/definitions/rerun/blueprint/{ => datatypes}/query_expressions.fbs (89%) rename crates/re_types/definitions/rerun/blueprint/{ => datatypes}/space_view_component.fbs (94%) rename crates/re_types/definitions/rerun/blueprint/{ => datatypes}/viewport_layout.fbs (90%) diff --git a/crates/re_types/definitions/rerun/blueprint.fbs b/crates/re_types/definitions/rerun/blueprint.fbs index dff873ecab38..66bc31fa503d 100644 --- a/crates/re_types/definitions/rerun/blueprint.fbs +++ b/crates/re_types/definitions/rerun/blueprint.fbs @@ -1,7 +1,12 @@ -include "./blueprint/auto_space_views.fbs"; -include "./blueprint/entity_properties_component.fbs"; -include "./blueprint/panel_view.fbs"; -include "./blueprint/space_view_component.fbs"; -include "./blueprint/space_view_maximized.fbs"; -include "./blueprint/viewport_layout.fbs"; -include "./blueprint/query_expressions.fbs"; +include "./blueprint/datatypes/query_expressions.fbs"; +include "./blueprint/datatypes/space_view_component.fbs"; +include "./blueprint/datatypes/viewport_layout.fbs"; + +include "./blueprint/components/auto_space_views.fbs"; +include "./blueprint/components/entity_properties_component.fbs"; +include "./blueprint/components/panel_view.fbs"; +include "./blueprint/components/query_expressions.fbs"; +include "./blueprint/components/space_view_component.fbs"; +include "./blueprint/components/space_view_maximized.fbs"; +include "./blueprint/components/viewport_layout.fbs"; + diff --git a/crates/re_types/definitions/rerun/blueprint/auto_space_views.fbs b/crates/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs similarity index 88% rename from crates/re_types/definitions/rerun/blueprint/auto_space_views.fbs rename to crates/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs index 2ad9bcd27aaf..8debda658a3b 100644 --- a/crates/re_types/definitions/rerun/blueprint/auto_space_views.fbs +++ b/crates/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs @@ -5,7 +5,7 @@ include "rust/attributes.fbs"; include "rerun/datatypes.fbs"; include "rerun/attributes.fbs"; -namespace rerun.blueprint; +namespace rerun.blueprint.components; // --- @@ -14,6 +14,7 @@ namespace rerun.blueprint; /// Unstable. Used for the ongoing blueprint experimentations. struct AutoSpaceViews ( "attr.arrow.transparent", + "attr.rerun.scope": "blueprint", "attr.rust.derive": "Copy, Default", "attr.rust.override_crate": "re_viewport", "attr.rust.repr": "transparent", diff --git a/crates/re_types/definitions/rerun/blueprint/entity_properties_component.fbs b/crates/re_types/definitions/rerun/blueprint/components/entity_properties_component.fbs similarity index 87% rename from crates/re_types/definitions/rerun/blueprint/entity_properties_component.fbs rename to crates/re_types/definitions/rerun/blueprint/components/entity_properties_component.fbs index de694c0d5faa..0f2352de563a 100644 --- a/crates/re_types/definitions/rerun/blueprint/entity_properties_component.fbs +++ b/crates/re_types/definitions/rerun/blueprint/components/entity_properties_component.fbs @@ -5,7 +5,7 @@ include "rust/attributes.fbs"; include "rerun/datatypes.fbs"; include "rerun/attributes.fbs"; -namespace rerun.blueprint; +namespace rerun.blueprint.components; // --- @@ -13,6 +13,7 @@ namespace rerun.blueprint; /// /// Unstable. Used for the ongoing blueprint experimentations. table EntityPropertiesComponent ( + "attr.rerun.scope": "blueprint", "attr.rust.derive_only": "Clone", "attr.rust.override_crate": "re_data_store" ) { diff --git a/crates/re_types/definitions/rerun/blueprint/panel_view.fbs b/crates/re_types/definitions/rerun/blueprint/components/panel_view.fbs similarity index 84% rename from crates/re_types/definitions/rerun/blueprint/panel_view.fbs rename to crates/re_types/definitions/rerun/blueprint/components/panel_view.fbs index a98f56b2edcc..f6b5e7a65315 100644 --- a/crates/re_types/definitions/rerun/blueprint/panel_view.fbs +++ b/crates/re_types/definitions/rerun/blueprint/components/panel_view.fbs @@ -5,7 +5,7 @@ include "rust/attributes.fbs"; include "rerun/datatypes.fbs"; include "rerun/attributes.fbs"; -namespace rerun.blueprint; +namespace rerun.blueprint.components; // --- @@ -13,6 +13,7 @@ namespace rerun.blueprint; /// /// Unstable. Used for the ongoing blueprint experimentations. struct PanelView ( + "attr.rerun.scope": "blueprint", "attr.rust.derive": "Copy", "attr.rust.override_crate": "re_viewer" ) { diff --git a/crates/re_types/definitions/rerun/blueprint/components/query_expressions.fbs b/crates/re_types/definitions/rerun/blueprint/components/query_expressions.fbs new file mode 100644 index 000000000000..470a735d12a7 --- /dev/null +++ b/crates/re_types/definitions/rerun/blueprint/components/query_expressions.fbs @@ -0,0 +1,21 @@ +include "arrow/attributes.fbs"; +include "python/attributes.fbs"; +include "rust/attributes.fbs"; + +include "rerun/datatypes.fbs"; +include "rerun/attributes.fbs"; + +namespace rerun.blueprint.components; + +// --- + +/// A set of expressions used for a `DataQueryBlueprint`. +/// +/// Unstable. Used for the ongoing blueprint experimentations. +table QueryExpressions ( + "attr.rerun.scope": "blueprint", + "attr.rust.derive": "PartialEq, Eq", + "attr.rust.override_crate": "re_space_view" +) { + expressions: rerun.blueprint.datatypes.QueryExpressions (order: 100); +} diff --git a/crates/re_types/definitions/rerun/blueprint/components/space_view_component.fbs b/crates/re_types/definitions/rerun/blueprint/components/space_view_component.fbs new file mode 100644 index 000000000000..c1cd18aa5d91 --- /dev/null +++ b/crates/re_types/definitions/rerun/blueprint/components/space_view_component.fbs @@ -0,0 +1,22 @@ +include "arrow/attributes.fbs"; +include "docs/attributes.fbs"; +include "python/attributes.fbs"; +include "rust/attributes.fbs"; + +include "rerun/attributes.fbs"; +include "rerun/datatypes.fbs"; + +namespace rerun.blueprint.components; + +// --- + +/// A view of a space. +/// +/// Unstable. Used for the ongoing blueprint experimentations. +table SpaceViewComponent ( + "attr.rerun.scope": "blueprint", + "attr.docs.unreleased", + "attr.rust.derive_only": "Clone" +) { + component: rerun.blueprint.datatypes.SpaceViewComponent (order: 100); +} diff --git a/crates/re_types/definitions/rerun/blueprint/space_view_maximized.fbs b/crates/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs similarity index 89% rename from crates/re_types/definitions/rerun/blueprint/space_view_maximized.fbs rename to crates/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs index eddc22249cb2..1832c10fe575 100644 --- a/crates/re_types/definitions/rerun/blueprint/space_view_maximized.fbs +++ b/crates/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs @@ -5,7 +5,7 @@ include "rust/attributes.fbs"; include "rerun/datatypes.fbs"; include "rerun/attributes.fbs"; -namespace rerun.blueprint; +namespace rerun.blueprint.components; // --- @@ -14,6 +14,7 @@ namespace rerun.blueprint; /// Unstable. Used for the ongoing blueprint experimentations. table SpaceViewMaximized ( "attr.arrow.transparent", + "attr.rerun.scope": "blueprint", "attr.rust.derive": "Copy, Default, PartialEq, Eq", "attr.rust.override_crate": "re_viewport", "attr.rust.repr": "transparent", diff --git a/crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs b/crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs new file mode 100644 index 000000000000..0a0939a8fa20 --- /dev/null +++ b/crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs @@ -0,0 +1,21 @@ +include "arrow/attributes.fbs"; +include "python/attributes.fbs"; +include "rust/attributes.fbs"; + +include "rerun/datatypes.fbs"; +include "rerun/attributes.fbs"; + +namespace rerun.blueprint.components; + +// --- + +/// A view of a space. +/// +/// Unstable. Used for the ongoing blueprint experimentations. +table ViewportLayout ( + "attr.rerun.scope": "blueprint", + "attr.rust.derive": "PartialEq", + "attr.rust.override_crate": "re_viewport" +) { + viewport_layout: rerun.blueprint.datatypes.ViewportLayout (order: 100); +} diff --git a/crates/re_types/definitions/rerun/blueprint/query_expressions.fbs b/crates/re_types/definitions/rerun/blueprint/datatypes/query_expressions.fbs similarity index 89% rename from crates/re_types/definitions/rerun/blueprint/query_expressions.fbs rename to crates/re_types/definitions/rerun/blueprint/datatypes/query_expressions.fbs index d4f9e2af279a..df0b877801d9 100644 --- a/crates/re_types/definitions/rerun/blueprint/query_expressions.fbs +++ b/crates/re_types/definitions/rerun/blueprint/datatypes/query_expressions.fbs @@ -5,7 +5,7 @@ include "rust/attributes.fbs"; include "rerun/datatypes.fbs"; include "rerun/attributes.fbs"; -namespace rerun.blueprint; +namespace rerun.blueprint.datatypes; // --- @@ -13,6 +13,7 @@ namespace rerun.blueprint; /// /// Unstable. Used for the ongoing blueprint experimentations. table QueryExpressions ( + "attr.rerun.scope": "blueprint", "attr.rust.derive": "PartialEq, Eq", "attr.rust.override_crate": "re_space_view" ) { diff --git a/crates/re_types/definitions/rerun/blueprint/space_view_component.fbs b/crates/re_types/definitions/rerun/blueprint/datatypes/space_view_component.fbs similarity index 94% rename from crates/re_types/definitions/rerun/blueprint/space_view_component.fbs rename to crates/re_types/definitions/rerun/blueprint/datatypes/space_view_component.fbs index 92ea4a168620..ab6d3232d538 100644 --- a/crates/re_types/definitions/rerun/blueprint/space_view_component.fbs +++ b/crates/re_types/definitions/rerun/blueprint/datatypes/space_view_component.fbs @@ -6,7 +6,7 @@ include "rust/attributes.fbs"; include "rerun/attributes.fbs"; include "rerun/datatypes.fbs"; -namespace rerun.blueprint; +namespace rerun.blueprint.datatypes; // --- @@ -14,6 +14,7 @@ namespace rerun.blueprint; /// /// Unstable. Used for the ongoing blueprint experimentations. table SpaceViewComponent ( + "attr.rerun.scope": "blueprint", "attr.docs.unreleased", "attr.rust.derive_only": "Clone" ) { diff --git a/crates/re_types/definitions/rerun/blueprint/viewport_layout.fbs b/crates/re_types/definitions/rerun/blueprint/datatypes/viewport_layout.fbs similarity index 90% rename from crates/re_types/definitions/rerun/blueprint/viewport_layout.fbs rename to crates/re_types/definitions/rerun/blueprint/datatypes/viewport_layout.fbs index 381c97573ee3..3fa89c26eae9 100644 --- a/crates/re_types/definitions/rerun/blueprint/viewport_layout.fbs +++ b/crates/re_types/definitions/rerun/blueprint/datatypes/viewport_layout.fbs @@ -5,7 +5,7 @@ include "rust/attributes.fbs"; include "rerun/datatypes.fbs"; include "rerun/attributes.fbs"; -namespace rerun.blueprint; +namespace rerun.blueprint.datatypes; // --- @@ -13,6 +13,7 @@ namespace rerun.blueprint; /// /// Unstable. Used for the ongoing blueprint experimentations. table ViewportLayout ( + "attr.rerun.scope": "blueprint", "attr.rust.derive": "PartialEq", "attr.rust.override_crate": "re_viewport" ) { diff --git a/crates/re_types_builder/src/objects.rs b/crates/re_types_builder/src/objects.rs index 97c858a9926e..53a3ef111001 100644 --- a/crates/re_types_builder/src/objects.rs +++ b/crates/re_types_builder/src/objects.rs @@ -204,15 +204,18 @@ impl ObjectKind { ]; // TODO(#2364): use an attr instead of the path - pub fn from_pkg_name(pkg_name: impl AsRef) -> Self { + pub fn from_pkg_name(pkg_name: impl AsRef, attrs: &Attributes) -> Self { + let scope = match attrs.try_get::(pkg_name.as_ref(), crate::ATTR_RERUN_SCOPE) { + Some(scope) => format!(".{scope}"), + None => "".to_owned(), + }; + let pkg_name = pkg_name.as_ref().replace(".testing", ""); - if pkg_name.starts_with("rerun.datatypes") { + if pkg_name.starts_with(format!("rerun{scope}.datatypes").as_str()) { ObjectKind::Datatype - } else if pkg_name.starts_with("rerun.blueprint") { - ObjectKind::Blueprint - } else if pkg_name.starts_with("rerun.components") { + } else if pkg_name.starts_with(format!("rerun{scope}.components").as_str()) { ObjectKind::Component - } else if pkg_name.starts_with("rerun.archetypes") { + } else if pkg_name.starts_with(format!("rerun{scope}.archetypes").as_str()) { ObjectKind::Archetype } else { panic!("unknown package {pkg_name:?}"); @@ -466,8 +469,8 @@ impl Object { ); let docs = Docs::from_raw_docs(&filepath, obj.documentation()); - let kind = ObjectKind::from_pkg_name(&pkg_name); let attrs = Attributes::from_raw_attrs(obj.attributes()); + let kind = ObjectKind::from_pkg_name(&pkg_name, &attrs); let fields: Vec<_> = { let mut fields: Vec<_> = obj @@ -543,9 +546,9 @@ impl Object { let filepath = filepath_from_declaration_file(include_dir_path, &virtpath); let docs = Docs::from_raw_docs(&filepath, enm.documentation()); - let kind = ObjectKind::from_pkg_name(&pkg_name); - let attrs = Attributes::from_raw_attrs(enm.attributes()); + let kind = ObjectKind::from_pkg_name(&pkg_name, &attrs); + let utype = { if enm.underlying_type().base_type() == FbsBaseType::UType { // This is a union. From 2161f83d299f5da8b1b6963994849bfa38a7711c Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 17:16:08 +0100 Subject: [PATCH 03/14] Remove ObjectKind::Blueprint --- .../re_types_builder/src/codegen/cpp/mod.rs | 2 +- .../re_types_builder/src/codegen/docs/mod.rs | 9 ++- crates/re_types_builder/src/codegen/python.rs | 71 +++++++++++++++---- .../re_types_builder/src/codegen/rust/api.rs | 2 +- crates/re_types_builder/src/objects.rs | 15 ++-- 5 files changed, 69 insertions(+), 30 deletions(-) diff --git a/crates/re_types_builder/src/codegen/cpp/mod.rs b/crates/re_types_builder/src/codegen/cpp/mod.rs index c9dc96450621..9758ac158b29 100644 --- a/crates/re_types_builder/src/codegen/cpp/mod.rs +++ b/crates/re_types_builder/src/codegen/cpp/mod.rs @@ -336,7 +336,7 @@ impl QuotedObject { ) -> Self { match obj.specifics { crate::ObjectSpecifics::Struct => match obj.kind { - ObjectKind::Datatype | ObjectKind::Component | ObjectKind::Blueprint => { + ObjectKind::Datatype | ObjectKind::Component => { Self::from_struct(objects, obj, hpp_includes, hpp_type_extensions) } ObjectKind::Archetype => { diff --git a/crates/re_types_builder/src/codegen/docs/mod.rs b/crates/re_types_builder/src/codegen/docs/mod.rs index 94ce7de45de0..891850e73c04 100644 --- a/crates/re_types_builder/src/codegen/docs/mod.rs +++ b/crates/re_types_builder/src/codegen/docs/mod.rs @@ -49,11 +49,15 @@ impl CodeGenerator for DocsCodeGenerator { continue; } + // Skip blueprint stuff, too early + if object.scope() == Some("blueprint".to_owned()) { + continue; + } + match object.kind { ObjectKind::Datatype => datatypes.push(object), ObjectKind::Component => components.push(object), ObjectKind::Archetype => archetypes.push(object), - ObjectKind::Blueprint => continue, // skip blueprint stuff, too early } let page = object_page(reporter, object, object_map); @@ -152,7 +156,6 @@ fn object_page(reporter: &Reporter, object: &Object, object_map: &ObjectMap) -> write_fields(&mut page, object, object_map); } ObjectKind::Archetype => write_archetype_fields(&mut page, object, object_map), - ObjectKind::Blueprint => {} } { @@ -202,7 +205,7 @@ fn object_page(reporter: &Reporter, object: &Object, object_map: &ObjectMap) -> putln!(page); write_used_by(&mut page, reporter, object, object_map); } - ObjectKind::Blueprint | ObjectKind::Archetype => { + ObjectKind::Archetype => { if examples.is_empty() { reporter.warn(&object.virtpath, &object.fqname, "No examples"); } diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index a9e1ef8c13b8..5a52eeec0f54 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -269,6 +269,8 @@ impl PythonCodeGenerator { object_kind: ObjectKind, files_to_write: &mut BTreeMap, ) { + let mut known_scopes = HashSet::<_>::default(); + let kind_path = self.pkg_path.join(object_kind.plural_snake_case()); let test_kind_path = self.testing_pkg_path.join(object_kind.plural_snake_case()); @@ -279,6 +281,17 @@ impl PythonCodeGenerator { // Generate folder contents: let ordered_objects = objects.ordered_objects(object_kind.into()); for &obj in &ordered_objects { + let scope = obj.scope(); + + let kind_path = if let Some(scope) = scope { + known_scopes.insert(scope.clone()); + self.pkg_path + .join(scope) + .join(object_kind.plural_snake_case()) + } else { + kind_path.clone() + }; + let filepath = if obj.is_testing() { test_kind_path.join(format!("{}.py", obj.snake_case_name())) } else { @@ -288,7 +301,7 @@ impl PythonCodeGenerator { let ext_class = ExtensionClass::new(reporter, &kind_path, obj); let names = match obj.kind { - ObjectKind::Datatype | ObjectKind::Component | ObjectKind::Blueprint => { + ObjectKind::Datatype | ObjectKind::Component => { let name = &obj.name; if obj.is_delegating_component() { @@ -389,12 +402,12 @@ impl PythonCodeGenerator { let import_clauses: HashSet<_> = obj .fields .iter() - .filter_map(quote_import_clauses_from_field) + .filter_map(|field| quote_import_clauses_from_field(&obj.scope(), field)) .chain(obj.fields.iter().filter_map(|field| { field.typ.fqname().and_then(|fqname| { - objects[fqname] - .delegate_datatype(objects) - .map(|delegate| quote_import_clauses_from_fqname(&delegate.fqname)) + objects[fqname].delegate_datatype(objects).map(|delegate| { + quote_import_clauses_from_fqname(&obj.scope(), &delegate.fqname) + }) }) })) .collect(); @@ -426,6 +439,13 @@ impl PythonCodeGenerator { // rerun/{datatypes|components|archetypes}/__init__.py write_init_file(&kind_path, &mods, files_to_write); write_init_file(&test_kind_path, &test_mods, files_to_write); + for scope in known_scopes { + let scoped_kind_path = self + .pkg_path + .join(scope) + .join(object_kind.plural_snake_case()); + write_init_file(&scoped_kind_path, &BTreeMap::new(), files_to_write); + } } } @@ -694,7 +714,7 @@ fn code_for_struct( match kind { ObjectKind::Archetype => (), - ObjectKind::Datatype | ObjectKind::Blueprint | ObjectKind::Component => { + ObjectKind::Datatype | ObjectKind::Component => { code.push_text( quote_arrow_support_from_obj(arrow_registry, ext_class, objects, obj), 1, @@ -844,7 +864,7 @@ fn code_for_union( ObjectKind::Component => { unreachable!("component may not be a union") } - ObjectKind::Datatype | ObjectKind::Blueprint => { + ObjectKind::Datatype => { code.push_text( quote_arrow_support_from_obj(arrow_registry, ext_class, objects, obj), 1, @@ -1178,7 +1198,10 @@ fn quote_union_aliases_from_object<'a>( )) } -fn quote_import_clauses_from_field(field: &ObjectField) -> Option { +fn quote_import_clauses_from_field( + obj_scope: &Option, + field: &ObjectField, +) -> Option { let fqname = match &field.typ { Type::Array { elem_type, @@ -1195,22 +1218,41 @@ fn quote_import_clauses_from_field(field: &ObjectField) -> Option { // NOTE: The distinction between `from .` vs. `from rerun.datatypes` has been shown to fix some // nasty lazy circular dependencies in weird edge cases… // In any case it will be normalized by `ruff` if it turns out to be unnecessary. - fqname.map(|fqname| quote_import_clauses_from_fqname(fqname)) + fqname.map(|fqname| quote_import_clauses_from_fqname(obj_scope, fqname)) } -fn quote_import_clauses_from_fqname(fqname: &str) -> String { +fn quote_import_clauses_from_fqname(obj_scope: &Option, fqname: &str) -> String { // NOTE: The distinction between `from .` vs. `from rerun.datatypes` has been shown to fix some // nasty lazy circular dependencies in weird edge cases… // In any case it will be normalized by `ruff` if it turns out to be unnecessary. let fqname = fqname.replace(".testing", ""); let (from, class) = fqname.rsplit_once('.').unwrap_or(("", fqname.as_str())); - if from.starts_with("rerun.datatypes") { + + if let Some(scope) = obj_scope { + if from.starts_with("rerun.datatypes") { + "from ... import datatypes".to_owned() + } else if from.starts_with(format!("rerun.{scope}.datatypes").as_str()) { + "from .. import datatypes".to_owned() + } else if from.starts_with("rerun.components") { + "from ... import components".to_owned() + } else if from.starts_with(format!("rerun.{scope}.components").as_str()) { + "from .. import components".to_owned() + } else if from.starts_with("rerun.archetypes") { + // NOTE: This is assuming importing other archetypes is legal… which whether it is or + // isn't for this code generator to say. + "from ... import archetypes".to_owned() + } else if from.starts_with(format!("rerun.{scope}.archetytpes").as_str()) { + "from .. import archetypes".to_owned() + } else if from.is_empty() { + format!("from . import {class}") + } else { + format!("from {from} import {class}") + } + } else if from.starts_with("rerun.datatypes") { "from .. import datatypes".to_owned() } else if from.starts_with("rerun.components") { "from .. import components".to_owned() - } else if from.starts_with("rerun.blueprint") { - "from .. import blueprint".to_owned() } else if from.starts_with("rerun.archetypes") { // NOTE: This is assuming importing other archetypes is legal… which whether it is or // isn't for this code generator to say. @@ -1466,7 +1508,7 @@ fn quote_arrow_support_from_obj( format!("{name}ArrayLike") }; - if obj.kind == ObjectKind::Datatype || obj.kind == ObjectKind::Blueprint { + if obj.kind == ObjectKind::Datatype { type_superclasses.push("BaseExtensionType".to_owned()); batch_superclasses.push(format!("BaseBatch[{many_aliases}]")); } else if obj.kind == ObjectKind::Component { @@ -1675,7 +1717,6 @@ fn quote_init_method( }; let doc_typedesc = match obj.kind { ObjectKind::Datatype => "datatype", - ObjectKind::Blueprint => "blueprint", ObjectKind::Component => "component", ObjectKind::Archetype => "archetype", }; diff --git a/crates/re_types_builder/src/codegen/rust/api.rs b/crates/re_types_builder/src/codegen/rust/api.rs index dea36bf5baad..c27ca3e177dc 100644 --- a/crates/re_types_builder/src/codegen/rust/api.rs +++ b/crates/re_types_builder/src/codegen/rust/api.rs @@ -717,7 +717,7 @@ fn quote_trait_impls_from_obj( let name = format_ident!("{name}"); match kind { - ObjectKind::Datatype | ObjectKind::Component | ObjectKind::Blueprint => { + ObjectKind::Datatype | ObjectKind::Component => { let quoted_kind = if *kind == ObjectKind::Datatype { quote!(Datatype) } else { diff --git a/crates/re_types_builder/src/objects.rs b/crates/re_types_builder/src/objects.rs index 53a3ef111001..9b1bdd6495e8 100644 --- a/crates/re_types_builder/src/objects.rs +++ b/crates/re_types_builder/src/objects.rs @@ -191,17 +191,11 @@ impl std::ops::Index<&str> for Objects { pub enum ObjectKind { Datatype, Component, - Blueprint, Archetype, } impl ObjectKind { - pub const ALL: [Self; 4] = [ - Self::Datatype, - Self::Component, - Self::Blueprint, - Self::Archetype, - ]; + pub const ALL: [Self; 3] = [Self::Datatype, Self::Component, Self::Archetype]; // TODO(#2364): use an attr instead of the path pub fn from_pkg_name(pkg_name: impl AsRef, attrs: &Attributes) -> Self { @@ -225,7 +219,6 @@ impl ObjectKind { pub fn plural_snake_case(&self) -> &'static str { match self { ObjectKind::Datatype => "datatypes", - ObjectKind::Blueprint => "blueprint", ObjectKind::Component => "components", ObjectKind::Archetype => "archetypes", } @@ -234,7 +227,6 @@ impl ObjectKind { pub fn singular_name(&self) -> &'static str { match self { ObjectKind::Datatype => "Datatype", - ObjectKind::Blueprint => "Blueprint", ObjectKind::Component => "Component", ObjectKind::Archetype => "Archetype", } @@ -243,7 +235,6 @@ impl ObjectKind { pub fn plural_name(&self) -> &'static str { match self { ObjectKind::Datatype => "Datatypes", - ObjectKind::Blueprint => "Blueprint", ObjectKind::Component => "Components", ObjectKind::Archetype => "Archetypes", } @@ -672,6 +663,10 @@ impl Object { is_testing_fqname(&self.fqname) } + pub fn scope(&self) -> Option { + self.try_get_attr::(crate::ATTR_RERUN_SCOPE) + } + /// Returns the crate name of an object, accounting for overrides. pub fn crate_name(&self) -> String { self.try_get_attr::(crate::ATTR_RUST_OVERRIDE_CRATE) From 1d8b5830d8cfa0c3dad307a5f7f97efb18097b9f Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 17:43:16 +0100 Subject: [PATCH 04/14] Output to properly scoped file paths --- .../re_types_builder/src/codegen/cpp/mod.rs | 29 ++++++++++++++++--- crates/re_types_builder/src/objects.rs | 6 +++- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/crates/re_types_builder/src/codegen/cpp/mod.rs b/crates/re_types_builder/src/codegen/cpp/mod.rs index 9758ac158b29..77fc235da13c 100644 --- a/crates/re_types_builder/src/codegen/cpp/mod.rs +++ b/crates/re_types_builder/src/codegen/cpp/mod.rs @@ -3,6 +3,8 @@ mod forward_decl; mod includes; mod method; +use std::collections::HashSet; + use camino::{Utf8Path, Utf8PathBuf}; use itertools::Itertools; use proc_macro2::{Ident, TokenStream}; @@ -121,9 +123,20 @@ impl crate::CodeGenerator for CppCodeGenerator { _arrow_registry: &ArrowRegistry, ) -> GeneratedFiles { re_tracing::profile_wait!("generate_folder"); + + let scopes = objects + .objects + .values() + .map(|obj| obj.scope()) + .collect::>(); + ObjectKind::ALL .par_iter() - .flat_map(|object_kind| self.generate_folder(reporter, objects, *object_kind)) + .flat_map(|object_kind| { + scopes + .par_iter() + .flat_map(|scope| self.generate_folder(reporter, objects, scope, *object_kind)) + }) .collect() } } @@ -139,17 +152,25 @@ impl CppCodeGenerator { &self, _reporter: &Reporter, objects: &Objects, + scope: &Option, object_kind: ObjectKind, ) -> GeneratedFiles { - let folder_name = object_kind.plural_snake_case(); - let folder_path_sdk = self.output_path.join("src/rerun").join(folder_name); - let folder_path_testing = self.output_path.join("tests/generated").join(folder_name); + let folder_name = if let Some(scope) = scope { + format!("{}/{}", scope, object_kind.plural_snake_case()) + } else { + object_kind.plural_snake_case().to_owned() + }; + let folder_path_sdk = self.output_path.join("src/rerun").join(&folder_name); + let folder_path_testing = self.output_path.join("tests/generated").join(&folder_name); let mut files_to_write = GeneratedFiles::default(); // Generate folder contents: let ordered_objects = objects.ordered_objects(object_kind.into()); for &obj in &ordered_objects { + if &obj.scope() != scope { + continue; + } let filename_stem = obj.snake_case_name(); let mut hpp_includes = Includes::new(obj.fqname.clone()); diff --git a/crates/re_types_builder/src/objects.rs b/crates/re_types_builder/src/objects.rs index 9b1bdd6495e8..7c10a2da958f 100644 --- a/crates/re_types_builder/src/objects.rs +++ b/crates/re_types_builder/src/objects.rs @@ -677,7 +677,11 @@ impl Object { // // NOTE: Might want a module override at some point. pub fn module_name(&self) -> String { - self.kind.plural_snake_case().to_owned() + if let Some(scope) = self.scope() { + format!("{}/{}", scope, self.kind.plural_snake_case()) + } else { + self.kind.plural_snake_case().to_owned() + } } } From 60f087fbbf8e5c433ff771b2bfa85d07e2c6b255 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 16:28:12 +0100 Subject: [PATCH 05/14] Fix up c++ include handling --- .../src/codegen/cpp/includes.rs | 59 +++++++----- .../re_types_builder/src/codegen/cpp/mod.rs | 95 ++++++++++++++----- 2 files changed, 107 insertions(+), 47 deletions(-) diff --git a/crates/re_types_builder/src/codegen/cpp/includes.rs b/crates/re_types_builder/src/codegen/cpp/includes.rs index 9ab40047ab7a..facbea8212e5 100644 --- a/crates/re_types_builder/src/codegen/cpp/includes.rs +++ b/crates/re_types_builder/src/codegen/cpp/includes.rs @@ -12,12 +12,14 @@ pub struct Includes { system: BTreeSet, local: BTreeSet, fqname: String, + scope: Option, } impl Includes { - pub fn new(fqname: String) -> Self { + pub fn new(fqname: String, scope: Option) -> Self { Self { fqname, + scope, system: BTreeSet::new(), local: BTreeSet::new(), } @@ -37,6 +39,8 @@ impl Includes { pub fn insert_rerun(&mut self, name: &str) { if is_testing_fqname(&self.fqname) { self.insert_system(&format!("rerun/{name}")); + } else if self.scope.is_some() { + self.local.insert(format!("../../{name}")); } else { self.local.insert(format!("../{name}")); } @@ -50,33 +54,39 @@ impl Includes { .split('.') .collect::>(); - if let ["rerun", obj_kind, typname] = components[..] { - let typname = crate::to_snake_case(typname); - - if is_testing_fqname(&self.fqname) == is_testing_fqname(included_fqname) { - // If the type is in the same library, we use a relative path. - if self - .fqname - .starts_with(&included_fqname[..included_fqname.len() - typname.len()]) - { - // Types are next to each other, can skip going into the obj_kind folder. - self.local.insert(format!("{typname}.hpp")); - } else { - self.local.insert(format!("../{obj_kind}/{typname}.hpp")); - } + let (path, typname) = match components[..] { + ["rerun", obj_kind, typname] => (obj_kind.to_owned(), typname), + ["rerun", scope, obj_kind, typname] => (format!("{scope}/{obj_kind}"), typname), + _ => { + panic!( + "Can't figure out include for {included_fqname:?} when adding includes for {:?}", + self.fqname + ); + } + }; + + let typname = crate::to_snake_case(typname); + + if is_testing_fqname(&self.fqname) == is_testing_fqname(included_fqname) { + // If the type is in the same library, we use a relative path. + if self + .fqname + .starts_with(&included_fqname[..included_fqname.len() - typname.len()]) + { + // Types are next to each other, can skip going into the obj_kind folder. + self.local.insert(format!("{typname}.hpp")); + } else if self.scope.is_some() { + self.local.insert(format!("../../{path}/{typname}.hpp")); } else { - // Types are not in the same library, need to treat this like a rerun sdk header. - assert!( - is_testing_fqname(&self.fqname) || !is_testing_fqname(included_fqname), - "A non-testing type can't include a testing type." - ); - self.insert_rerun(&format!("{obj_kind}/{typname}.hpp")); + self.local.insert(format!("../{path}/{typname}.hpp")); } } else { - panic!( - "Can't figure out include for {included_fqname:?} when adding includes for {:?}", - self.fqname + // Types are not in the same library, need to treat this like a rerun sdk header. + assert!( + is_testing_fqname(&self.fqname) || !is_testing_fqname(included_fqname), + "A non-testing type can't include a testing type." ); + self.insert_rerun(&format!("{path}/{typname}.hpp")); } } } @@ -87,6 +97,7 @@ impl quote::ToTokens for Includes { system, local, fqname: _, + scope: _, } = self; let hash = quote! { # }; diff --git a/crates/re_types_builder/src/codegen/cpp/mod.rs b/crates/re_types_builder/src/codegen/cpp/mod.rs index 77fc235da13c..5e47a4a92056 100644 --- a/crates/re_types_builder/src/codegen/cpp/mod.rs +++ b/crates/re_types_builder/src/codegen/cpp/mod.rs @@ -166,14 +166,15 @@ impl CppCodeGenerator { let mut files_to_write = GeneratedFiles::default(); // Generate folder contents: - let ordered_objects = objects.ordered_objects(object_kind.into()); + let ordered_objects = objects + .ordered_objects(object_kind.into()) + .into_iter() + .filter(|obj| &obj.scope() == scope) + .collect_vec(); for &obj in &ordered_objects { - if &obj.scope() != scope { - continue; - } let filename_stem = obj.snake_case_name(); - let mut hpp_includes = Includes::new(obj.fqname.clone()); + let mut hpp_includes = Includes::new(obj.fqname.clone(), obj.scope()); hpp_includes.insert_system("cstdint"); // we use `uint32_t` etc everywhere. hpp_includes.insert_rerun("result.hpp"); // rerun result is used for serialization methods @@ -378,7 +379,7 @@ impl QuotedObject { let type_ident = obj.ident(); let quoted_docs = quote_obj_docs(obj); - let mut cpp_includes = Includes::new(obj.fqname.clone()); + let mut cpp_includes = Includes::new(obj.fqname.clone(), obj.scope()); cpp_includes.insert_rerun("collection_adapter_builtins.hpp"); hpp_includes.insert_system("utility"); // std::move hpp_includes.insert_rerun("indicator_component.hpp"); @@ -497,10 +498,17 @@ impl QuotedObject { }); } + let quoted_namespace = if let Some(scope) = obj.scope() { + let scope = format_ident!("{}", scope); + quote! { #scope::archetypes } + } else { + quote! {archetypes} + }; + let serialize_method = archetype_serialize(&type_ident, obj, &mut hpp_includes); let serialize_hpp = serialize_method.to_hpp_tokens(); let serialize_cpp = - serialize_method.to_cpp_tokens("e!(AsComponents)); + serialize_method.to_cpp_tokens("e!(AsComponents<#quoted_namespace::#type_ident>)); let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens()); let methods_cpp = methods @@ -515,7 +523,7 @@ impl QuotedObject { let hpp = quote! { #hpp_includes - namespace rerun::archetypes { + namespace rerun::#quoted_namespace { #quoted_docs struct #type_ident { #(#field_declarations;)* @@ -548,7 +556,7 @@ impl QuotedObject { #doc_hide_comment template<> - struct AsComponents { + struct AsComponents<#quoted_namespace::#type_ident> { #serialize_hpp }; } @@ -557,7 +565,7 @@ impl QuotedObject { let cpp = quote! { #cpp_includes - namespace rerun::archetypes { + namespace rerun::#quoted_namespace { #(#methods_cpp)* } @@ -578,10 +586,18 @@ impl QuotedObject { hpp_type_extensions: &TokenStream, ) -> QuotedObject { let namespace_ident = obj.namespace_ident(); + + let quoted_namespace = if let Some(scope) = obj.scope() { + let scope = format_ident!("{}", scope); + quote! { #scope::#namespace_ident} + } else { + quote! {#namespace_ident} + }; + let type_ident = obj.ident(); let quoted_docs = quote_obj_docs(obj); - let mut cpp_includes = Includes::new(obj.fqname.clone()); + let mut cpp_includes = Includes::new(obj.fqname.clone(), obj.scope()); let mut hpp_declarations = ForwardDecls::default(); let field_declarations = obj @@ -653,7 +669,7 @@ impl QuotedObject { #hpp_declarations - namespace rerun::#namespace_ident { + namespace rerun::#quoted_namespace { #quoted_docs struct #type_ident { #(#field_declarations;)* @@ -673,7 +689,7 @@ impl QuotedObject { let cpp = quote! { #cpp_includes - namespace rerun::#namespace_ident { + namespace rerun::#quoted_namespace { #(#methods_cpp)* } @@ -714,6 +730,13 @@ impl QuotedObject { obj.fqname ); let namespace_ident = obj.namespace_ident(); + let quoted_namespace = if let Some(scope) = obj.scope() { + let scope = format_ident!("{}", scope); + quote! { #scope::#namespace_ident} + } else { + quote! {#namespace_ident} + }; + let pascal_case_name = &obj.name; let pascal_case_ident = obj.ident(); let quoted_docs = quote_obj_docs(obj); @@ -743,7 +766,7 @@ impl QuotedObject { hpp_includes.insert_system("utility"); // std::move hpp_includes.insert_system("cstring"); // std::memcpy - let mut cpp_includes = Includes::new(obj.fqname.clone()); + let mut cpp_includes = Includes::new(obj.fqname.clone(), obj.scope()); #[allow(unused)] let mut hpp_declarations = ForwardDecls::default(); @@ -972,7 +995,7 @@ impl QuotedObject { #hpp_declarations - namespace rerun::#namespace_ident { + namespace rerun::#quoted_namespace { namespace detail { #hide_from_docs_comment enum class #tag_typename : uint8_t { @@ -1064,7 +1087,7 @@ impl QuotedObject { let cpp = quote! { #cpp_includes - namespace rerun::#namespace_ident { + namespace rerun::#quoted_namespace { #(#cpp_methods)* } @@ -1213,6 +1236,12 @@ fn fill_arrow_array_builder_method( let type_ident = obj.ident(); let namespace_ident = obj.namespace_ident(); + let quoted_namespace = if let Some(scope) = obj.scope() { + let scope = format_ident!("{}", scope); + quote! { #scope::#namespace_ident} + } else { + quote! {#namespace_ident} + }; Method { docs: "Fills an arrow array builder with an array of this type.".into(), @@ -1221,7 +1250,7 @@ fn fill_arrow_array_builder_method( return_type: quote! { rerun::Error }, // TODO(andreas): Pass in validity map. name_and_parameters: quote! { - fill_arrow_array_builder(arrow::#arrow_builder_type* #builder, const #namespace_ident::#type_ident* elements, size_t num_elements) + fill_arrow_array_builder(arrow::#arrow_builder_type* #builder, const #quoted_namespace::#type_ident* elements, size_t num_elements) }, }, definition_body: quote! { @@ -1252,17 +1281,23 @@ fn to_arrow_method( let type_ident = obj.ident(); let namespace_ident = obj.namespace_ident(); + let quoted_namespace = if let Some(scope) = obj.scope() { + let scope = format_ident!("{}", scope); + quote! { #scope::#namespace_ident} + } else { + quote! {#namespace_ident} + }; Method { docs: format!( - "Serializes an array of `rerun::{namespace_ident}::{type_ident}` into an arrow array." + "Serializes an array of `rerun::{quoted_namespace}::{type_ident}` into an arrow array." ) .into(), declaration: MethodDeclaration { is_static: true, return_type: quote! { Result> }, name_and_parameters: quote! { - to_arrow(const #namespace_ident::#type_ident* instances, size_t num_instances) + to_arrow(const #quoted_namespace::#type_ident* instances, size_t num_instances) }, }, definition_body: quote! { @@ -1274,7 +1309,7 @@ fn to_arrow_method( #NEWLINE_TOKEN ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) if (instances && num_instances > 0) { - RR_RETURN_NOT_OK(Loggable<#namespace_ident::#type_ident>::fill_arrow_array_builder( + RR_RETURN_NOT_OK(Loggable<#quoted_namespace::#type_ident>::fill_arrow_array_builder( static_cast(builder.get()), instances, num_instances @@ -1360,6 +1395,12 @@ fn quote_fill_arrow_array_builder( ) -> TokenStream { let type_ident = obj.ident(); let namespace_ident = obj.namespace_ident(); + let quoted_namespace = if let Some(scope) = obj.scope() { + let scope = format_ident!("{}", scope); + quote! { #scope::#namespace_ident} + } else { + quote! {#namespace_ident} + }; let parameter_check = quote! { if (builder == nullptr) { @@ -1388,7 +1429,7 @@ fn quote_fill_arrow_array_builder( // Trivial forwarding to inner type. let quoted_fqname = quote_fqname_as_type_path(includes, fqname); quote! { - static_assert(sizeof(#quoted_fqname) == sizeof(#namespace_ident::#type_ident)); + static_assert(sizeof(#quoted_fqname) == sizeof(#quoted_namespace::#type_ident)); RR_RETURN_NOT_OK(Loggable<#quoted_fqname>::fill_arrow_array_builder( builder, reinterpret_cast(elements), num_elements )); @@ -1532,7 +1573,7 @@ fn quote_fill_arrow_array_builder( #NEWLINE_TOKEN #NEWLINE_TOKEN - using TagType = #namespace_ident::detail::#tag_name; + using TagType = #quoted_namespace::detail::#tag_name; switch (union_instance.get_union_tag()) { case TagType::None: { @@ -2161,6 +2202,14 @@ fn quote_loggable_hpp_and_cpp( let namespace_ident = obj.namespace_ident(); let type_ident = obj.ident(); + + let quoted_namespace = if let Some(scope) = obj.scope() { + let scope = format_ident!("{}", scope); + quote! { #scope::#namespace_ident } + } else { + quote! {#namespace_ident} + }; + let fqname = &obj.fqname; let methods = vec![ @@ -2169,7 +2218,7 @@ fn quote_loggable_hpp_and_cpp( to_arrow_method(obj, objects, hpp_includes, hpp_declarations), ]; - let loggable_type_name = quote! { Loggable<#namespace_ident::#type_ident> }; + let loggable_type_name = quote! { Loggable<#quoted_namespace::#type_ident> }; let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens()); let methods_cpp = methods.iter().map(|m| m.to_cpp_tokens(&loggable_type_name)); From 6f939158e3fec987f408997f94b0f9f190fc6374 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 19:18:16 +0100 Subject: [PATCH 06/14] Re-codegen the blueprint types --- .../src/blueprint/components/.gitattributes | 5 + .../components/entity_properties_component.rs | 219 ++++++++++++ .../src/blueprint/{ => components}/mod.rs | 0 .../blueprint/entity_properties_component.rs | 311 ------------------ .../src/blueprint/components/.gitattributes | 5 + .../src/blueprint/{ => components}/mod.rs | 0 .../blueprint/components/query_expressions.rs | 146 ++++++++ .../src/blueprint/datatypes/.gitattributes | 5 + .../src/blueprint/datatypes/mod.rs | 5 + .../{ => datatypes}/query_expressions.rs | 232 ++++++------- .../blueprint/{ => components}/.gitattributes | 0 .../src/blueprint/{ => components}/mod.rs | 0 .../components/space_view_component.rs | 159 +++++++++ .../space_view_component_ext.rs | 0 .../src/blueprint/datatypes/.gitattributes | 5 + .../re_types/src/blueprint/datatypes/mod.rs | 5 + .../{ => datatypes}/space_view_component.rs | 74 +++-- .../src/blueprint/components/.gitattributes | 5 + .../re_viewer/src/blueprint/components/mod.rs | 6 + .../src/blueprint/components/panel_view.rs | 123 +++++++ .../{ => components}/panel_view_ext.rs | 0 crates/re_viewer/src/blueprint/panel_view.rs | 199 ----------- .../src/blueprint/components/.gitattributes | 7 + .../{ => components}/auto_space_views.rs | 12 +- .../src/blueprint/{ => components}/mod.rs | 1 - .../{ => components}/space_view_maximized.rs | 14 +- .../space_view_maximized_ext.rs | 0 .../blueprint/components/viewport_layout.rs | 152 +++++++++ .../src/blueprint/datatypes/.gitattributes | 5 + .../src/blueprint/datatypes/mod.rs | 6 + .../{ => datatypes}/viewport_layout.rs | 63 ++-- .../{ => datatypes}/viewport_layout_ext.rs | 0 .../reference/types/datatypes/entity_path.md | 2 +- .../content/reference/types/datatypes/uuid.md | 2 +- rerun_cpp/src/rerun/.gitattributes | 1 - .../rerun/blueprint/blueprint/.gitattributes | 6 + .../rerun/blueprint/blueprint/archetypes.hpp} | 0 .../rerun/blueprint/blueprint/components.hpp | 11 + .../rerun/blueprint/blueprint/datatypes.hpp | 7 + .../rerun/blueprint/components/.gitattributes | 17 + .../blueprint/components/auto_space_views.cpp | 62 ++++ .../blueprint/components/auto_space_views.hpp | 59 ++++ .../entity_properties_component.cpp | 71 ++++ .../entity_properties_component.hpp | 61 ++++ .../rerun/blueprint/components/panel_view.cpp | 60 ++++ .../rerun/blueprint/components/panel_view.hpp | 59 ++++ .../components/query_expressions.cpp | 62 ++++ .../components/query_expressions.hpp | 67 ++++ .../components/space_view_component.cpp | 62 ++++ .../components/space_view_component.hpp | 67 ++++ .../components/space_view_maximized.cpp | 75 +++++ .../components/space_view_maximized.hpp | 62 ++++ .../blueprint/components/viewport_layout.cpp | 61 ++++ .../blueprint/components/viewport_layout.hpp | 67 ++++ .../rerun/blueprint/datatypes/.gitattributes | 9 + .../blueprint/datatypes/query_expressions.cpp | 98 ++++++ .../blueprint/datatypes/query_expressions.hpp | 58 ++++ .../datatypes/space_view_component.cpp | 130 ++++++++ .../datatypes/space_view_component.hpp | 75 +++++ .../blueprint/datatypes/viewport_layout.cpp | 105 ++++++ .../blueprint/datatypes/viewport_layout.hpp | 60 ++++ rerun_cpp/tests/generated/.gitattributes | 1 - .../blueprint/blueprint/.gitattributes | 6 + .../blueprint/blueprint/archetypes.hpp | 3 + .../blueprint/blueprint/components.hpp | 3 + .../blueprint/blueprint/datatypes.hpp | 3 + .../rerun_sdk/rerun/blueprint/__init__.py | 85 ----- .../rerun/blueprint/components/.gitattributes | 11 + .../rerun/blueprint/components/__init__.py | 3 + .../{ => components}/auto_space_views.py | 20 +- .../entity_properties_component.py | 22 +- .../blueprint/{ => components}/panel_view.py | 20 +- .../blueprint/components/query_expressions.py | 32 ++ .../components/space_view_component.py | 32 ++ .../{ => components}/space_view_maximized.py | 22 +- .../blueprint/components/viewport_layout.py | 32 ++ .../rerun/blueprint/datatypes/.gitattributes | 7 + .../rerun/blueprint/datatypes/__init__.py | 3 + .../{ => datatypes}/query_expressions.py | 35 +- .../{ => datatypes}/space_view_component.py | 51 ++- .../{ => datatypes}/viewport_layout.py | 36 +- .../rerun_sdk/rerun/components/__init__.py | 54 +++ .../rerun_sdk/rerun/datatypes/__init__.py | 36 ++ 83 files changed, 2934 insertions(+), 823 deletions(-) create mode 100644 crates/re_data_store/src/blueprint/components/.gitattributes create mode 100644 crates/re_data_store/src/blueprint/components/entity_properties_component.rs rename crates/re_data_store/src/blueprint/{ => components}/mod.rs (100%) delete mode 100644 crates/re_data_store/src/blueprint/entity_properties_component.rs create mode 100644 crates/re_space_view/src/blueprint/components/.gitattributes rename crates/re_space_view/src/blueprint/{ => components}/mod.rs (100%) create mode 100644 crates/re_space_view/src/blueprint/components/query_expressions.rs create mode 100644 crates/re_space_view/src/blueprint/datatypes/.gitattributes create mode 100644 crates/re_space_view/src/blueprint/datatypes/mod.rs rename crates/re_space_view/src/blueprint/{ => datatypes}/query_expressions.rs (72%) rename crates/re_types/src/blueprint/{ => components}/.gitattributes (100%) rename crates/re_types/src/blueprint/{ => components}/mod.rs (100%) create mode 100644 crates/re_types/src/blueprint/components/space_view_component.rs rename crates/re_types/src/blueprint/{ => components}/space_view_component_ext.rs (100%) create mode 100644 crates/re_types/src/blueprint/datatypes/.gitattributes create mode 100644 crates/re_types/src/blueprint/datatypes/mod.rs rename crates/re_types/src/blueprint/{ => datatypes}/space_view_component.rs (91%) create mode 100644 crates/re_viewer/src/blueprint/components/.gitattributes create mode 100644 crates/re_viewer/src/blueprint/components/mod.rs create mode 100644 crates/re_viewer/src/blueprint/components/panel_view.rs rename crates/re_viewer/src/blueprint/{ => components}/panel_view_ext.rs (100%) delete mode 100644 crates/re_viewer/src/blueprint/panel_view.rs create mode 100644 crates/re_viewport/src/blueprint/components/.gitattributes rename crates/re_viewport/src/blueprint/{ => components}/auto_space_views.rs (89%) rename crates/re_viewport/src/blueprint/{ => components}/mod.rs (93%) rename crates/re_viewport/src/blueprint/{ => components}/space_view_maximized.rs (93%) rename crates/re_viewport/src/blueprint/{ => components}/space_view_maximized_ext.rs (100%) create mode 100644 crates/re_viewport/src/blueprint/components/viewport_layout.rs create mode 100644 crates/re_viewport/src/blueprint/datatypes/.gitattributes create mode 100644 crates/re_viewport/src/blueprint/datatypes/mod.rs rename crates/re_viewport/src/blueprint/{ => datatypes}/viewport_layout.rs (91%) rename crates/re_viewport/src/blueprint/{ => datatypes}/viewport_layout_ext.rs (100%) create mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes rename rerun_cpp/{tests/generated/blueprint.hpp => src/rerun/blueprint/blueprint/archetypes.hpp} (100%) create mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/components.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/.gitattributes create mode 100644 rerun_cpp/src/rerun/blueprint/components/auto_space_views.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/auto_space_views.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/entity_properties_component.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/entity_properties_component.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/panel_view.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/panel_view.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/query_expressions.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/query_expressions.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/space_view_component.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/space_view_component.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/space_view_maximized.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/space_view_maximized.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/viewport_layout.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/components/viewport_layout.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/.gitattributes create mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/query_expressions.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/query_expressions.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/space_view_component.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/space_view_component.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/viewport_layout.cpp create mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/viewport_layout.hpp create mode 100644 rerun_cpp/tests/generated/blueprint/blueprint/.gitattributes create mode 100644 rerun_cpp/tests/generated/blueprint/blueprint/archetypes.hpp create mode 100644 rerun_cpp/tests/generated/blueprint/blueprint/components.hpp create mode 100644 rerun_cpp/tests/generated/blueprint/blueprint/datatypes.hpp delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/__init__.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py rename rerun_py/rerun_sdk/rerun/blueprint/{ => components}/auto_space_views.py (57%) rename rerun_py/rerun_sdk/rerun/blueprint/{ => components}/entity_properties_component.py (67%) rename rerun_py/rerun_sdk/rerun/blueprint/{ => components}/panel_view.py (56%) create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/query_expressions.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/space_view_component.py rename rerun_py/rerun_sdk/rerun/blueprint/{ => components}/space_view_maximized.py (65%) create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/viewport_layout.py create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/datatypes/.gitattributes create mode 100644 rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py rename rerun_py/rerun_sdk/rerun/blueprint/{ => datatypes}/query_expressions.py (59%) rename rerun_py/rerun_sdk/rerun/blueprint/{ => datatypes}/space_view_component.py (66%) rename rerun_py/rerun_sdk/rerun/blueprint/{ => datatypes}/viewport_layout.py (60%) diff --git a/crates/re_data_store/src/blueprint/components/.gitattributes b/crates/re_data_store/src/blueprint/components/.gitattributes new file mode 100644 index 000000000000..b080e13deaa1 --- /dev/null +++ b/crates/re_data_store/src/blueprint/components/.gitattributes @@ -0,0 +1,5 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +entity_properties_component.rs linguist-generated=true +mod.rs linguist-generated=true diff --git a/crates/re_data_store/src/blueprint/components/entity_properties_component.rs b/crates/re_data_store/src/blueprint/components/entity_properties_component.rs new file mode 100644 index 000000000000..780da92ba16a --- /dev/null +++ b/crates/re_data_store/src/blueprint/components/entity_properties_component.rs @@ -0,0 +1,219 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/entity_properties_component.fbs". + +#![allow(trivial_numeric_casts)] +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::iter_on_single_items)] +#![allow(clippy::map_flatten)] +#![allow(clippy::match_wildcard_for_single_variants)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] +#![allow(clippy::unnecessary_cast)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::ComponentName; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: The configurable set of overridable properties. +/// +/// Unstable. Used for the ongoing blueprint experimentations. +#[derive(Clone)] +pub struct EntityPropertiesComponent(pub crate::EntityProperties); + +impl From for EntityPropertiesComponent { + #[inline] + fn from(props: crate::EntityProperties) -> Self { + Self(props) + } +} + +impl From for crate::EntityProperties { + #[inline] + fn from(value: EntityPropertiesComponent) -> Self { + value.0 + } +} + +::re_types_core::macros::impl_into_cow!(EntityPropertiesComponent); + +impl ::re_types_core::Loggable for EntityPropertiesComponent { + type Name = ::re_types_core::ComponentName; + + #[inline] + fn name() -> Self::Name { + "rerun.blueprint.components.EntityPropertiesComponent".into() + } + + #[allow(clippy::wildcard_imports)] + #[inline] + fn arrow_datatype() -> arrow2::datatypes::DataType { + use arrow2::datatypes::*; + DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::UInt8, + is_nullable: false, + metadata: [].into(), + })) + } + + #[allow(clippy::wildcard_imports)] + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult> + where + Self: Clone + 'a, + { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + use arrow2::{array::*, datatypes::*}; + Ok({ + let (somes, data0): (Vec<_>, Vec<_>) = data + .into_iter() + .map(|datum| { + let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); + let datum = datum.map(|datum| { + let Self(data0) = datum.into_owned(); + data0 + }); + (datum.is_some(), datum) + }) + .unzip(); + let data0_bitmap: Option = { + let any_nones = somes.iter().any(|some| !*some); + any_nones.then(|| somes.into()) + }; + { + use arrow2::{buffer::Buffer, offset::OffsetsBuffer}; + let buffers: Vec>> = data0 + .iter() + .map(|opt| { + use ::re_types_core::SerializationError; + opt.as_ref() + .map(|b| { + let mut buf = Vec::new(); + rmp_serde::encode::write_named(&mut buf, b).map_err(|err| { + SerializationError::serde_failure(err.to_string()) + })?; + Ok(buf) + }) + .transpose() + }) + .collect::>>()?; + let offsets = arrow2::offset::Offsets::::try_from_lengths( + buffers + .iter() + .map(|opt| opt.as_ref().map(|buf| buf.len()).unwrap_or_default()), + ) + .unwrap() + .into(); + let data0_inner_bitmap: Option = None; + let data0_inner_data: Buffer = buffers + .into_iter() + .flatten() + .collect::>() + .concat() + .into(); + ListArray::new( + Self::arrow_datatype(), + offsets, + PrimitiveArray::new(DataType::UInt8, data0_inner_data, data0_inner_bitmap) + .boxed(), + data0_bitmap, + ) + .boxed() + } + }) + } + + #[allow(clippy::wildcard_imports)] + fn from_arrow_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + use arrow2::{array::*, buffer::*, datatypes::*}; + Ok({ + let arrow_data = arrow_data + .as_any() + .downcast_ref::>() + .ok_or_else(|| { + DeserializationError::datatype_mismatch( + DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::UInt8, + is_nullable: false, + metadata: [].into(), + })), + arrow_data.data_type().clone(), + ) + }) + .with_context("rerun.blueprint.components.EntityPropertiesComponent#props")?; + if arrow_data.is_empty() { + Vec::new() + } else { + let arrow_data_inner = { + let arrow_data_inner = &**arrow_data.values(); + arrow_data_inner + .as_any() + .downcast_ref::() + .ok_or_else(|| { + DeserializationError::datatype_mismatch( + DataType::UInt8, + arrow_data_inner.data_type().clone(), + ) + }) + .with_context("rerun.blueprint.components.EntityPropertiesComponent#props")? + .values() + }; + let offsets = arrow_data.offsets(); + arrow2::bitmap::utils::ZipValidity::new_with_validity( + offsets.iter().zip(offsets.lengths()), + arrow_data.validity(), + ) + .map(|elem| { + elem.map(|(start, len)| { + let start = *start as usize; + let end = start + len; + if end as usize > arrow_data_inner.len() { + return Err(DeserializationError::offset_slice_oob( + (start, end), + arrow_data_inner.len(), + )); + } + + #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] + let data = unsafe { + arrow_data_inner + .clone() + .sliced_unchecked(start as usize, end - start as usize) + }; + let data = + rmp_serde::from_slice::(data.as_slice()) + .map_err(|err| { + DeserializationError::serde_failure(err.to_string()) + })?; + Ok(data) + }) + .transpose() + }) + .collect::>>>()? + } + .into_iter() + } + .map(|v| v.ok_or_else(DeserializationError::missing_data)) + .map(|res| res.map(|v| Some(Self(v)))) + .collect::>>>() + .with_context("rerun.blueprint.components.EntityPropertiesComponent#props") + .with_context("rerun.blueprint.components.EntityPropertiesComponent")?) + } +} diff --git a/crates/re_data_store/src/blueprint/mod.rs b/crates/re_data_store/src/blueprint/components/mod.rs similarity index 100% rename from crates/re_data_store/src/blueprint/mod.rs rename to crates/re_data_store/src/blueprint/components/mod.rs diff --git a/crates/re_data_store/src/blueprint/entity_properties_component.rs b/crates/re_data_store/src/blueprint/entity_properties_component.rs deleted file mode 100644 index 2979be441d9f..000000000000 --- a/crates/re_data_store/src/blueprint/entity_properties_component.rs +++ /dev/null @@ -1,311 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/re_types/definitions/rerun/blueprint/entity_properties_component.fbs". - -#![allow(trivial_numeric_casts)] -#![allow(unused_imports)] -#![allow(unused_parens)] -#![allow(clippy::clone_on_copy)] -#![allow(clippy::iter_on_single_items)] -#![allow(clippy::map_flatten)] -#![allow(clippy::match_wildcard_for_single_variants)] -#![allow(clippy::needless_question_mark)] -#![allow(clippy::new_without_default)] -#![allow(clippy::redundant_closure)] -#![allow(clippy::too_many_arguments)] -#![allow(clippy::too_many_lines)] -#![allow(clippy::unnecessary_cast)] - -use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; -use ::re_types_core::SerializationResult; -use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; -use ::re_types_core::{DeserializationError, DeserializationResult}; - -/// **Blueprint**: The configurable set of overridable properties. -/// -/// Unstable. Used for the ongoing blueprint experimentations. -#[derive(Clone)] -pub struct EntityPropertiesComponent { - pub props: crate::EntityProperties, -} - -impl From for EntityPropertiesComponent { - #[inline] - fn from(props: crate::EntityProperties) -> Self { - Self { props } - } -} - -impl From for crate::EntityProperties { - #[inline] - fn from(value: EntityPropertiesComponent) -> Self { - value.props - } -} - -::re_types_core::macros::impl_into_cow!(EntityPropertiesComponent); - -impl ::re_types_core::Loggable for EntityPropertiesComponent { - type Name = ::re_types_core::ComponentName; - - #[inline] - fn name() -> Self::Name { - "rerun.blueprint.EntityPropertiesComponent".into() - } - - #[allow(clippy::wildcard_imports)] - #[inline] - fn arrow_datatype() -> arrow2::datatypes::DataType { - use arrow2::datatypes::*; - DataType::Struct(vec![Field { - name: "props".to_owned(), - data_type: DataType::List(Box::new(Field { - name: "item".to_owned(), - data_type: DataType::UInt8, - is_nullable: false, - metadata: [].into(), - })), - is_nullable: false, - metadata: [].into(), - }]) - } - - #[allow(clippy::wildcard_imports)] - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult> - where - Self: Clone + 'a, - { - re_tracing::profile_function!(); - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, datatypes::*}; - Ok({ - let (somes, data): (Vec<_>, Vec<_>) = data - .into_iter() - .map(|datum| { - let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); - (datum.is_some(), datum) - }) - .unzip(); - let bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - StructArray::new( - ::arrow_datatype(), - vec![{ - let (somes, props): (Vec<_>, Vec<_>) = data - .iter() - .map(|datum| { - let datum = datum.as_ref().map(|datum| { - let Self { props, .. } = &**datum; - props.clone() - }); - (datum.is_some(), datum) - }) - .unzip(); - let props_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - { - use arrow2::{buffer::Buffer, offset::OffsetsBuffer}; - let buffers: Vec>> = props - .iter() - .map(|opt| { - use ::re_types_core::SerializationError; - opt.as_ref() - .map(|b| { - let mut buf = Vec::new(); - rmp_serde::encode::write_named(&mut buf, b).map_err( - |err| { - SerializationError::serde_failure(err.to_string()) - }, - )?; - Ok(buf) - }) - .transpose() - }) - .collect::>>()?; - let offsets = arrow2::offset::Offsets::::try_from_lengths( - buffers - .iter() - .map(|opt| opt.as_ref().map(|buf| buf.len()).unwrap_or_default()), - ) - .unwrap() - .into(); - let props_inner_bitmap: Option = None; - let props_inner_data: Buffer = buffers - .into_iter() - .flatten() - .collect::>() - .concat() - .into(); - ListArray::new( - DataType::List(Box::new(Field { - name: "item".to_owned(), - data_type: DataType::UInt8, - is_nullable: false, - metadata: [].into(), - })), - offsets, - PrimitiveArray::new( - DataType::UInt8, - props_inner_data, - props_inner_bitmap, - ) - .boxed(), - props_bitmap, - ) - .boxed() - } - }], - bitmap, - ) - .boxed() - }) - } - - #[allow(clippy::wildcard_imports)] - fn from_arrow_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - re_tracing::profile_function!(); - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, buffer::*, datatypes::*}; - Ok({ - let arrow_data = arrow_data - .as_any() - .downcast_ref::() - .ok_or_else(|| { - DeserializationError::datatype_mismatch( - DataType::Struct(vec![Field { - name: "props".to_owned(), - data_type: DataType::List(Box::new(Field { - name: "item".to_owned(), - data_type: DataType::UInt8, - is_nullable: false, - metadata: [].into(), - })), - is_nullable: false, - metadata: [].into(), - }]), - arrow_data.data_type().clone(), - ) - }) - .with_context("rerun.blueprint.EntityPropertiesComponent")?; - if arrow_data.is_empty() { - Vec::new() - } else { - let (arrow_data_fields, arrow_data_arrays) = - (arrow_data.fields(), arrow_data.values()); - let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data_fields - .iter() - .map(|field| field.name.as_str()) - .zip(arrow_data_arrays) - .collect(); - let props = { - if !arrays_by_name.contains_key("props") { - return Err(DeserializationError::missing_struct_field( - Self::arrow_datatype(), - "props", - )) - .with_context("rerun.blueprint.EntityPropertiesComponent"); - } - let arrow_data = &**arrays_by_name["props"]; - { - let arrow_data = arrow_data - .as_any() - .downcast_ref::>() - .ok_or_else(|| { - DeserializationError::datatype_mismatch( - DataType::List(Box::new(Field { - name: "item".to_owned(), - data_type: DataType::UInt8, - is_nullable: false, - metadata: [].into(), - })), - arrow_data.data_type().clone(), - ) - }) - .with_context("rerun.blueprint.EntityPropertiesComponent#props")?; - if arrow_data.is_empty() { - Vec::new() - } else { - let arrow_data_inner = { - let arrow_data_inner = &**arrow_data.values(); - arrow_data_inner - .as_any() - .downcast_ref::() - .ok_or_else(|| { - DeserializationError::datatype_mismatch( - DataType::UInt8, - arrow_data_inner.data_type().clone(), - ) - }) - .with_context( - "rerun.blueprint.EntityPropertiesComponent#props", - )? - .values() - }; - let offsets = arrow_data.offsets(); - arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), - arrow_data.validity(), - ) - .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end as usize > arrow_data_inner.len() { - return Err(DeserializationError::offset_slice_oob( - (start, end), - arrow_data_inner.len(), - )); - } - - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - let data = unsafe { - arrow_data_inner - .clone() - .sliced_unchecked(start as usize, end - start as usize) - }; - let data = rmp_serde::from_slice::( - data.as_slice(), - ) - .map_err(|err| { - DeserializationError::serde_failure(err.to_string()) - })?; - Ok(data) - }) - .transpose() - }) - .collect::>>>()? - } - .into_iter() - } - }; - arrow2::bitmap::utils::ZipValidity::new_with_validity( - ::itertools::izip!(props), - arrow_data.validity(), - ) - .map(|opt| { - opt.map(|(props)| { - Ok(Self { - props: props - .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.EntityPropertiesComponent#props")?, - }) - }) - .transpose() - }) - .collect::>>() - .with_context("rerun.blueprint.EntityPropertiesComponent")? - } - }) - } -} diff --git a/crates/re_space_view/src/blueprint/components/.gitattributes b/crates/re_space_view/src/blueprint/components/.gitattributes new file mode 100644 index 000000000000..3ebb997c49ad --- /dev/null +++ b/crates/re_space_view/src/blueprint/components/.gitattributes @@ -0,0 +1,5 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +mod.rs linguist-generated=true +query_expressions.rs linguist-generated=true diff --git a/crates/re_space_view/src/blueprint/mod.rs b/crates/re_space_view/src/blueprint/components/mod.rs similarity index 100% rename from crates/re_space_view/src/blueprint/mod.rs rename to crates/re_space_view/src/blueprint/components/mod.rs diff --git a/crates/re_space_view/src/blueprint/components/query_expressions.rs b/crates/re_space_view/src/blueprint/components/query_expressions.rs new file mode 100644 index 000000000000..858d14820a1c --- /dev/null +++ b/crates/re_space_view/src/blueprint/components/query_expressions.rs @@ -0,0 +1,146 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/query_expressions.fbs". + +#![allow(trivial_numeric_casts)] +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::iter_on_single_items)] +#![allow(clippy::map_flatten)] +#![allow(clippy::match_wildcard_for_single_variants)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] +#![allow(clippy::unnecessary_cast)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::ComponentName; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: A set of expressions used for a `DataQueryBlueprint`. +/// +/// Unstable. Used for the ongoing blueprint experimentations. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct QueryExpressions(pub crate::blueprint::datatypes::QueryExpressions); + +impl> From for QueryExpressions { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for QueryExpressions { + #[inline] + fn borrow(&self) -> &crate::blueprint::datatypes::QueryExpressions { + &self.0 + } +} + +impl std::ops::Deref for QueryExpressions { + type Target = crate::blueprint::datatypes::QueryExpressions; + + #[inline] + fn deref(&self) -> &crate::blueprint::datatypes::QueryExpressions { + &self.0 + } +} + +::re_types_core::macros::impl_into_cow!(QueryExpressions); + +impl ::re_types_core::Loggable for QueryExpressions { + type Name = ::re_types_core::ComponentName; + + #[inline] + fn name() -> Self::Name { + "rerun.blueprint.components.QueryExpressions".into() + } + + #[allow(clippy::wildcard_imports)] + #[inline] + fn arrow_datatype() -> arrow2::datatypes::DataType { + use arrow2::datatypes::*; + DataType::Struct(vec![ + Field { + name: "inclusions".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "exclusions".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + ]) + } + + #[allow(clippy::wildcard_imports)] + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult> + where + Self: Clone + 'a, + { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + use arrow2::{array::*, datatypes::*}; + Ok({ + let (somes, data0): (Vec<_>, Vec<_>) = data + .into_iter() + .map(|datum| { + let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); + let datum = datum.map(|datum| { + let Self(data0) = datum.into_owned(); + data0 + }); + (datum.is_some(), datum) + }) + .unzip(); + let data0_bitmap: Option = { + let any_nones = somes.iter().any(|some| !*some); + any_nones.then(|| somes.into()) + }; + { + _ = data0_bitmap; + crate::blueprint::datatypes::QueryExpressions::to_arrow_opt(data0)? + } + }) + } + + #[allow(clippy::wildcard_imports)] + fn from_arrow_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + use arrow2::{array::*, buffer::*, datatypes::*}; + Ok( + crate::blueprint::datatypes::QueryExpressions::from_arrow_opt(arrow_data) + .with_context("rerun.blueprint.components.QueryExpressions#expressions")? + .into_iter() + .map(|v| v.ok_or_else(DeserializationError::missing_data)) + .map(|res| res.map(|v| Some(Self(v)))) + .collect::>>>() + .with_context("rerun.blueprint.components.QueryExpressions#expressions") + .with_context("rerun.blueprint.components.QueryExpressions")?, + ) + } +} diff --git a/crates/re_space_view/src/blueprint/datatypes/.gitattributes b/crates/re_space_view/src/blueprint/datatypes/.gitattributes new file mode 100644 index 000000000000..3ebb997c49ad --- /dev/null +++ b/crates/re_space_view/src/blueprint/datatypes/.gitattributes @@ -0,0 +1,5 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +mod.rs linguist-generated=true +query_expressions.rs linguist-generated=true diff --git a/crates/re_space_view/src/blueprint/datatypes/mod.rs b/crates/re_space_view/src/blueprint/datatypes/mod.rs new file mode 100644 index 000000000000..42054f19856c --- /dev/null +++ b/crates/re_space_view/src/blueprint/datatypes/mod.rs @@ -0,0 +1,5 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs + +mod query_expressions; + +pub use self::query_expressions::QueryExpressions; diff --git a/crates/re_space_view/src/blueprint/query_expressions.rs b/crates/re_space_view/src/blueprint/datatypes/query_expressions.rs similarity index 72% rename from crates/re_space_view/src/blueprint/query_expressions.rs rename to crates/re_space_view/src/blueprint/datatypes/query_expressions.rs index 702e052a5f9b..d214f177f7d2 100644 --- a/crates/re_space_view/src/blueprint/query_expressions.rs +++ b/crates/re_space_view/src/blueprint/datatypes/query_expressions.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/re_types/definitions/rerun/blueprint/query_expressions.fbs". +// Based on "crates/re_types/definitions/rerun/blueprint/datatypes/query_expressions.fbs". #![allow(trivial_numeric_casts)] #![allow(unused_imports)] @@ -21,7 +21,7 @@ use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; use ::re_types_core::{DeserializationError, DeserializationResult}; -/// **Blueprint**: A set of expressions used for a `DataQueryBlueprint`. +/// **Datatype**: A set of expressions used for a `DataQueryBlueprint`. /// /// Unstable. Used for the ongoing blueprint experimentations. #[derive(Clone, Debug, PartialEq, Eq)] @@ -36,11 +36,11 @@ pub struct QueryExpressions { ::re_types_core::macros::impl_into_cow!(QueryExpressions); impl ::re_types_core::Loggable for QueryExpressions { - type Name = ::re_types_core::ComponentName; + type Name = ::re_types_core::DatatypeName; #[inline] fn name() -> Self::Name { - "rerun.blueprint.QueryExpressions".into() + "rerun.blueprint.datatypes.QueryExpressions".into() } #[allow(clippy::wildcard_imports)] @@ -96,7 +96,7 @@ impl ::re_types_core::Loggable for QueryExpressions { any_nones.then(|| somes.into()) }; StructArray::new( - ::arrow_datatype(), + ::arrow_datatype(), vec![ { let (somes, inclusions): (Vec<_>, Vec<_>) = data @@ -292,7 +292,7 @@ impl ::re_types_core::Loggable for QueryExpressions { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.QueryExpressions")?; + .with_context("rerun.blueprint.datatypes.QueryExpressions")?; if arrow_data.is_empty() { Vec::new() } else { @@ -309,7 +309,7 @@ impl ::re_types_core::Loggable for QueryExpressions { Self::arrow_datatype(), "inclusions", )) - .with_context("rerun.blueprint.QueryExpressions"); + .with_context("rerun.blueprint.datatypes.QueryExpressions"); } let arrow_data = &**arrays_by_name["inclusions"]; { @@ -327,68 +327,71 @@ impl ::re_types_core::Loggable for QueryExpressions { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.QueryExpressions#inclusions")?; + .with_context( + "rerun.blueprint.datatypes.QueryExpressions#inclusions", + )?; if arrow_data.is_empty() { Vec::new() } else { - let arrow_data_inner = { - let arrow_data_inner = &**arrow_data.values(); + let arrow_data_inner = { - let arrow_data_inner = arrow_data_inner + let arrow_data_inner = &**arrow_data.values(); + { + let arrow_data_inner = arrow_data_inner .as_any() .downcast_ref::>() - .ok_or_else(|| { - DeserializationError::datatype_mismatch( - DataType::Utf8, - arrow_data_inner.data_type().clone(), - ) - }) + .ok_or_else(|| DeserializationError::datatype_mismatch( + DataType::Utf8, + arrow_data_inner.data_type().clone(), + )) .with_context( - "rerun.blueprint.QueryExpressions#inclusions", + "rerun.blueprint.datatypes.QueryExpressions#inclusions", )?; - 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()), - arrow_data_inner.validity(), - ) - .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end as usize > arrow_data_inner_buf.len() { - return Err( - DeserializationError::offset_slice_oob( - (start, end), - arrow_data_inner_buf.len(), - ), - ); - } + 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()), + arrow_data_inner.validity(), + ) + .map(|elem| { + elem.map(|(start, len)| { + let start = *start as usize; + let end = start + len; + if end as usize > arrow_data_inner_buf.len() { + return Err( + DeserializationError::offset_slice_oob( + (start, end), + arrow_data_inner_buf.len(), + ), + ); + } - #[allow( - unsafe_code, - clippy::undocumented_unsafe_blocks - )] - let data = unsafe { - arrow_data_inner_buf - .clone() - .sliced_unchecked(start, len) - }; - Ok(data) + #[allow( + unsafe_code, + clippy::undocumented_unsafe_blocks + )] + let data = unsafe { + arrow_data_inner_buf + .clone() + .sliced_unchecked(start, len) + }; + Ok(data) + }) + .transpose() }) - .transpose() - }) - .map(|res_or_opt| { - res_or_opt.map(|res_or_opt| { - res_or_opt.map(|v| ::re_types_core::ArrowString(v)) + .map(|res_or_opt| { + res_or_opt.map(|res_or_opt| { + res_or_opt.map(|v| ::re_types_core::ArrowString(v)) + }) }) - }) - .collect::>>>() - .with_context("rerun.blueprint.QueryExpressions#inclusions")? - .into_iter() - } - .collect::>() - }; + .collect::>>>() + .with_context( + "rerun.blueprint.datatypes.QueryExpressions#inclusions", + )? + .into_iter() + } + .collect::>() + }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( offsets.iter().zip(offsets.lengths()), @@ -429,7 +432,7 @@ impl ::re_types_core::Loggable for QueryExpressions { Self::arrow_datatype(), "exclusions", )) - .with_context("rerun.blueprint.QueryExpressions"); + .with_context("rerun.blueprint.datatypes.QueryExpressions"); } let arrow_data = &**arrays_by_name["exclusions"]; { @@ -447,68 +450,71 @@ impl ::re_types_core::Loggable for QueryExpressions { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.QueryExpressions#exclusions")?; + .with_context( + "rerun.blueprint.datatypes.QueryExpressions#exclusions", + )?; if arrow_data.is_empty() { Vec::new() } else { - let arrow_data_inner = { - let arrow_data_inner = &**arrow_data.values(); + let arrow_data_inner = { - let arrow_data_inner = arrow_data_inner + let arrow_data_inner = &**arrow_data.values(); + { + let arrow_data_inner = arrow_data_inner .as_any() .downcast_ref::>() - .ok_or_else(|| { - DeserializationError::datatype_mismatch( - DataType::Utf8, - arrow_data_inner.data_type().clone(), - ) - }) + .ok_or_else(|| DeserializationError::datatype_mismatch( + DataType::Utf8, + arrow_data_inner.data_type().clone(), + )) .with_context( - "rerun.blueprint.QueryExpressions#exclusions", + "rerun.blueprint.datatypes.QueryExpressions#exclusions", )?; - 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()), - arrow_data_inner.validity(), - ) - .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end as usize > arrow_data_inner_buf.len() { - return Err( - DeserializationError::offset_slice_oob( - (start, end), - arrow_data_inner_buf.len(), - ), - ); - } + 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()), + arrow_data_inner.validity(), + ) + .map(|elem| { + elem.map(|(start, len)| { + let start = *start as usize; + let end = start + len; + if end as usize > arrow_data_inner_buf.len() { + return Err( + DeserializationError::offset_slice_oob( + (start, end), + arrow_data_inner_buf.len(), + ), + ); + } - #[allow( - unsafe_code, - clippy::undocumented_unsafe_blocks - )] - let data = unsafe { - arrow_data_inner_buf - .clone() - .sliced_unchecked(start, len) - }; - Ok(data) + #[allow( + unsafe_code, + clippy::undocumented_unsafe_blocks + )] + let data = unsafe { + arrow_data_inner_buf + .clone() + .sliced_unchecked(start, len) + }; + Ok(data) + }) + .transpose() }) - .transpose() - }) - .map(|res_or_opt| { - res_or_opt.map(|res_or_opt| { - res_or_opt.map(|v| ::re_types_core::ArrowString(v)) + .map(|res_or_opt| { + res_or_opt.map(|res_or_opt| { + res_or_opt.map(|v| ::re_types_core::ArrowString(v)) + }) }) - }) - .collect::>>>() - .with_context("rerun.blueprint.QueryExpressions#exclusions")? - .into_iter() - } - .collect::>() - }; + .collect::>>>() + .with_context( + "rerun.blueprint.datatypes.QueryExpressions#exclusions", + )? + .into_iter() + } + .collect::>() + }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( offsets.iter().zip(offsets.lengths()), @@ -553,19 +559,19 @@ impl ::re_types_core::Loggable for QueryExpressions { inclusions: inclusions .ok_or_else(DeserializationError::missing_data) .with_context( - "rerun.blueprint.QueryExpressions#inclusions", + "rerun.blueprint.datatypes.QueryExpressions#inclusions", )?, exclusions: exclusions .ok_or_else(DeserializationError::missing_data) .with_context( - "rerun.blueprint.QueryExpressions#exclusions", + "rerun.blueprint.datatypes.QueryExpressions#exclusions", )?, }) }) .transpose() }) .collect::>>() - .with_context("rerun.blueprint.QueryExpressions")? + .with_context("rerun.blueprint.datatypes.QueryExpressions")? } }) } diff --git a/crates/re_types/src/blueprint/.gitattributes b/crates/re_types/src/blueprint/components/.gitattributes similarity index 100% rename from crates/re_types/src/blueprint/.gitattributes rename to crates/re_types/src/blueprint/components/.gitattributes diff --git a/crates/re_types/src/blueprint/mod.rs b/crates/re_types/src/blueprint/components/mod.rs similarity index 100% rename from crates/re_types/src/blueprint/mod.rs rename to crates/re_types/src/blueprint/components/mod.rs diff --git a/crates/re_types/src/blueprint/components/space_view_component.rs b/crates/re_types/src/blueprint/components/space_view_component.rs new file mode 100644 index 000000000000..b6375701f292 --- /dev/null +++ b/crates/re_types/src/blueprint/components/space_view_component.rs @@ -0,0 +1,159 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/space_view_component.fbs". + +#![allow(trivial_numeric_casts)] +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::iter_on_single_items)] +#![allow(clippy::map_flatten)] +#![allow(clippy::match_wildcard_for_single_variants)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] +#![allow(clippy::unnecessary_cast)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::ComponentName; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: A view of a space. +/// +/// Unstable. Used for the ongoing blueprint experimentations. +#[derive(Clone)] +pub struct SpaceViewComponent(pub crate::blueprint::datatypes::SpaceViewComponent); + +impl> From for SpaceViewComponent { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for SpaceViewComponent { + #[inline] + fn borrow(&self) -> &crate::blueprint::datatypes::SpaceViewComponent { + &self.0 + } +} + +impl std::ops::Deref for SpaceViewComponent { + type Target = crate::blueprint::datatypes::SpaceViewComponent; + + #[inline] + fn deref(&self) -> &crate::blueprint::datatypes::SpaceViewComponent { + &self.0 + } +} + +::re_types_core::macros::impl_into_cow!(SpaceViewComponent); + +impl ::re_types_core::Loggable for SpaceViewComponent { + type Name = ::re_types_core::ComponentName; + + #[inline] + fn name() -> Self::Name { + "rerun.blueprint.components.SpaceViewComponent".into() + } + + #[allow(clippy::wildcard_imports)] + #[inline] + fn arrow_datatype() -> arrow2::datatypes::DataType { + use arrow2::datatypes::*; + DataType::Struct(vec![ + Field { + name: "display_name".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "class_identifier".to_owned(), + data_type: DataType::Utf8, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "space_origin".to_owned(), + data_type: ::arrow_datatype(), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "entities_determined_by_user".to_owned(), + data_type: DataType::Boolean, + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "contents".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: ::arrow_datatype(), + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + ]) + } + + #[allow(clippy::wildcard_imports)] + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult> + where + Self: Clone + 'a, + { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + use arrow2::{array::*, datatypes::*}; + Ok({ + let (somes, data0): (Vec<_>, Vec<_>) = data + .into_iter() + .map(|datum| { + let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); + let datum = datum.map(|datum| { + let Self(data0) = datum.into_owned(); + data0 + }); + (datum.is_some(), datum) + }) + .unzip(); + let data0_bitmap: Option = { + let any_nones = somes.iter().any(|some| !*some); + any_nones.then(|| somes.into()) + }; + { + _ = data0_bitmap; + crate::blueprint::datatypes::SpaceViewComponent::to_arrow_opt(data0)? + } + }) + } + + #[allow(clippy::wildcard_imports)] + fn from_arrow_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + use arrow2::{array::*, buffer::*, datatypes::*}; + Ok( + crate::blueprint::datatypes::SpaceViewComponent::from_arrow_opt(arrow_data) + .with_context("rerun.blueprint.components.SpaceViewComponent#component")? + .into_iter() + .map(|v| v.ok_or_else(DeserializationError::missing_data)) + .map(|res| res.map(|v| Some(Self(v)))) + .collect::>>>() + .with_context("rerun.blueprint.components.SpaceViewComponent#component") + .with_context("rerun.blueprint.components.SpaceViewComponent")?, + ) + } +} diff --git a/crates/re_types/src/blueprint/space_view_component_ext.rs b/crates/re_types/src/blueprint/components/space_view_component_ext.rs similarity index 100% rename from crates/re_types/src/blueprint/space_view_component_ext.rs rename to crates/re_types/src/blueprint/components/space_view_component_ext.rs diff --git a/crates/re_types/src/blueprint/datatypes/.gitattributes b/crates/re_types/src/blueprint/datatypes/.gitattributes new file mode 100644 index 000000000000..07e796c792f7 --- /dev/null +++ b/crates/re_types/src/blueprint/datatypes/.gitattributes @@ -0,0 +1,5 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +mod.rs linguist-generated=true +space_view_component.rs linguist-generated=true diff --git a/crates/re_types/src/blueprint/datatypes/mod.rs b/crates/re_types/src/blueprint/datatypes/mod.rs new file mode 100644 index 000000000000..8af7cdabb944 --- /dev/null +++ b/crates/re_types/src/blueprint/datatypes/mod.rs @@ -0,0 +1,5 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs + +mod space_view_component; + +pub use self::space_view_component::SpaceViewComponent; diff --git a/crates/re_types/src/blueprint/space_view_component.rs b/crates/re_types/src/blueprint/datatypes/space_view_component.rs similarity index 91% rename from crates/re_types/src/blueprint/space_view_component.rs rename to crates/re_types/src/blueprint/datatypes/space_view_component.rs index fd69e7bff802..32d9e34efb33 100644 --- a/crates/re_types/src/blueprint/space_view_component.rs +++ b/crates/re_types/src/blueprint/datatypes/space_view_component.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/re_types/definitions/rerun/blueprint/space_view_component.fbs". +// Based on "crates/re_types/definitions/rerun/blueprint/datatypes/space_view_component.fbs". #![allow(trivial_numeric_casts)] #![allow(unused_imports)] @@ -21,7 +21,7 @@ use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; use ::re_types_core::{DeserializationError, DeserializationResult}; -/// **Blueprint**: A view of a space. +/// **Datatype**: A view of a space. /// /// Unstable. Used for the ongoing blueprint experimentations. #[derive(Clone)] @@ -51,11 +51,11 @@ pub struct SpaceViewComponent { ::re_types_core::macros::impl_into_cow!(SpaceViewComponent); impl ::re_types_core::Loggable for SpaceViewComponent { - type Name = ::re_types_core::ComponentName; + type Name = ::re_types_core::DatatypeName; #[inline] fn name() -> Self::Name { - "rerun.blueprint.SpaceViewComponent".into() + "rerun.blueprint.datatypes.SpaceViewComponent".into() } #[allow(clippy::wildcard_imports)] @@ -124,7 +124,7 @@ impl ::re_types_core::Loggable for SpaceViewComponent { any_nones.then(|| somes.into()) }; StructArray::new( - ::arrow_datatype(), + ::arrow_datatype(), vec![ { let (somes, display_name): (Vec<_>, Vec<_>) = data @@ -397,7 +397,7 @@ impl ::re_types_core::Loggable for SpaceViewComponent { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.SpaceViewComponent")?; + .with_context("rerun.blueprint.datatypes.SpaceViewComponent")?; if arrow_data.is_empty() { Vec::new() } else { @@ -414,7 +414,7 @@ impl ::re_types_core::Loggable for SpaceViewComponent { Self::arrow_datatype(), "display_name", )) - .with_context("rerun.blueprint.SpaceViewComponent"); + .with_context("rerun.blueprint.datatypes.SpaceViewComponent"); } let arrow_data = &**arrays_by_name["display_name"]; { @@ -427,7 +427,9 @@ impl ::re_types_core::Loggable for SpaceViewComponent { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.SpaceViewComponent#display_name")?; + .with_context( + "rerun.blueprint.datatypes.SpaceViewComponent#display_name", + )?; let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( @@ -458,7 +460,7 @@ impl ::re_types_core::Loggable for SpaceViewComponent { }) }) .collect::>>>() - .with_context("rerun.blueprint.SpaceViewComponent#display_name")? + .with_context("rerun.blueprint.datatypes.SpaceViewComponent#display_name")? .into_iter() } }; @@ -468,7 +470,7 @@ impl ::re_types_core::Loggable for SpaceViewComponent { Self::arrow_datatype(), "class_identifier", )) - .with_context("rerun.blueprint.SpaceViewComponent"); + .with_context("rerun.blueprint.datatypes.SpaceViewComponent"); } let arrow_data = &**arrays_by_name["class_identifier"]; { @@ -481,7 +483,9 @@ impl ::re_types_core::Loggable for SpaceViewComponent { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.SpaceViewComponent#class_identifier")?; + .with_context( + "rerun.blueprint.datatypes.SpaceViewComponent#class_identifier", + )?; let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( @@ -512,7 +516,9 @@ impl ::re_types_core::Loggable for SpaceViewComponent { }) }) .collect::>>>() - .with_context("rerun.blueprint.SpaceViewComponent#class_identifier")? + .with_context( + "rerun.blueprint.datatypes.SpaceViewComponent#class_identifier", + )? .into_iter() } }; @@ -522,7 +528,7 @@ impl ::re_types_core::Loggable for SpaceViewComponent { Self::arrow_datatype(), "space_origin", )) - .with_context("rerun.blueprint.SpaceViewComponent"); + .with_context("rerun.blueprint.datatypes.SpaceViewComponent"); } let arrow_data = &**arrays_by_name["space_origin"]; { @@ -535,7 +541,9 @@ impl ::re_types_core::Loggable for SpaceViewComponent { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.SpaceViewComponent#space_origin")?; + .with_context( + "rerun.blueprint.datatypes.SpaceViewComponent#space_origin", + )?; let arrow_data_buf = arrow_data.values(); let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( @@ -568,7 +576,7 @@ impl ::re_types_core::Loggable for SpaceViewComponent { }) }) .collect::>>>() - .with_context("rerun.blueprint.SpaceViewComponent#space_origin")? + .with_context("rerun.blueprint.datatypes.SpaceViewComponent#space_origin")? .into_iter() } }; @@ -578,20 +586,18 @@ impl ::re_types_core::Loggable for SpaceViewComponent { Self::arrow_datatype(), "entities_determined_by_user", )) - .with_context("rerun.blueprint.SpaceViewComponent"); + .with_context("rerun.blueprint.datatypes.SpaceViewComponent"); } let arrow_data = &**arrays_by_name["entities_determined_by_user"]; arrow_data .as_any() .downcast_ref::() - .ok_or_else(|| { - DeserializationError::datatype_mismatch( - DataType::Boolean, - arrow_data.data_type().clone(), - ) - }) + .ok_or_else(|| DeserializationError::datatype_mismatch( + DataType::Boolean, + arrow_data.data_type().clone(), + )) .with_context( - "rerun.blueprint.SpaceViewComponent#entities_determined_by_user", + "rerun.blueprint.datatypes.SpaceViewComponent#entities_determined_by_user", )? .into_iter() }; @@ -601,7 +607,7 @@ impl ::re_types_core::Loggable for SpaceViewComponent { Self::arrow_datatype(), "contents", )) - .with_context("rerun.blueprint.SpaceViewComponent"); + .with_context("rerun.blueprint.datatypes.SpaceViewComponent"); } let arrow_data = &**arrays_by_name["contents"]; { @@ -619,14 +625,18 @@ impl ::re_types_core::Loggable for SpaceViewComponent { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.SpaceViewComponent#contents")?; + .with_context( + "rerun.blueprint.datatypes.SpaceViewComponent#contents", + )?; if arrow_data.is_empty() { Vec::new() } else { let arrow_data_inner = { let arrow_data_inner = &**arrow_data.values(); crate::datatypes::Uuid::from_arrow_opt(arrow_data_inner) - .with_context("rerun.blueprint.SpaceViewComponent#contents")? + .with_context( + "rerun.blueprint.datatypes.SpaceViewComponent#contents", + )? .into_iter() .collect::>() }; @@ -685,33 +695,33 @@ impl ::re_types_core::Loggable for SpaceViewComponent { display_name: display_name .ok_or_else(DeserializationError::missing_data) .with_context( - "rerun.blueprint.SpaceViewComponent#display_name", + "rerun.blueprint.datatypes.SpaceViewComponent#display_name", )?, class_identifier: class_identifier .ok_or_else(DeserializationError::missing_data) .with_context( - "rerun.blueprint.SpaceViewComponent#class_identifier", + "rerun.blueprint.datatypes.SpaceViewComponent#class_identifier", )?, space_origin: space_origin .ok_or_else(DeserializationError::missing_data) .with_context( - "rerun.blueprint.SpaceViewComponent#space_origin", + "rerun.blueprint.datatypes.SpaceViewComponent#space_origin", )?, entities_determined_by_user: entities_determined_by_user .ok_or_else(DeserializationError::missing_data) .with_context( - "rerun.blueprint.SpaceViewComponent#entities_determined_by_user", + "rerun.blueprint.datatypes.SpaceViewComponent#entities_determined_by_user", )?, contents: contents .ok_or_else(DeserializationError::missing_data) .with_context( - "rerun.blueprint.SpaceViewComponent#contents", + "rerun.blueprint.datatypes.SpaceViewComponent#contents", )?, })) .transpose() }) .collect::>>() - .with_context("rerun.blueprint.SpaceViewComponent")? + .with_context("rerun.blueprint.datatypes.SpaceViewComponent")? } }) } diff --git a/crates/re_viewer/src/blueprint/components/.gitattributes b/crates/re_viewer/src/blueprint/components/.gitattributes new file mode 100644 index 000000000000..45c858ca5099 --- /dev/null +++ b/crates/re_viewer/src/blueprint/components/.gitattributes @@ -0,0 +1,5 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +mod.rs linguist-generated=true +panel_view.rs linguist-generated=true diff --git a/crates/re_viewer/src/blueprint/components/mod.rs b/crates/re_viewer/src/blueprint/components/mod.rs new file mode 100644 index 000000000000..709b135a99b6 --- /dev/null +++ b/crates/re_viewer/src/blueprint/components/mod.rs @@ -0,0 +1,6 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs + +mod panel_view; +mod panel_view_ext; + +pub use self::panel_view::PanelView; diff --git a/crates/re_viewer/src/blueprint/components/panel_view.rs b/crates/re_viewer/src/blueprint/components/panel_view.rs new file mode 100644 index 000000000000..74bb3f0ae6b0 --- /dev/null +++ b/crates/re_viewer/src/blueprint/components/panel_view.rs @@ -0,0 +1,123 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/panel_view.fbs". + +#![allow(trivial_numeric_casts)] +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::iter_on_single_items)] +#![allow(clippy::map_flatten)] +#![allow(clippy::match_wildcard_for_single_variants)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] +#![allow(clippy::unnecessary_cast)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::ComponentName; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: The state of the panels. +/// +/// Unstable. Used for the ongoing blueprint experimentations. +#[derive(Clone, Debug, Copy)] +pub struct PanelView(pub bool); + +impl From for PanelView { + #[inline] + fn from(is_expanded: bool) -> Self { + Self(is_expanded) + } +} + +impl From for bool { + #[inline] + fn from(value: PanelView) -> Self { + value.0 + } +} + +::re_types_core::macros::impl_into_cow!(PanelView); + +impl ::re_types_core::Loggable for PanelView { + type Name = ::re_types_core::ComponentName; + + #[inline] + fn name() -> Self::Name { + "rerun.blueprint.components.PanelView".into() + } + + #[allow(clippy::wildcard_imports)] + #[inline] + fn arrow_datatype() -> arrow2::datatypes::DataType { + use arrow2::datatypes::*; + DataType::Boolean + } + + #[allow(clippy::wildcard_imports)] + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult> + where + Self: Clone + 'a, + { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + use arrow2::{array::*, datatypes::*}; + Ok({ + let (somes, data0): (Vec<_>, Vec<_>) = data + .into_iter() + .map(|datum| { + let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); + let datum = datum.map(|datum| { + let Self(data0) = datum.into_owned(); + data0 + }); + (datum.is_some(), datum) + }) + .unzip(); + let data0_bitmap: Option = { + let any_nones = somes.iter().any(|some| !*some); + any_nones.then(|| somes.into()) + }; + BooleanArray::new( + Self::arrow_datatype(), + data0.into_iter().map(|v| v.unwrap_or_default()).collect(), + data0_bitmap, + ) + .boxed() + }) + } + + #[allow(clippy::wildcard_imports)] + fn from_arrow_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + use arrow2::{array::*, buffer::*, datatypes::*}; + Ok(arrow_data + .as_any() + .downcast_ref::() + .ok_or_else(|| { + DeserializationError::datatype_mismatch( + DataType::Boolean, + arrow_data.data_type().clone(), + ) + }) + .with_context("rerun.blueprint.components.PanelView#is_expanded")? + .into_iter() + .map(|v| v.ok_or_else(DeserializationError::missing_data)) + .map(|res| res.map(|v| Some(Self(v)))) + .collect::>>>() + .with_context("rerun.blueprint.components.PanelView#is_expanded") + .with_context("rerun.blueprint.components.PanelView")?) + } +} diff --git a/crates/re_viewer/src/blueprint/panel_view_ext.rs b/crates/re_viewer/src/blueprint/components/panel_view_ext.rs similarity index 100% rename from crates/re_viewer/src/blueprint/panel_view_ext.rs rename to crates/re_viewer/src/blueprint/components/panel_view_ext.rs diff --git a/crates/re_viewer/src/blueprint/panel_view.rs b/crates/re_viewer/src/blueprint/panel_view.rs deleted file mode 100644 index 06ca6917ac0f..000000000000 --- a/crates/re_viewer/src/blueprint/panel_view.rs +++ /dev/null @@ -1,199 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/re_types/definitions/rerun/blueprint/panel_view.fbs". - -#![allow(trivial_numeric_casts)] -#![allow(unused_imports)] -#![allow(unused_parens)] -#![allow(clippy::clone_on_copy)] -#![allow(clippy::iter_on_single_items)] -#![allow(clippy::map_flatten)] -#![allow(clippy::match_wildcard_for_single_variants)] -#![allow(clippy::needless_question_mark)] -#![allow(clippy::new_without_default)] -#![allow(clippy::redundant_closure)] -#![allow(clippy::too_many_arguments)] -#![allow(clippy::too_many_lines)] -#![allow(clippy::unnecessary_cast)] - -use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; -use ::re_types_core::SerializationResult; -use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; -use ::re_types_core::{DeserializationError, DeserializationResult}; - -/// **Blueprint**: The state of the panels. -/// -/// Unstable. Used for the ongoing blueprint experimentations. -#[derive(Clone, Debug, Copy)] -pub struct PanelView { - pub is_expanded: bool, -} - -impl From for PanelView { - #[inline] - fn from(is_expanded: bool) -> Self { - Self { is_expanded } - } -} - -impl From for bool { - #[inline] - fn from(value: PanelView) -> Self { - value.is_expanded - } -} - -::re_types_core::macros::impl_into_cow!(PanelView); - -impl ::re_types_core::Loggable for PanelView { - type Name = ::re_types_core::ComponentName; - - #[inline] - fn name() -> Self::Name { - "rerun.blueprint.PanelView".into() - } - - #[allow(clippy::wildcard_imports)] - #[inline] - fn arrow_datatype() -> arrow2::datatypes::DataType { - use arrow2::datatypes::*; - DataType::Struct(vec![Field { - name: "is_expanded".to_owned(), - data_type: DataType::Boolean, - is_nullable: false, - metadata: [].into(), - }]) - } - - #[allow(clippy::wildcard_imports)] - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult> - where - Self: Clone + 'a, - { - re_tracing::profile_function!(); - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, datatypes::*}; - Ok({ - let (somes, data): (Vec<_>, Vec<_>) = data - .into_iter() - .map(|datum| { - let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); - (datum.is_some(), datum) - }) - .unzip(); - let bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - StructArray::new( - ::arrow_datatype(), - vec![{ - let (somes, is_expanded): (Vec<_>, Vec<_>) = data - .iter() - .map(|datum| { - let datum = datum.as_ref().map(|datum| { - let Self { is_expanded, .. } = &**datum; - is_expanded.clone() - }); - (datum.is_some(), datum) - }) - .unzip(); - let is_expanded_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - BooleanArray::new( - DataType::Boolean, - is_expanded - .into_iter() - .map(|v| v.unwrap_or_default()) - .collect(), - is_expanded_bitmap, - ) - .boxed() - }], - bitmap, - ) - .boxed() - }) - } - - #[allow(clippy::wildcard_imports)] - fn from_arrow_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - re_tracing::profile_function!(); - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, buffer::*, datatypes::*}; - Ok({ - let arrow_data = arrow_data - .as_any() - .downcast_ref::() - .ok_or_else(|| { - DeserializationError::datatype_mismatch( - DataType::Struct(vec![Field { - name: "is_expanded".to_owned(), - data_type: DataType::Boolean, - is_nullable: false, - metadata: [].into(), - }]), - arrow_data.data_type().clone(), - ) - }) - .with_context("rerun.blueprint.PanelView")?; - if arrow_data.is_empty() { - Vec::new() - } else { - let (arrow_data_fields, arrow_data_arrays) = - (arrow_data.fields(), arrow_data.values()); - let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data_fields - .iter() - .map(|field| field.name.as_str()) - .zip(arrow_data_arrays) - .collect(); - let is_expanded = { - if !arrays_by_name.contains_key("is_expanded") { - return Err(DeserializationError::missing_struct_field( - Self::arrow_datatype(), - "is_expanded", - )) - .with_context("rerun.blueprint.PanelView"); - } - let arrow_data = &**arrays_by_name["is_expanded"]; - arrow_data - .as_any() - .downcast_ref::() - .ok_or_else(|| { - DeserializationError::datatype_mismatch( - DataType::Boolean, - arrow_data.data_type().clone(), - ) - }) - .with_context("rerun.blueprint.PanelView#is_expanded")? - .into_iter() - }; - arrow2::bitmap::utils::ZipValidity::new_with_validity( - ::itertools::izip!(is_expanded), - arrow_data.validity(), - ) - .map(|opt| { - opt.map(|(is_expanded)| { - Ok(Self { - is_expanded: is_expanded - .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.PanelView#is_expanded")?, - }) - }) - .transpose() - }) - .collect::>>() - .with_context("rerun.blueprint.PanelView")? - } - }) - } -} diff --git a/crates/re_viewport/src/blueprint/components/.gitattributes b/crates/re_viewport/src/blueprint/components/.gitattributes new file mode 100644 index 000000000000..87f1cd5ff1a0 --- /dev/null +++ b/crates/re_viewport/src/blueprint/components/.gitattributes @@ -0,0 +1,7 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +auto_space_views.rs linguist-generated=true +mod.rs linguist-generated=true +space_view_maximized.rs linguist-generated=true +viewport_layout.rs linguist-generated=true diff --git a/crates/re_viewport/src/blueprint/auto_space_views.rs b/crates/re_viewport/src/blueprint/components/auto_space_views.rs similarity index 89% rename from crates/re_viewport/src/blueprint/auto_space_views.rs rename to crates/re_viewport/src/blueprint/components/auto_space_views.rs index b1bf0c7093b0..6eb7c97d60c9 100644 --- a/crates/re_viewport/src/blueprint/auto_space_views.rs +++ b/crates/re_viewport/src/blueprint/components/auto_space_views.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/re_types/definitions/rerun/blueprint/auto_space_views.fbs". +// Based on "crates/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs". #![allow(trivial_numeric_casts)] #![allow(unused_imports)] @@ -21,7 +21,7 @@ use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; use ::re_types_core::{DeserializationError, DeserializationResult}; -/// **Blueprint**: A flag indicating space views should be automatically populated. +/// **Component**: A flag indicating space views should be automatically populated. /// /// Unstable. Used for the ongoing blueprint experimentations. #[derive(Clone, Debug, Copy, Default)] @@ -49,7 +49,7 @@ impl ::re_types_core::Loggable for AutoSpaceViews { #[inline] fn name() -> Self::Name { - "rerun.blueprint.AutoSpaceViews".into() + "rerun.blueprint.components.AutoSpaceViews".into() } #[allow(clippy::wildcard_imports)] @@ -113,12 +113,12 @@ impl ::re_types_core::Loggable for AutoSpaceViews { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.AutoSpaceViews#enabled")? + .with_context("rerun.blueprint.components.AutoSpaceViews#enabled")? .into_iter() .map(|v| v.ok_or_else(DeserializationError::missing_data)) .map(|res| res.map(|v| Some(Self(v)))) .collect::>>>() - .with_context("rerun.blueprint.AutoSpaceViews#enabled") - .with_context("rerun.blueprint.AutoSpaceViews")?) + .with_context("rerun.blueprint.components.AutoSpaceViews#enabled") + .with_context("rerun.blueprint.components.AutoSpaceViews")?) } } diff --git a/crates/re_viewport/src/blueprint/mod.rs b/crates/re_viewport/src/blueprint/components/mod.rs similarity index 93% rename from crates/re_viewport/src/blueprint/mod.rs rename to crates/re_viewport/src/blueprint/components/mod.rs index 3c2166644527..4ade08ab7f23 100644 --- a/crates/re_viewport/src/blueprint/mod.rs +++ b/crates/re_viewport/src/blueprint/components/mod.rs @@ -4,7 +4,6 @@ mod auto_space_views; mod space_view_maximized; mod space_view_maximized_ext; mod viewport_layout; -mod viewport_layout_ext; pub use self::auto_space_views::AutoSpaceViews; pub use self::space_view_maximized::SpaceViewMaximized; diff --git a/crates/re_viewport/src/blueprint/space_view_maximized.rs b/crates/re_viewport/src/blueprint/components/space_view_maximized.rs similarity index 93% rename from crates/re_viewport/src/blueprint/space_view_maximized.rs rename to crates/re_viewport/src/blueprint/components/space_view_maximized.rs index cd9657e559f7..fea6ed26595b 100644 --- a/crates/re_viewport/src/blueprint/space_view_maximized.rs +++ b/crates/re_viewport/src/blueprint/components/space_view_maximized.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/re_types/definitions/rerun/blueprint/space_view_maximized.fbs". +// Based on "crates/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs". #![allow(trivial_numeric_casts)] #![allow(unused_imports)] @@ -21,7 +21,7 @@ use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; use ::re_types_core::{DeserializationError, DeserializationResult}; -/// **Blueprint**: Whether a space view is maximized. +/// **Component**: Whether a space view is maximized. /// /// Unstable. Used for the ongoing blueprint experimentations. #[derive(Clone, Debug, Copy, Default, PartialEq, Eq)] @@ -49,7 +49,7 @@ impl ::re_types_core::Loggable for SpaceViewMaximized { #[inline] fn name() -> Self::Name { - "rerun.blueprint.SpaceViewMaximized".into() + "rerun.blueprint.components.SpaceViewMaximized".into() } #[allow(clippy::wildcard_imports)] @@ -160,7 +160,7 @@ impl ::re_types_core::Loggable for SpaceViewMaximized { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.SpaceViewMaximized#id")?; + .with_context("rerun.blueprint.components.SpaceViewMaximized#id")?; if arrow_data.is_empty() { Vec::new() } else { @@ -175,7 +175,7 @@ impl ::re_types_core::Loggable for SpaceViewMaximized { arrow_data_inner.data_type().clone(), ) }) - .with_context("rerun.blueprint.SpaceViewMaximized#id")? + .with_context("rerun.blueprint.components.SpaceViewMaximized#id")? .values() }; let offsets = arrow_data.offsets(); @@ -215,7 +215,7 @@ impl ::re_types_core::Loggable for SpaceViewMaximized { .map(Ok) .map(|res| res.map(|v| Some(Self(v)))) .collect::>>>() - .with_context("rerun.blueprint.SpaceViewMaximized#id") - .with_context("rerun.blueprint.SpaceViewMaximized")?) + .with_context("rerun.blueprint.components.SpaceViewMaximized#id") + .with_context("rerun.blueprint.components.SpaceViewMaximized")?) } } diff --git a/crates/re_viewport/src/blueprint/space_view_maximized_ext.rs b/crates/re_viewport/src/blueprint/components/space_view_maximized_ext.rs similarity index 100% rename from crates/re_viewport/src/blueprint/space_view_maximized_ext.rs rename to crates/re_viewport/src/blueprint/components/space_view_maximized_ext.rs diff --git a/crates/re_viewport/src/blueprint/components/viewport_layout.rs b/crates/re_viewport/src/blueprint/components/viewport_layout.rs new file mode 100644 index 000000000000..fbbc3c24a6c0 --- /dev/null +++ b/crates/re_viewport/src/blueprint/components/viewport_layout.rs @@ -0,0 +1,152 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs". + +#![allow(trivial_numeric_casts)] +#![allow(unused_imports)] +#![allow(unused_parens)] +#![allow(clippy::clone_on_copy)] +#![allow(clippy::iter_on_single_items)] +#![allow(clippy::map_flatten)] +#![allow(clippy::match_wildcard_for_single_variants)] +#![allow(clippy::needless_question_mark)] +#![allow(clippy::new_without_default)] +#![allow(clippy::redundant_closure)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_lines)] +#![allow(clippy::unnecessary_cast)] + +use ::re_types_core::external::arrow2; +use ::re_types_core::ComponentName; +use ::re_types_core::SerializationResult; +use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; +use ::re_types_core::{DeserializationError, DeserializationResult}; + +/// **Component**: A view of a space. +/// +/// Unstable. Used for the ongoing blueprint experimentations. +#[derive(Clone, Debug, PartialEq)] +pub struct ViewportLayout(pub crate::blueprint::datatypes::ViewportLayout); + +impl> From for ViewportLayout { + fn from(v: T) -> Self { + Self(v.into()) + } +} + +impl std::borrow::Borrow for ViewportLayout { + #[inline] + fn borrow(&self) -> &crate::blueprint::datatypes::ViewportLayout { + &self.0 + } +} + +impl std::ops::Deref for ViewportLayout { + type Target = crate::blueprint::datatypes::ViewportLayout; + + #[inline] + fn deref(&self) -> &crate::blueprint::datatypes::ViewportLayout { + &self.0 + } +} + +::re_types_core::macros::impl_into_cow!(ViewportLayout); + +impl ::re_types_core::Loggable for ViewportLayout { + type Name = ::re_types_core::ComponentName; + + #[inline] + fn name() -> Self::Name { + "rerun.blueprint.components.ViewportLayout".into() + } + + #[allow(clippy::wildcard_imports)] + #[inline] + fn arrow_datatype() -> arrow2::datatypes::DataType { + use arrow2::datatypes::*; + DataType::Struct(vec![ + Field { + name: "space_view_keys".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::UInt8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "tree".to_owned(), + data_type: DataType::List(Box::new(Field { + name: "item".to_owned(), + data_type: DataType::UInt8, + is_nullable: false, + metadata: [].into(), + })), + is_nullable: false, + metadata: [].into(), + }, + Field { + name: "auto_layout".to_owned(), + data_type: DataType::Boolean, + is_nullable: false, + metadata: [].into(), + }, + ]) + } + + #[allow(clippy::wildcard_imports)] + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> SerializationResult> + where + Self: Clone + 'a, + { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + use arrow2::{array::*, datatypes::*}; + Ok({ + let (somes, data0): (Vec<_>, Vec<_>) = data + .into_iter() + .map(|datum| { + let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); + let datum = datum.map(|datum| { + let Self(data0) = datum.into_owned(); + data0 + }); + (datum.is_some(), datum) + }) + .unzip(); + let data0_bitmap: Option = { + let any_nones = somes.iter().any(|some| !*some); + any_nones.then(|| somes.into()) + }; + { + _ = data0_bitmap; + crate::blueprint::datatypes::ViewportLayout::to_arrow_opt(data0)? + } + }) + } + + #[allow(clippy::wildcard_imports)] + fn from_arrow_opt( + arrow_data: &dyn arrow2::array::Array, + ) -> DeserializationResult>> + where + Self: Sized, + { + re_tracing::profile_function!(); + use ::re_types_core::{Loggable as _, ResultExt as _}; + use arrow2::{array::*, buffer::*, datatypes::*}; + Ok( + crate::blueprint::datatypes::ViewportLayout::from_arrow_opt(arrow_data) + .with_context("rerun.blueprint.components.ViewportLayout#viewport_layout")? + .into_iter() + .map(|v| v.ok_or_else(DeserializationError::missing_data)) + .map(|res| res.map(|v| Some(Self(v)))) + .collect::>>>() + .with_context("rerun.blueprint.components.ViewportLayout#viewport_layout") + .with_context("rerun.blueprint.components.ViewportLayout")?, + ) + } +} diff --git a/crates/re_viewport/src/blueprint/datatypes/.gitattributes b/crates/re_viewport/src/blueprint/datatypes/.gitattributes new file mode 100644 index 000000000000..2cf69b256b30 --- /dev/null +++ b/crates/re_viewport/src/blueprint/datatypes/.gitattributes @@ -0,0 +1,5 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +mod.rs linguist-generated=true +viewport_layout.rs linguist-generated=true diff --git a/crates/re_viewport/src/blueprint/datatypes/mod.rs b/crates/re_viewport/src/blueprint/datatypes/mod.rs new file mode 100644 index 000000000000..8193403f8a05 --- /dev/null +++ b/crates/re_viewport/src/blueprint/datatypes/mod.rs @@ -0,0 +1,6 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs + +mod viewport_layout; +mod viewport_layout_ext; + +pub use self::viewport_layout::ViewportLayout; diff --git a/crates/re_viewport/src/blueprint/viewport_layout.rs b/crates/re_viewport/src/blueprint/datatypes/viewport_layout.rs similarity index 91% rename from crates/re_viewport/src/blueprint/viewport_layout.rs rename to crates/re_viewport/src/blueprint/datatypes/viewport_layout.rs index afc3a0d31366..8a512d4bc54b 100644 --- a/crates/re_viewport/src/blueprint/viewport_layout.rs +++ b/crates/re_viewport/src/blueprint/datatypes/viewport_layout.rs @@ -1,5 +1,5 @@ // DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/re_types/definitions/rerun/blueprint/viewport_layout.fbs". +// Based on "crates/re_types/definitions/rerun/blueprint/datatypes/viewport_layout.fbs". #![allow(trivial_numeric_casts)] #![allow(unused_imports)] @@ -21,7 +21,7 @@ use ::re_types_core::SerializationResult; use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; use ::re_types_core::{DeserializationError, DeserializationResult}; -/// **Blueprint**: A view of a space. +/// **Datatype**: A view of a space. /// /// Unstable. Used for the ongoing blueprint experimentations. #[derive(Clone, Debug, PartialEq)] @@ -39,11 +39,11 @@ pub struct ViewportLayout { ::re_types_core::macros::impl_into_cow!(ViewportLayout); impl ::re_types_core::Loggable for ViewportLayout { - type Name = ::re_types_core::ComponentName; + type Name = ::re_types_core::DatatypeName; #[inline] fn name() -> Self::Name { - "rerun.blueprint.ViewportLayout".into() + "rerun.blueprint.datatypes.ViewportLayout".into() } #[allow(clippy::wildcard_imports)] @@ -105,7 +105,7 @@ impl ::re_types_core::Loggable for ViewportLayout { any_nones.then(|| somes.into()) }; StructArray::new( - ::arrow_datatype(), + ::arrow_datatype(), vec![ { let (somes, space_view_keys): (Vec<_>, Vec<_>) = data @@ -327,7 +327,7 @@ impl ::re_types_core::Loggable for ViewportLayout { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.ViewportLayout")?; + .with_context("rerun.blueprint.datatypes.ViewportLayout")?; if arrow_data.is_empty() { Vec::new() } else { @@ -344,7 +344,7 @@ impl ::re_types_core::Loggable for ViewportLayout { Self::arrow_datatype(), "space_view_keys", )) - .with_context("rerun.blueprint.ViewportLayout"); + .with_context("rerun.blueprint.datatypes.ViewportLayout"); } let arrow_data = &**arrays_by_name["space_view_keys"]; { @@ -362,24 +362,27 @@ impl ::re_types_core::Loggable for ViewportLayout { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.ViewportLayout#space_view_keys")?; + .with_context( + "rerun.blueprint.datatypes.ViewportLayout#space_view_keys", + )?; if arrow_data.is_empty() { Vec::new() } else { - let arrow_data_inner = { - let arrow_data_inner = &**arrow_data.values(); - arrow_data_inner + let arrow_data_inner = + { + let arrow_data_inner = &**arrow_data.values(); + arrow_data_inner .as_any() .downcast_ref::() - .ok_or_else(|| { - DeserializationError::datatype_mismatch( - DataType::UInt8, - arrow_data_inner.data_type().clone(), - ) - }) - .with_context("rerun.blueprint.ViewportLayout#space_view_keys")? + .ok_or_else(|| DeserializationError::datatype_mismatch( + DataType::UInt8, + arrow_data_inner.data_type().clone(), + )) + .with_context( + "rerun.blueprint.datatypes.ViewportLayout#space_view_keys", + )? .values() - }; + }; let offsets = arrow_data.offsets(); arrow2::bitmap::utils::ZipValidity::new_with_validity( offsets.iter().zip(offsets.lengths()), @@ -425,7 +428,7 @@ impl ::re_types_core::Loggable for ViewportLayout { Self::arrow_datatype(), "tree", )) - .with_context("rerun.blueprint.ViewportLayout"); + .with_context("rerun.blueprint.datatypes.ViewportLayout"); } let arrow_data = &**arrays_by_name["tree"]; { @@ -443,7 +446,7 @@ impl ::re_types_core::Loggable for ViewportLayout { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.ViewportLayout#tree")?; + .with_context("rerun.blueprint.datatypes.ViewportLayout#tree")?; if arrow_data.is_empty() { Vec::new() } else { @@ -458,7 +461,7 @@ impl ::re_types_core::Loggable for ViewportLayout { arrow_data_inner.data_type().clone(), ) }) - .with_context("rerun.blueprint.ViewportLayout#tree")? + .with_context("rerun.blueprint.datatypes.ViewportLayout#tree")? .values() }; let offsets = arrow_data.offsets(); @@ -505,7 +508,7 @@ impl ::re_types_core::Loggable for ViewportLayout { Self::arrow_datatype(), "auto_layout", )) - .with_context("rerun.blueprint.ViewportLayout"); + .with_context("rerun.blueprint.datatypes.ViewportLayout"); } let arrow_data = &**arrays_by_name["auto_layout"]; arrow_data @@ -517,7 +520,7 @@ impl ::re_types_core::Loggable for ViewportLayout { arrow_data.data_type().clone(), ) }) - .with_context("rerun.blueprint.ViewportLayout#auto_layout")? + .with_context("rerun.blueprint.datatypes.ViewportLayout#auto_layout")? .into_iter() }; arrow2::bitmap::utils::ZipValidity::new_with_validity( @@ -529,19 +532,23 @@ impl ::re_types_core::Loggable for ViewportLayout { Ok(Self { space_view_keys: space_view_keys .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.ViewportLayout#space_view_keys")?, + .with_context( + "rerun.blueprint.datatypes.ViewportLayout#space_view_keys", + )?, tree: tree .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.ViewportLayout#tree")?, + .with_context("rerun.blueprint.datatypes.ViewportLayout#tree")?, auto_layout: auto_layout .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.ViewportLayout#auto_layout")?, + .with_context( + "rerun.blueprint.datatypes.ViewportLayout#auto_layout", + )?, }) }) .transpose() }) .collect::>>() - .with_context("rerun.blueprint.ViewportLayout")? + .with_context("rerun.blueprint.datatypes.ViewportLayout")? } }) } diff --git a/crates/re_viewport/src/blueprint/viewport_layout_ext.rs b/crates/re_viewport/src/blueprint/datatypes/viewport_layout_ext.rs similarity index 100% rename from crates/re_viewport/src/blueprint/viewport_layout_ext.rs rename to crates/re_viewport/src/blueprint/datatypes/viewport_layout_ext.rs diff --git a/docs/content/reference/types/datatypes/entity_path.md b/docs/content/reference/types/datatypes/entity_path.md index f53ee1b71e41..999eaf78f8aa 100644 --- a/docs/content/reference/types/datatypes/entity_path.md +++ b/docs/content/reference/types/datatypes/entity_path.md @@ -13,4 +13,4 @@ A path to an entity in the `DataStore`. ## Used by -* [`SpaceViewComponent`](../blueprint/space_view_component.md?speculative-link) +* [`SpaceViewComponent`](../datatypes/space_view_component.md?speculative-link) diff --git a/docs/content/reference/types/datatypes/uuid.md b/docs/content/reference/types/datatypes/uuid.md index 5e6bfa39e4c2..cecbb13a92fe 100644 --- a/docs/content/reference/types/datatypes/uuid.md +++ b/docs/content/reference/types/datatypes/uuid.md @@ -13,4 +13,4 @@ A 16-byte uuid. ## Used by -* [`SpaceViewComponent`](../blueprint/space_view_component.md?speculative-link) +* [`SpaceViewComponent`](../datatypes/space_view_component.md?speculative-link) diff --git a/rerun_cpp/src/rerun/.gitattributes b/rerun_cpp/src/rerun/.gitattributes index 967d56cb0784..435e1f8fe40d 100644 --- a/rerun_cpp/src/rerun/.gitattributes +++ b/rerun_cpp/src/rerun/.gitattributes @@ -2,6 +2,5 @@ .gitattributes linguist-generated=true archetypes.hpp linguist-generated=true -blueprint.hpp linguist-generated=true components.hpp linguist-generated=true datatypes.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes b/rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes new file mode 100644 index 000000000000..435e1f8fe40d --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes @@ -0,0 +1,6 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +archetypes.hpp linguist-generated=true +components.hpp linguist-generated=true +datatypes.hpp linguist-generated=true diff --git a/rerun_cpp/tests/generated/blueprint.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp similarity index 100% rename from rerun_cpp/tests/generated/blueprint.hpp rename to rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp new file mode 100644 index 000000000000..526517caf42c --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp @@ -0,0 +1,11 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs + +#pragma once + +#include "blueprint/components/auto_space_views.hpp" +#include "blueprint/components/entity_properties_component.hpp" +#include "blueprint/components/panel_view.hpp" +#include "blueprint/components/query_expressions.hpp" +#include "blueprint/components/space_view_component.hpp" +#include "blueprint/components/space_view_maximized.hpp" +#include "blueprint/components/viewport_layout.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp new file mode 100644 index 000000000000..3d21d0d3d0ba --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp @@ -0,0 +1,7 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs + +#pragma once + +#include "blueprint/datatypes/query_expressions.hpp" +#include "blueprint/datatypes/space_view_component.hpp" +#include "blueprint/datatypes/viewport_layout.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/components/.gitattributes b/rerun_cpp/src/rerun/blueprint/components/.gitattributes new file mode 100644 index 000000000000..61a66315e64c --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/.gitattributes @@ -0,0 +1,17 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +auto_space_views.cpp linguist-generated=true +auto_space_views.hpp linguist-generated=true +entity_properties_component.cpp linguist-generated=true +entity_properties_component.hpp linguist-generated=true +panel_view.cpp linguist-generated=true +panel_view.hpp linguist-generated=true +query_expressions.cpp linguist-generated=true +query_expressions.hpp linguist-generated=true +space_view_component.cpp linguist-generated=true +space_view_component.hpp linguist-generated=true +space_view_maximized.cpp linguist-generated=true +space_view_maximized.hpp linguist-generated=true +viewport_layout.cpp linguist-generated=true +viewport_layout.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/components/auto_space_views.cpp b/rerun_cpp/src/rerun/blueprint/components/auto_space_views.cpp new file mode 100644 index 000000000000..9dee4a5079d5 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/auto_space_views.cpp @@ -0,0 +1,62 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs". + +#include "auto_space_views.hpp" + +#include +#include + +namespace rerun::blueprint::components {} + +namespace rerun { + const std::shared_ptr& + Loggable::arrow_datatype() { + static const auto datatype = arrow::boolean(); + return datatype; + } + + rerun::Error Loggable::fill_arrow_array_builder( + arrow::BooleanBuilder* builder, const blueprint::components::AutoSpaceViews* elements, + size_t num_elements + ) { + if (builder == nullptr) { + return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); + } + if (elements == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Cannot serialize null pointer to arrow array." + ); + } + + static_assert(sizeof(*elements) == sizeof(elements->enabled)); + ARROW_RETURN_NOT_OK(builder->AppendValues( + reinterpret_cast(&elements->enabled), + static_cast(num_elements) + )); + + return Error::ok(); + } + + Result> Loggable::to_arrow( + const blueprint::components::AutoSpaceViews* instances, size_t num_instances + ) { + // TODO(andreas): Allow configuring the memory pool. + arrow::MemoryPool* pool = arrow::default_memory_pool(); + auto datatype = arrow_datatype(); + + ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) + if (instances && num_instances > 0) { + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + static_cast(builder.get()), + instances, + num_instances + ) + ); + } + std::shared_ptr array; + ARROW_RETURN_NOT_OK(builder->Finish(&array)); + return array; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/auto_space_views.hpp b/rerun_cpp/src/rerun/blueprint/components/auto_space_views.hpp new file mode 100644 index 000000000000..7ed54e52a1ff --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/auto_space_views.hpp @@ -0,0 +1,59 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/auto_space_views.fbs". + +#pragma once + +#include "../../result.hpp" + +#include +#include + +namespace arrow { + class Array; + class BooleanBuilder; + class DataType; +} // namespace arrow + +namespace rerun::blueprint::components { + /// **Component**: A flag indicating space views should be automatically populated. + /// + /// Unstable. Used for the ongoing blueprint experimentations. + struct AutoSpaceViews { + bool enabled; + + public: + AutoSpaceViews() = default; + + AutoSpaceViews(bool enabled_) : enabled(enabled_) {} + + AutoSpaceViews& operator=(bool enabled_) { + enabled = enabled_; + return *this; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + template + struct Loggable; + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.blueprint.components.AutoSpaceViews"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype(); + + /// Fills an arrow array builder with an array of this type. + static rerun::Error fill_arrow_array_builder( + arrow::BooleanBuilder* builder, const blueprint::components::AutoSpaceViews* elements, + size_t num_elements + ); + + /// Serializes an array of `rerun::blueprint:: components::AutoSpaceViews` into an arrow array. + static Result> to_arrow( + const blueprint::components::AutoSpaceViews* instances, size_t num_instances + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/entity_properties_component.cpp b/rerun_cpp/src/rerun/blueprint/components/entity_properties_component.cpp new file mode 100644 index 000000000000..dd83bf101300 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/entity_properties_component.cpp @@ -0,0 +1,71 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/entity_properties_component.fbs". + +#include "entity_properties_component.hpp" + +#include +#include + +namespace rerun::blueprint::components {} + +namespace rerun { + const std::shared_ptr& + Loggable::arrow_datatype() { + static const auto datatype = arrow::list(arrow::field("item", arrow::uint8(), false)); + return datatype; + } + + rerun::Error + Loggable::fill_arrow_array_builder( + arrow::ListBuilder* builder, + const blueprint::components::EntityPropertiesComponent* elements, size_t num_elements + ) { + if (builder == nullptr) { + return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); + } + if (elements == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Cannot serialize null pointer to arrow array." + ); + } + + auto value_builder = static_cast(builder->value_builder()); + ARROW_RETURN_NOT_OK(builder->Reserve(static_cast(num_elements))); + ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); + + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + const auto& element = elements[elem_idx]; + ARROW_RETURN_NOT_OK(builder->Append()); + ARROW_RETURN_NOT_OK(value_builder->AppendValues( + element.props.data(), + static_cast(element.props.size()), + nullptr + )); + } + + return Error::ok(); + } + + Result> + Loggable::to_arrow( + const blueprint::components::EntityPropertiesComponent* instances, size_t num_instances + ) { + // TODO(andreas): Allow configuring the memory pool. + arrow::MemoryPool* pool = arrow::default_memory_pool(); + auto datatype = arrow_datatype(); + + ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) + if (instances && num_instances > 0) { + RR_RETURN_NOT_OK(Loggable:: + fill_arrow_array_builder( + static_cast(builder.get()), + instances, + num_instances + )); + } + std::shared_ptr array; + ARROW_RETURN_NOT_OK(builder->Finish(&array)); + return array; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/entity_properties_component.hpp b/rerun_cpp/src/rerun/blueprint/components/entity_properties_component.hpp new file mode 100644 index 000000000000..66c58b6dbdb8 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/entity_properties_component.hpp @@ -0,0 +1,61 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/entity_properties_component.fbs". + +#pragma once + +#include "../../collection.hpp" +#include "../../result.hpp" + +#include +#include +#include + +namespace arrow { + class Array; + class DataType; + class ListBuilder; +} // namespace arrow + +namespace rerun::blueprint::components { + /// **Component**: The configurable set of overridable properties. + /// + /// Unstable. Used for the ongoing blueprint experimentations. + struct EntityPropertiesComponent { + rerun::Collection props; + + public: + EntityPropertiesComponent() = default; + + EntityPropertiesComponent(rerun::Collection props_) : props(std::move(props_)) {} + + EntityPropertiesComponent& operator=(rerun::Collection props_) { + props = std::move(props_); + return *this; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + template + struct Loggable; + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.blueprint.components.EntityPropertiesComponent"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype(); + + /// Fills an arrow array builder with an array of this type. + static rerun::Error fill_arrow_array_builder( + arrow::ListBuilder* builder, + const blueprint::components::EntityPropertiesComponent* elements, size_t num_elements + ); + + /// Serializes an array of `rerun::blueprint:: components::EntityPropertiesComponent` into an arrow array. + static Result> to_arrow( + const blueprint::components::EntityPropertiesComponent* instances, size_t num_instances + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/panel_view.cpp b/rerun_cpp/src/rerun/blueprint/components/panel_view.cpp new file mode 100644 index 000000000000..1446f72fe809 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/panel_view.cpp @@ -0,0 +1,60 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/panel_view.fbs". + +#include "panel_view.hpp" + +#include +#include + +namespace rerun::blueprint::components {} + +namespace rerun { + const std::shared_ptr& + Loggable::arrow_datatype() { + static const auto datatype = arrow::boolean(); + return datatype; + } + + rerun::Error Loggable::fill_arrow_array_builder( + arrow::BooleanBuilder* builder, const blueprint::components::PanelView* elements, + size_t num_elements + ) { + if (builder == nullptr) { + return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); + } + if (elements == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Cannot serialize null pointer to arrow array." + ); + } + + static_assert(sizeof(*elements) == sizeof(elements->is_expanded)); + ARROW_RETURN_NOT_OK(builder->AppendValues( + reinterpret_cast(&elements->is_expanded), + static_cast(num_elements) + )); + + return Error::ok(); + } + + Result> Loggable::to_arrow( + const blueprint::components::PanelView* instances, size_t num_instances + ) { + // TODO(andreas): Allow configuring the memory pool. + arrow::MemoryPool* pool = arrow::default_memory_pool(); + auto datatype = arrow_datatype(); + + ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) + if (instances && num_instances > 0) { + RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( + static_cast(builder.get()), + instances, + num_instances + )); + } + std::shared_ptr array; + ARROW_RETURN_NOT_OK(builder->Finish(&array)); + return array; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/panel_view.hpp b/rerun_cpp/src/rerun/blueprint/components/panel_view.hpp new file mode 100644 index 000000000000..b81ea8ea6af0 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/panel_view.hpp @@ -0,0 +1,59 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/panel_view.fbs". + +#pragma once + +#include "../../result.hpp" + +#include +#include + +namespace arrow { + class Array; + class BooleanBuilder; + class DataType; +} // namespace arrow + +namespace rerun::blueprint::components { + /// **Component**: The state of the panels. + /// + /// Unstable. Used for the ongoing blueprint experimentations. + struct PanelView { + bool is_expanded; + + public: + PanelView() = default; + + PanelView(bool is_expanded_) : is_expanded(is_expanded_) {} + + PanelView& operator=(bool is_expanded_) { + is_expanded = is_expanded_; + return *this; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + template + struct Loggable; + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.blueprint.components.PanelView"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype(); + + /// Fills an arrow array builder with an array of this type. + static rerun::Error fill_arrow_array_builder( + arrow::BooleanBuilder* builder, const blueprint::components::PanelView* elements, + size_t num_elements + ); + + /// Serializes an array of `rerun::blueprint:: components::PanelView` into an arrow array. + static Result> to_arrow( + const blueprint::components::PanelView* instances, size_t num_instances + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/query_expressions.cpp b/rerun_cpp/src/rerun/blueprint/components/query_expressions.cpp new file mode 100644 index 000000000000..53bb245dd5c6 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/query_expressions.cpp @@ -0,0 +1,62 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/query_expressions.fbs". + +#include "query_expressions.hpp" + +#include "../../blueprint/datatypes/query_expressions.hpp" + +#include +#include + +namespace rerun::blueprint::components {} + +namespace rerun { + const std::shared_ptr& + Loggable::arrow_datatype() { + static const auto datatype = + Loggable::arrow_datatype(); + return datatype; + } + + rerun::Error Loggable::fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::components::QueryExpressions* elements, + size_t num_elements + ) { + static_assert( + sizeof(rerun::blueprint::datatypes::QueryExpressions) == + sizeof(blueprint::components::QueryExpressions) + ); + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + builder, + reinterpret_cast(elements), + num_elements + ) + ); + + return Error::ok(); + } + + Result> + Loggable::to_arrow( + const blueprint::components::QueryExpressions* instances, size_t num_instances + ) { + // TODO(andreas): Allow configuring the memory pool. + arrow::MemoryPool* pool = arrow::default_memory_pool(); + auto datatype = arrow_datatype(); + + ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) + if (instances && num_instances > 0) { + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + static_cast(builder.get()), + instances, + num_instances + ) + ); + } + std::shared_ptr array; + ARROW_RETURN_NOT_OK(builder->Finish(&array)); + return array; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/query_expressions.hpp b/rerun_cpp/src/rerun/blueprint/components/query_expressions.hpp new file mode 100644 index 000000000000..97603b933127 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/query_expressions.hpp @@ -0,0 +1,67 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/query_expressions.fbs". + +#pragma once + +#include "../../blueprint/datatypes/query_expressions.hpp" +#include "../../result.hpp" + +#include +#include +#include + +namespace arrow { + class Array; + class DataType; + class StructBuilder; +} // namespace arrow + +namespace rerun::blueprint::components { + /// **Component**: A set of expressions used for a `DataQueryBlueprint`. + /// + /// Unstable. Used for the ongoing blueprint experimentations. + struct QueryExpressions { + rerun::blueprint::datatypes::QueryExpressions expressions; + + public: + QueryExpressions() = default; + + QueryExpressions(rerun::blueprint::datatypes::QueryExpressions expressions_) + : expressions(std::move(expressions_)) {} + + QueryExpressions& operator=(rerun::blueprint::datatypes::QueryExpressions expressions_) { + expressions = std::move(expressions_); + return *this; + } + + /// Cast to the underlying QueryExpressions datatype + operator rerun::blueprint::datatypes::QueryExpressions() const { + return expressions; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + template + struct Loggable; + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.blueprint.components.QueryExpressions"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype(); + + /// Fills an arrow array builder with an array of this type. + static rerun::Error fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::components::QueryExpressions* elements, + size_t num_elements + ); + + /// Serializes an array of `rerun::blueprint:: components::QueryExpressions` into an arrow array. + static Result> to_arrow( + const blueprint::components::QueryExpressions* instances, size_t num_instances + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/space_view_component.cpp b/rerun_cpp/src/rerun/blueprint/components/space_view_component.cpp new file mode 100644 index 000000000000..483306c36e9c --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/space_view_component.cpp @@ -0,0 +1,62 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/space_view_component.fbs". + +#include "space_view_component.hpp" + +#include "../../blueprint/datatypes/space_view_component.hpp" + +#include +#include + +namespace rerun::blueprint::components {} + +namespace rerun { + const std::shared_ptr& + Loggable::arrow_datatype() { + static const auto datatype = + Loggable::arrow_datatype(); + return datatype; + } + + rerun::Error Loggable::fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::components::SpaceViewComponent* elements, + size_t num_elements + ) { + static_assert( + sizeof(rerun::blueprint::datatypes::SpaceViewComponent) == + sizeof(blueprint::components::SpaceViewComponent) + ); + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + builder, + reinterpret_cast(elements), + num_elements + ) + ); + + return Error::ok(); + } + + Result> + Loggable::to_arrow( + const blueprint::components::SpaceViewComponent* instances, size_t num_instances + ) { + // TODO(andreas): Allow configuring the memory pool. + arrow::MemoryPool* pool = arrow::default_memory_pool(); + auto datatype = arrow_datatype(); + + ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) + if (instances && num_instances > 0) { + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + static_cast(builder.get()), + instances, + num_instances + ) + ); + } + std::shared_ptr array; + ARROW_RETURN_NOT_OK(builder->Finish(&array)); + return array; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/space_view_component.hpp b/rerun_cpp/src/rerun/blueprint/components/space_view_component.hpp new file mode 100644 index 000000000000..771dd35fa0f0 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/space_view_component.hpp @@ -0,0 +1,67 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/space_view_component.fbs". + +#pragma once + +#include "../../blueprint/datatypes/space_view_component.hpp" +#include "../../result.hpp" + +#include +#include +#include + +namespace arrow { + class Array; + class DataType; + class StructBuilder; +} // namespace arrow + +namespace rerun::blueprint::components { + /// **Component**: A view of a space. + /// + /// Unstable. Used for the ongoing blueprint experimentations. + struct SpaceViewComponent { + rerun::blueprint::datatypes::SpaceViewComponent component; + + public: + SpaceViewComponent() = default; + + SpaceViewComponent(rerun::blueprint::datatypes::SpaceViewComponent component_) + : component(std::move(component_)) {} + + SpaceViewComponent& operator=(rerun::blueprint::datatypes::SpaceViewComponent component_) { + component = std::move(component_); + return *this; + } + + /// Cast to the underlying SpaceViewComponent datatype + operator rerun::blueprint::datatypes::SpaceViewComponent() const { + return component; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + template + struct Loggable; + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.blueprint.components.SpaceViewComponent"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype(); + + /// Fills an arrow array builder with an array of this type. + static rerun::Error fill_arrow_array_builder( + arrow::StructBuilder* builder, + const blueprint::components::SpaceViewComponent* elements, size_t num_elements + ); + + /// Serializes an array of `rerun::blueprint:: components::SpaceViewComponent` into an arrow array. + static Result> to_arrow( + const blueprint::components::SpaceViewComponent* instances, size_t num_instances + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/space_view_maximized.cpp b/rerun_cpp/src/rerun/blueprint/components/space_view_maximized.cpp new file mode 100644 index 000000000000..cf24d51ed31e --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/space_view_maximized.cpp @@ -0,0 +1,75 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs". + +#include "space_view_maximized.hpp" + +#include +#include + +namespace rerun::blueprint::components {} + +namespace rerun { + const std::shared_ptr& + Loggable::arrow_datatype() { + static const auto datatype = arrow::list(arrow::field("item", arrow::uint8(), false)); + return datatype; + } + + rerun::Error Loggable::fill_arrow_array_builder( + arrow::ListBuilder* builder, const blueprint::components::SpaceViewMaximized* elements, + size_t num_elements + ) { + if (builder == nullptr) { + return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); + } + if (elements == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Cannot serialize null pointer to arrow array." + ); + } + + auto value_builder = static_cast(builder->value_builder()); + ARROW_RETURN_NOT_OK(builder->Reserve(static_cast(num_elements))); + ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 1))); + + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + const auto& element = elements[elem_idx]; + if (element.id.has_value()) { + ARROW_RETURN_NOT_OK(builder->Append()); + ARROW_RETURN_NOT_OK(value_builder->AppendValues( + element.id.value().data(), + static_cast(element.id.value().size()), + nullptr + )); + } else { + ARROW_RETURN_NOT_OK(builder->AppendNull()); + } + } + + return Error::ok(); + } + + Result> + Loggable::to_arrow( + const blueprint::components::SpaceViewMaximized* instances, size_t num_instances + ) { + // TODO(andreas): Allow configuring the memory pool. + arrow::MemoryPool* pool = arrow::default_memory_pool(); + auto datatype = arrow_datatype(); + + ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) + if (instances && num_instances > 0) { + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + static_cast(builder.get()), + instances, + num_instances + ) + ); + } + std::shared_ptr array; + ARROW_RETURN_NOT_OK(builder->Finish(&array)); + return array; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/space_view_maximized.hpp b/rerun_cpp/src/rerun/blueprint/components/space_view_maximized.hpp new file mode 100644 index 000000000000..c582561a10b2 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/space_view_maximized.hpp @@ -0,0 +1,62 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/space_view_maximized.fbs". + +#pragma once + +#include "../../collection.hpp" +#include "../../result.hpp" + +#include +#include +#include +#include + +namespace arrow { + class Array; + class DataType; + class ListBuilder; +} // namespace arrow + +namespace rerun::blueprint::components { + /// **Component**: Whether a space view is maximized. + /// + /// Unstable. Used for the ongoing blueprint experimentations. + struct SpaceViewMaximized { + std::optional> id; + + public: + SpaceViewMaximized() = default; + + SpaceViewMaximized(std::optional> id_) : id(std::move(id_)) {} + + SpaceViewMaximized& operator=(std::optional> id_) { + id = std::move(id_); + return *this; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + template + struct Loggable; + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.blueprint.components.SpaceViewMaximized"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype(); + + /// Fills an arrow array builder with an array of this type. + static rerun::Error fill_arrow_array_builder( + arrow::ListBuilder* builder, const blueprint::components::SpaceViewMaximized* elements, + size_t num_elements + ); + + /// Serializes an array of `rerun::blueprint:: components::SpaceViewMaximized` into an arrow array. + static Result> to_arrow( + const blueprint::components::SpaceViewMaximized* instances, size_t num_instances + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/viewport_layout.cpp b/rerun_cpp/src/rerun/blueprint/components/viewport_layout.cpp new file mode 100644 index 000000000000..3ad54169c2fb --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/viewport_layout.cpp @@ -0,0 +1,61 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs". + +#include "viewport_layout.hpp" + +#include "../../blueprint/datatypes/viewport_layout.hpp" + +#include +#include + +namespace rerun::blueprint::components {} + +namespace rerun { + const std::shared_ptr& + Loggable::arrow_datatype() { + static const auto datatype = + Loggable::arrow_datatype(); + return datatype; + } + + rerun::Error Loggable::fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::components::ViewportLayout* elements, + size_t num_elements + ) { + static_assert( + sizeof(rerun::blueprint::datatypes::ViewportLayout) == + sizeof(blueprint::components::ViewportLayout) + ); + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + builder, + reinterpret_cast(elements), + num_elements + ) + ); + + return Error::ok(); + } + + Result> Loggable::to_arrow( + const blueprint::components::ViewportLayout* instances, size_t num_instances + ) { + // TODO(andreas): Allow configuring the memory pool. + arrow::MemoryPool* pool = arrow::default_memory_pool(); + auto datatype = arrow_datatype(); + + ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) + if (instances && num_instances > 0) { + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + static_cast(builder.get()), + instances, + num_instances + ) + ); + } + std::shared_ptr array; + ARROW_RETURN_NOT_OK(builder->Finish(&array)); + return array; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/viewport_layout.hpp b/rerun_cpp/src/rerun/blueprint/components/viewport_layout.hpp new file mode 100644 index 000000000000..1f68d56351bb --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components/viewport_layout.hpp @@ -0,0 +1,67 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs". + +#pragma once + +#include "../../blueprint/datatypes/viewport_layout.hpp" +#include "../../result.hpp" + +#include +#include +#include + +namespace arrow { + class Array; + class DataType; + class StructBuilder; +} // namespace arrow + +namespace rerun::blueprint::components { + /// **Component**: A view of a space. + /// + /// Unstable. Used for the ongoing blueprint experimentations. + struct ViewportLayout { + rerun::blueprint::datatypes::ViewportLayout viewport_layout; + + public: + ViewportLayout() = default; + + ViewportLayout(rerun::blueprint::datatypes::ViewportLayout viewport_layout_) + : viewport_layout(std::move(viewport_layout_)) {} + + ViewportLayout& operator=(rerun::blueprint::datatypes::ViewportLayout viewport_layout_) { + viewport_layout = std::move(viewport_layout_); + return *this; + } + + /// Cast to the underlying ViewportLayout datatype + operator rerun::blueprint::datatypes::ViewportLayout() const { + return viewport_layout; + } + }; +} // namespace rerun::blueprint::components + +namespace rerun { + template + struct Loggable; + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.blueprint.components.ViewportLayout"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype(); + + /// Fills an arrow array builder with an array of this type. + static rerun::Error fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::components::ViewportLayout* elements, + size_t num_elements + ); + + /// Serializes an array of `rerun::blueprint:: components::ViewportLayout` into an arrow array. + static Result> to_arrow( + const blueprint::components::ViewportLayout* instances, size_t num_instances + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/.gitattributes b/rerun_cpp/src/rerun/blueprint/datatypes/.gitattributes new file mode 100644 index 000000000000..3c90f4e418f6 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/datatypes/.gitattributes @@ -0,0 +1,9 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +query_expressions.cpp linguist-generated=true +query_expressions.hpp linguist-generated=true +space_view_component.cpp linguist-generated=true +space_view_component.hpp linguist-generated=true +viewport_layout.cpp linguist-generated=true +viewport_layout.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/query_expressions.cpp b/rerun_cpp/src/rerun/blueprint/datatypes/query_expressions.cpp new file mode 100644 index 000000000000..b1aaf0ae5fe1 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/datatypes/query_expressions.cpp @@ -0,0 +1,98 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/datatypes/query_expressions.fbs". + +#include "query_expressions.hpp" + +#include +#include + +namespace rerun::blueprint::datatypes {} + +namespace rerun { + const std::shared_ptr& + Loggable::arrow_datatype() { + static const auto datatype = arrow::struct_({ + arrow::field( + "inclusions", + arrow::list(arrow::field("item", arrow::utf8(), false)), + false + ), + arrow::field( + "exclusions", + arrow::list(arrow::field("item", arrow::utf8(), false)), + false + ), + }); + return datatype; + } + + rerun::Error Loggable::fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::datatypes::QueryExpressions* elements, + size_t num_elements + ) { + if (builder == nullptr) { + return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); + } + if (elements == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Cannot serialize null pointer to arrow array." + ); + } + + { + auto field_builder = static_cast(builder->field_builder(0)); + auto value_builder = static_cast(field_builder->value_builder()); + ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); + ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); + + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + const auto& element = elements[elem_idx]; + ARROW_RETURN_NOT_OK(field_builder->Append()); + for (size_t item_idx = 0; item_idx < element.inclusions.size(); item_idx += 1) { + ARROW_RETURN_NOT_OK(value_builder->Append(element.inclusions[item_idx])); + } + } + } + { + auto field_builder = static_cast(builder->field_builder(1)); + auto value_builder = static_cast(field_builder->value_builder()); + ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); + ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); + + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + const auto& element = elements[elem_idx]; + ARROW_RETURN_NOT_OK(field_builder->Append()); + for (size_t item_idx = 0; item_idx < element.exclusions.size(); item_idx += 1) { + ARROW_RETURN_NOT_OK(value_builder->Append(element.exclusions[item_idx])); + } + } + } + ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); + + return Error::ok(); + } + + Result> + Loggable::to_arrow( + const blueprint::datatypes::QueryExpressions* instances, size_t num_instances + ) { + // TODO(andreas): Allow configuring the memory pool. + arrow::MemoryPool* pool = arrow::default_memory_pool(); + auto datatype = arrow_datatype(); + + ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) + if (instances && num_instances > 0) { + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + static_cast(builder.get()), + instances, + num_instances + ) + ); + } + std::shared_ptr array; + ARROW_RETURN_NOT_OK(builder->Finish(&array)); + return array; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/query_expressions.hpp b/rerun_cpp/src/rerun/blueprint/datatypes/query_expressions.hpp new file mode 100644 index 000000000000..46730ff02ef6 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/datatypes/query_expressions.hpp @@ -0,0 +1,58 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/datatypes/query_expressions.fbs". + +#pragma once + +#include "../../collection.hpp" +#include "../../result.hpp" + +#include +#include +#include + +namespace arrow { + class Array; + class DataType; + class StructBuilder; +} // namespace arrow + +namespace rerun::blueprint::datatypes { + /// **Datatype**: A set of expressions used for a `DataQueryBlueprint`. + /// + /// Unstable. Used for the ongoing blueprint experimentations. + struct QueryExpressions { + /// A set of strings representing `EntityPathExpression`s to be included. + rerun::Collection inclusions; + + /// A set of strings representing `EntityPathExpression`s to be excluded. + rerun::Collection exclusions; + + public: + QueryExpressions() = default; + }; +} // namespace rerun::blueprint::datatypes + +namespace rerun { + template + struct Loggable; + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.blueprint.datatypes.QueryExpressions"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype(); + + /// Fills an arrow array builder with an array of this type. + static rerun::Error fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::datatypes::QueryExpressions* elements, + size_t num_elements + ); + + /// Serializes an array of `rerun::blueprint:: datatypes::QueryExpressions` into an arrow array. + static Result> to_arrow( + const blueprint::datatypes::QueryExpressions* instances, size_t num_instances + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/space_view_component.cpp b/rerun_cpp/src/rerun/blueprint/datatypes/space_view_component.cpp new file mode 100644 index 000000000000..5541d85d992c --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/datatypes/space_view_component.cpp @@ -0,0 +1,130 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/datatypes/space_view_component.fbs". + +#include "space_view_component.hpp" + +#include "../../datatypes/entity_path.hpp" +#include "../../datatypes/uuid.hpp" + +#include +#include + +namespace rerun::blueprint::datatypes {} + +namespace rerun { + const std::shared_ptr& + Loggable::arrow_datatype() { + static const auto datatype = arrow::struct_({ + arrow::field("display_name", arrow::utf8(), false), + arrow::field("class_identifier", arrow::utf8(), false), + arrow::field( + "space_origin", + Loggable::arrow_datatype(), + false + ), + arrow::field("entities_determined_by_user", arrow::boolean(), false), + arrow::field( + "contents", + arrow::list( + arrow::field("item", Loggable::arrow_datatype(), false) + ), + false + ), + }); + return datatype; + } + + rerun::Error Loggable::fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::datatypes::SpaceViewComponent* elements, + size_t num_elements + ) { + if (builder == nullptr) { + return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); + } + if (elements == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Cannot serialize null pointer to arrow array." + ); + } + + { + auto field_builder = static_cast(builder->field_builder(0)); + ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + ARROW_RETURN_NOT_OK(field_builder->Append(elements[elem_idx].display_name)); + } + } + { + auto field_builder = static_cast(builder->field_builder(1)); + ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + ARROW_RETURN_NOT_OK(field_builder->Append(elements[elem_idx].class_identifier)); + } + } + { + auto field_builder = static_cast(builder->field_builder(2)); + ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( + field_builder, + &elements[elem_idx].space_origin, + 1 + )); + } + } + { + auto field_builder = static_cast(builder->field_builder(3)); + ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + ARROW_RETURN_NOT_OK( + field_builder->Append(elements[elem_idx].entities_determined_by_user) + ); + } + } + { + auto field_builder = static_cast(builder->field_builder(4)); + auto value_builder = static_cast(field_builder->value_builder()); + ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); + ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); + + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + const auto& element = elements[elem_idx]; + ARROW_RETURN_NOT_OK(field_builder->Append()); + if (element.contents.data()) { + RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( + value_builder, + element.contents.data(), + element.contents.size() + )); + } + } + } + ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); + + return Error::ok(); + } + + Result> + Loggable::to_arrow( + const blueprint::datatypes::SpaceViewComponent* instances, size_t num_instances + ) { + // TODO(andreas): Allow configuring the memory pool. + arrow::MemoryPool* pool = arrow::default_memory_pool(); + auto datatype = arrow_datatype(); + + ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) + if (instances && num_instances > 0) { + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + static_cast(builder.get()), + instances, + num_instances + ) + ); + } + std::shared_ptr array; + ARROW_RETURN_NOT_OK(builder->Finish(&array)); + return array; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/space_view_component.hpp b/rerun_cpp/src/rerun/blueprint/datatypes/space_view_component.hpp new file mode 100644 index 000000000000..c0281832126b --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/datatypes/space_view_component.hpp @@ -0,0 +1,75 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/datatypes/space_view_component.fbs". + +#pragma once + +#include "../../collection.hpp" +#include "../../datatypes/entity_path.hpp" +#include "../../datatypes/uuid.hpp" +#include "../../result.hpp" + +#include +#include +#include + +namespace arrow { + class Array; + class DataType; + class StructBuilder; +} // namespace arrow + +namespace rerun::blueprint::datatypes { + /// **Datatype**: A view of a space. + /// + /// Unstable. Used for the ongoing blueprint experimentations. + struct SpaceViewComponent { + /// The name of the view. + std::string display_name; + + /// The class of the view. + std::string class_identifier; + + /// 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. + rerun::datatypes::EntityPath space_origin; + + /// True if the user is expected to add entities themselves. False otherwise. + bool entities_determined_by_user; + + /// `BlueprintId`s of the `DataQuery`s that make up this `SpaceView`. + /// + /// It determines which entities are part of the spaceview. + rerun::Collection contents; + + public: + SpaceViewComponent() = default; + }; +} // namespace rerun::blueprint::datatypes + +namespace rerun { + template + struct Loggable; + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.blueprint.datatypes.SpaceViewComponent"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype(); + + /// Fills an arrow array builder with an array of this type. + static rerun::Error fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::datatypes::SpaceViewComponent* elements, + size_t num_elements + ); + + /// Serializes an array of `rerun::blueprint:: datatypes::SpaceViewComponent` into an arrow array. + static Result> to_arrow( + const blueprint::datatypes::SpaceViewComponent* instances, size_t num_instances + ); + }; +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/viewport_layout.cpp b/rerun_cpp/src/rerun/blueprint/datatypes/viewport_layout.cpp new file mode 100644 index 000000000000..e90ff5be83dd --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/datatypes/viewport_layout.cpp @@ -0,0 +1,105 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/datatypes/viewport_layout.fbs". + +#include "viewport_layout.hpp" + +#include +#include + +namespace rerun::blueprint::datatypes {} + +namespace rerun { + const std::shared_ptr& + Loggable::arrow_datatype() { + static const auto datatype = arrow::struct_({ + arrow::field( + "space_view_keys", + arrow::list(arrow::field("item", arrow::uint8(), false)), + false + ), + arrow::field("tree", arrow::list(arrow::field("item", arrow::uint8(), false)), false), + arrow::field("auto_layout", arrow::boolean(), false), + }); + return datatype; + } + + rerun::Error Loggable::fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::datatypes::ViewportLayout* elements, + size_t num_elements + ) { + if (builder == nullptr) { + return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); + } + if (elements == nullptr) { + return rerun::Error( + ErrorCode::UnexpectedNullArgument, + "Cannot serialize null pointer to arrow array." + ); + } + + { + auto field_builder = static_cast(builder->field_builder(0)); + auto value_builder = static_cast(field_builder->value_builder()); + ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); + ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); + + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + const auto& element = elements[elem_idx]; + ARROW_RETURN_NOT_OK(field_builder->Append()); + ARROW_RETURN_NOT_OK(value_builder->AppendValues( + element.space_view_keys.data(), + static_cast(element.space_view_keys.size()), + nullptr + )); + } + } + { + auto field_builder = static_cast(builder->field_builder(1)); + auto value_builder = static_cast(field_builder->value_builder()); + ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); + ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); + + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + const auto& element = elements[elem_idx]; + ARROW_RETURN_NOT_OK(field_builder->Append()); + ARROW_RETURN_NOT_OK(value_builder->AppendValues( + element.tree.data(), + static_cast(element.tree.size()), + nullptr + )); + } + } + { + auto field_builder = static_cast(builder->field_builder(2)); + ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); + for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { + ARROW_RETURN_NOT_OK(field_builder->Append(elements[elem_idx].auto_layout)); + } + } + ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); + + return Error::ok(); + } + + Result> Loggable::to_arrow( + const blueprint::datatypes::ViewportLayout* instances, size_t num_instances + ) { + // TODO(andreas): Allow configuring the memory pool. + arrow::MemoryPool* pool = arrow::default_memory_pool(); + auto datatype = arrow_datatype(); + + ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) + if (instances && num_instances > 0) { + RR_RETURN_NOT_OK( + Loggable::fill_arrow_array_builder( + static_cast(builder.get()), + instances, + num_instances + ) + ); + } + std::shared_ptr array; + ARROW_RETURN_NOT_OK(builder->Finish(&array)); + return array; + } +} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/viewport_layout.hpp b/rerun_cpp/src/rerun/blueprint/datatypes/viewport_layout.hpp new file mode 100644 index 000000000000..6b2cc99849be --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/datatypes/viewport_layout.hpp @@ -0,0 +1,60 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs +// Based on "crates/re_types/definitions/rerun/blueprint/datatypes/viewport_layout.fbs". + +#pragma once + +#include "../../collection.hpp" +#include "../../result.hpp" + +#include +#include + +namespace arrow { + class Array; + class DataType; + class StructBuilder; +} // namespace arrow + +namespace rerun::blueprint::datatypes { + /// **Datatype**: A view of a space. + /// + /// Unstable. Used for the ongoing blueprint experimentations. + struct ViewportLayout { + /// space_view_keys + rerun::Collection space_view_keys; + + /// tree + rerun::Collection tree; + + /// auto_layout + bool auto_layout; + + public: + ViewportLayout() = default; + }; +} // namespace rerun::blueprint::datatypes + +namespace rerun { + template + struct Loggable; + + /// \private + template <> + struct Loggable { + static constexpr const char Name[] = "rerun.blueprint.datatypes.ViewportLayout"; + + /// Returns the arrow data type this type corresponds to. + static const std::shared_ptr& arrow_datatype(); + + /// Fills an arrow array builder with an array of this type. + static rerun::Error fill_arrow_array_builder( + arrow::StructBuilder* builder, const blueprint::datatypes::ViewportLayout* elements, + size_t num_elements + ); + + /// Serializes an array of `rerun::blueprint:: datatypes::ViewportLayout` into an arrow array. + static Result> to_arrow( + const blueprint::datatypes::ViewportLayout* instances, size_t num_instances + ); + }; +} // namespace rerun diff --git a/rerun_cpp/tests/generated/.gitattributes b/rerun_cpp/tests/generated/.gitattributes index 967d56cb0784..435e1f8fe40d 100644 --- a/rerun_cpp/tests/generated/.gitattributes +++ b/rerun_cpp/tests/generated/.gitattributes @@ -2,6 +2,5 @@ .gitattributes linguist-generated=true archetypes.hpp linguist-generated=true -blueprint.hpp linguist-generated=true components.hpp linguist-generated=true datatypes.hpp linguist-generated=true diff --git a/rerun_cpp/tests/generated/blueprint/blueprint/.gitattributes b/rerun_cpp/tests/generated/blueprint/blueprint/.gitattributes new file mode 100644 index 000000000000..435e1f8fe40d --- /dev/null +++ b/rerun_cpp/tests/generated/blueprint/blueprint/.gitattributes @@ -0,0 +1,6 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +archetypes.hpp linguist-generated=true +components.hpp linguist-generated=true +datatypes.hpp linguist-generated=true diff --git a/rerun_cpp/tests/generated/blueprint/blueprint/archetypes.hpp b/rerun_cpp/tests/generated/blueprint/blueprint/archetypes.hpp new file mode 100644 index 000000000000..dcdf9bcbede6 --- /dev/null +++ b/rerun_cpp/tests/generated/blueprint/blueprint/archetypes.hpp @@ -0,0 +1,3 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs + +#pragma once diff --git a/rerun_cpp/tests/generated/blueprint/blueprint/components.hpp b/rerun_cpp/tests/generated/blueprint/blueprint/components.hpp new file mode 100644 index 000000000000..dcdf9bcbede6 --- /dev/null +++ b/rerun_cpp/tests/generated/blueprint/blueprint/components.hpp @@ -0,0 +1,3 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs + +#pragma once diff --git a/rerun_cpp/tests/generated/blueprint/blueprint/datatypes.hpp b/rerun_cpp/tests/generated/blueprint/blueprint/datatypes.hpp new file mode 100644 index 000000000000..dcdf9bcbede6 --- /dev/null +++ b/rerun_cpp/tests/generated/blueprint/blueprint/datatypes.hpp @@ -0,0 +1,3 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs + +#pragma once diff --git a/rerun_py/rerun_sdk/rerun/blueprint/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/__init__.py deleted file mode 100644 index 35385d330e2f..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/__init__.py +++ /dev/null @@ -1,85 +0,0 @@ -# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs - -from __future__ import annotations - -from .auto_space_views import ( - AutoSpaceViews, - AutoSpaceViewsArrayLike, - AutoSpaceViewsBatch, - AutoSpaceViewsLike, - AutoSpaceViewsType, -) -from .entity_properties_component import ( - EntityPropertiesComponent, - EntityPropertiesComponentArrayLike, - EntityPropertiesComponentBatch, - EntityPropertiesComponentLike, - EntityPropertiesComponentType, -) -from .panel_view import PanelView, PanelViewArrayLike, PanelViewBatch, PanelViewLike, PanelViewType -from .query_expressions import ( - QueryExpressions, - QueryExpressionsArrayLike, - QueryExpressionsBatch, - QueryExpressionsLike, - QueryExpressionsType, -) -from .space_view_component import ( - SpaceViewComponent, - SpaceViewComponentArrayLike, - SpaceViewComponentBatch, - SpaceViewComponentLike, - SpaceViewComponentType, -) -from .space_view_maximized import ( - SpaceViewMaximized, - SpaceViewMaximizedArrayLike, - SpaceViewMaximizedBatch, - SpaceViewMaximizedLike, - SpaceViewMaximizedType, -) -from .viewport_layout import ( - ViewportLayout, - ViewportLayoutArrayLike, - ViewportLayoutBatch, - ViewportLayoutLike, - ViewportLayoutType, -) - -__all__ = [ - "AutoSpaceViews", - "AutoSpaceViewsArrayLike", - "AutoSpaceViewsBatch", - "AutoSpaceViewsLike", - "AutoSpaceViewsType", - "EntityPropertiesComponent", - "EntityPropertiesComponentArrayLike", - "EntityPropertiesComponentBatch", - "EntityPropertiesComponentLike", - "EntityPropertiesComponentType", - "PanelView", - "PanelViewArrayLike", - "PanelViewBatch", - "PanelViewLike", - "PanelViewType", - "QueryExpressions", - "QueryExpressionsArrayLike", - "QueryExpressionsBatch", - "QueryExpressionsLike", - "QueryExpressionsType", - "SpaceViewComponent", - "SpaceViewComponentArrayLike", - "SpaceViewComponentBatch", - "SpaceViewComponentLike", - "SpaceViewComponentType", - "SpaceViewMaximized", - "SpaceViewMaximizedArrayLike", - "SpaceViewMaximizedBatch", - "SpaceViewMaximizedLike", - "SpaceViewMaximizedType", - "ViewportLayout", - "ViewportLayoutArrayLike", - "ViewportLayoutBatch", - "ViewportLayoutLike", - "ViewportLayoutType", -] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes new file mode 100644 index 000000000000..988541d69fd9 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes @@ -0,0 +1,11 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +__init__.py linguist-generated=true +auto_space_views.py linguist-generated=true +entity_properties_component.py linguist-generated=true +panel_view.py linguist-generated=true +query_expressions.py linguist-generated=true +space_view_component.py linguist-generated=true +space_view_maximized.py linguist-generated=true +viewport_layout.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 new file mode 100644 index 000000000000..b848838d60eb --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py @@ -0,0 +1,3 @@ +# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs + +from __future__ import annotations diff --git a/rerun_py/rerun_sdk/rerun/blueprint/auto_space_views.py b/rerun_py/rerun_sdk/rerun/blueprint/components/auto_space_views.py similarity index 57% rename from rerun_py/rerun_sdk/rerun/blueprint/auto_space_views.py rename to rerun_py/rerun_sdk/rerun/blueprint/components/auto_space_views.py index c2529872ce8b..e121f8ffe91e 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/auto_space_views.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/auto_space_views.py @@ -1,5 +1,5 @@ # DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs -# Based on "crates/re_types/definitions/rerun/blueprint/auto_space_views.fbs". +# Based on "crates/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". @@ -7,9 +7,10 @@ from typing import Any, Sequence, Union +import pyarrow as pa from attrs import define, field -from .._baseclasses import BaseBatch, BaseExtensionType +from .._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin __all__ = [ "AutoSpaceViews", @@ -23,13 +24,13 @@ @define(init=False) class AutoSpaceViews: """ - **Blueprint**: A flag indicating space views should be automatically populated. + **Component**: A flag indicating space views should be automatically populated. Unstable. Used for the ongoing blueprint experimentations. """ def __init__(self: Any, enabled: AutoSpaceViewsLike): - """Create a new instance of the AutoSpaceViews blueprint.""" + """Create a new instance of the AutoSpaceViews component.""" # You can define your own __init__ function as a member of AutoSpaceViewsExt in auto_space_views_ext.py self.__attrs_init__(enabled=enabled) @@ -45,8 +46,15 @@ def __init__(self: Any, enabled: AutoSpaceViewsLike): class AutoSpaceViewsType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.AutoSpaceViews" + _TYPE_NAME: str = "rerun.blueprint.components.AutoSpaceViews" + def __init__(self) -> None: + pa.ExtensionType.__init__(self, pa.bool_(), self._TYPE_NAME) -class AutoSpaceViewsBatch(BaseBatch[AutoSpaceViewsArrayLike]): + +class AutoSpaceViewsBatch(BaseBatch[AutoSpaceViewsArrayLike], ComponentBatchMixin): _ARROW_TYPE = AutoSpaceViewsType() + + @staticmethod + def _native_to_pa_array(data: AutoSpaceViewsArrayLike, data_type: pa.DataType) -> pa.Array: + raise NotImplementedError # You need to implement native_to_pa_array_override in auto_space_views_ext.py diff --git a/rerun_py/rerun_sdk/rerun/blueprint/entity_properties_component.py b/rerun_py/rerun_sdk/rerun/blueprint/components/entity_properties_component.py similarity index 67% rename from rerun_py/rerun_sdk/rerun/blueprint/entity_properties_component.py rename to rerun_py/rerun_sdk/rerun/blueprint/components/entity_properties_component.py index b8e1a5284f30..6ca80c0f3219 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/entity_properties_component.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/entity_properties_component.py @@ -1,5 +1,5 @@ # DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs -# Based on "crates/re_types/definitions/rerun/blueprint/entity_properties_component.fbs". +# Based on "crates/re_types/definitions/rerun/blueprint/components/entity_properties_component.fbs". # You can extend this class by creating a "EntityPropertiesComponentExt" class in "entity_properties_component_ext.py". @@ -9,9 +9,10 @@ import numpy as np import numpy.typing as npt +import pyarrow as pa from attrs import define, field -from .._baseclasses import BaseBatch, BaseExtensionType +from .._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin from .._converters import ( to_np_uint8, ) @@ -28,13 +29,13 @@ @define(init=False) class EntityPropertiesComponent: """ - **Blueprint**: The configurable set of overridable properties. + **Component**: The configurable set of overridable properties. Unstable. Used for the ongoing blueprint experimentations. """ def __init__(self: Any, props: EntityPropertiesComponentLike): - """Create a new instance of the EntityPropertiesComponent blueprint.""" + """Create a new instance of the EntityPropertiesComponent component.""" # You can define your own __init__ function as a member of EntityPropertiesComponentExt in entity_properties_component_ext.py self.__attrs_init__(props=props) @@ -54,8 +55,17 @@ def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: class EntityPropertiesComponentType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.EntityPropertiesComponent" + _TYPE_NAME: str = "rerun.blueprint.components.EntityPropertiesComponent" + def __init__(self) -> None: + pa.ExtensionType.__init__( + self, pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), self._TYPE_NAME + ) -class EntityPropertiesComponentBatch(BaseBatch[EntityPropertiesComponentArrayLike]): + +class EntityPropertiesComponentBatch(BaseBatch[EntityPropertiesComponentArrayLike], ComponentBatchMixin): _ARROW_TYPE = EntityPropertiesComponentType() + + @staticmethod + def _native_to_pa_array(data: EntityPropertiesComponentArrayLike, data_type: pa.DataType) -> pa.Array: + raise NotImplementedError # You need to implement native_to_pa_array_override in entity_properties_component_ext.py diff --git a/rerun_py/rerun_sdk/rerun/blueprint/panel_view.py b/rerun_py/rerun_sdk/rerun/blueprint/components/panel_view.py similarity index 56% rename from rerun_py/rerun_sdk/rerun/blueprint/panel_view.py rename to rerun_py/rerun_sdk/rerun/blueprint/components/panel_view.py index efaed31438d7..49cc35d03463 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/panel_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/panel_view.py @@ -1,5 +1,5 @@ # DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs -# Based on "crates/re_types/definitions/rerun/blueprint/panel_view.fbs". +# Based on "crates/re_types/definitions/rerun/blueprint/components/panel_view.fbs". # You can extend this class by creating a "PanelViewExt" class in "panel_view_ext.py". @@ -7,9 +7,10 @@ from typing import Any, Sequence, Union +import pyarrow as pa from attrs import define, field -from .._baseclasses import BaseBatch, BaseExtensionType +from .._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin __all__ = ["PanelView", "PanelViewArrayLike", "PanelViewBatch", "PanelViewLike", "PanelViewType"] @@ -17,13 +18,13 @@ @define(init=False) class PanelView: """ - **Blueprint**: The state of the panels. + **Component**: The state of the panels. Unstable. Used for the ongoing blueprint experimentations. """ def __init__(self: Any, is_expanded: PanelViewLike): - """Create a new instance of the PanelView blueprint.""" + """Create a new instance of the PanelView component.""" # You can define your own __init__ function as a member of PanelViewExt in panel_view_ext.py self.__attrs_init__(is_expanded=is_expanded) @@ -39,8 +40,15 @@ def __init__(self: Any, is_expanded: PanelViewLike): class PanelViewType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.PanelView" + _TYPE_NAME: str = "rerun.blueprint.components.PanelView" + def __init__(self) -> None: + pa.ExtensionType.__init__(self, pa.bool_(), self._TYPE_NAME) -class PanelViewBatch(BaseBatch[PanelViewArrayLike]): + +class PanelViewBatch(BaseBatch[PanelViewArrayLike], ComponentBatchMixin): _ARROW_TYPE = PanelViewType() + + @staticmethod + def _native_to_pa_array(data: PanelViewArrayLike, data_type: pa.DataType) -> pa.Array: + raise NotImplementedError # You need to implement native_to_pa_array_override in panel_view_ext.py diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/query_expressions.py b/rerun_py/rerun_sdk/rerun/blueprint/components/query_expressions.py new file mode 100644 index 000000000000..280a97a26b20 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/query_expressions.py @@ -0,0 +1,32 @@ +# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs +# Based on "crates/re_types/definitions/rerun/blueprint/components/query_expressions.fbs". + +# You can extend this class by creating a "QueryExpressionsExt" class in "query_expressions_ext.py". + +from __future__ import annotations + +from .. import datatypes +from .._baseclasses import ComponentBatchMixin + +__all__ = ["QueryExpressions", "QueryExpressionsBatch", "QueryExpressionsType"] + + +class QueryExpressions(datatypes.QueryExpressions): + """ + **Component**: A set of expressions used for a `DataQueryBlueprint`. + + Unstable. Used for the ongoing blueprint experimentations. + """ + + # You can define your own __init__ function as a member of QueryExpressionsExt in query_expressions_ext.py + + # Note: there are no fields here because QueryExpressions delegates to datatypes.QueryExpressions + pass + + +class QueryExpressionsType(datatypes.QueryExpressionsType): + _TYPE_NAME: str = "rerun.blueprint.components.QueryExpressions" + + +class QueryExpressionsBatch(datatypes.QueryExpressionsBatch, ComponentBatchMixin): + _ARROW_TYPE = QueryExpressionsType() diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_component.py b/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_component.py new file mode 100644 index 000000000000..55804f86849e --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_component.py @@ -0,0 +1,32 @@ +# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs +# Based on "crates/re_types/definitions/rerun/blueprint/components/space_view_component.fbs". + +# You can extend this class by creating a "SpaceViewComponentExt" class in "space_view_component_ext.py". + +from __future__ import annotations + +from .. import datatypes +from .._baseclasses import ComponentBatchMixin + +__all__ = ["SpaceViewComponent", "SpaceViewComponentBatch", "SpaceViewComponentType"] + + +class SpaceViewComponent(datatypes.SpaceViewComponent): + """ + **Component**: A view of a space. + + Unstable. Used for the ongoing blueprint experimentations. + """ + + # You can define your own __init__ function as a member of SpaceViewComponentExt in space_view_component_ext.py + + # Note: there are no fields here because SpaceViewComponent delegates to datatypes.SpaceViewComponent + pass + + +class SpaceViewComponentType(datatypes.SpaceViewComponentType): + _TYPE_NAME: str = "rerun.blueprint.components.SpaceViewComponent" + + +class SpaceViewComponentBatch(datatypes.SpaceViewComponentBatch, ComponentBatchMixin): + _ARROW_TYPE = SpaceViewComponentType() diff --git a/rerun_py/rerun_sdk/rerun/blueprint/space_view_maximized.py b/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_maximized.py similarity index 65% rename from rerun_py/rerun_sdk/rerun/blueprint/space_view_maximized.py rename to rerun_py/rerun_sdk/rerun/blueprint/components/space_view_maximized.py index 9c37ae078c58..27c040d7b09f 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/space_view_maximized.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_maximized.py @@ -1,5 +1,5 @@ # DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs -# Based on "crates/re_types/definitions/rerun/blueprint/space_view_maximized.fbs". +# Based on "crates/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". @@ -9,9 +9,10 @@ import numpy as np import numpy.typing as npt +import pyarrow as pa from attrs import define, field -from .._baseclasses import BaseBatch, BaseExtensionType +from .._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin from .._converters import ( to_np_uint8, ) @@ -28,13 +29,13 @@ @define(init=False) class SpaceViewMaximized: """ - **Blueprint**: Whether a space view is maximized. + **Component**: Whether a space view is maximized. Unstable. Used for the ongoing blueprint experimentations. """ def __init__(self: Any, id: npt.ArrayLike | None = None): - """Create a new instance of the SpaceViewMaximized blueprint.""" + """Create a new instance of the SpaceViewMaximized component.""" # You can define your own __init__ function as a member of SpaceViewMaximizedExt in space_view_maximized_ext.py self.__attrs_init__(id=id) @@ -54,8 +55,17 @@ def __array__(self, dtype: npt.DTypeLike = None) -> npt.NDArray[Any]: class SpaceViewMaximizedType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.SpaceViewMaximized" + _TYPE_NAME: str = "rerun.blueprint.components.SpaceViewMaximized" + def __init__(self) -> None: + pa.ExtensionType.__init__( + self, pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), self._TYPE_NAME + ) -class SpaceViewMaximizedBatch(BaseBatch[SpaceViewMaximizedArrayLike]): + +class SpaceViewMaximizedBatch(BaseBatch[SpaceViewMaximizedArrayLike], ComponentBatchMixin): _ARROW_TYPE = SpaceViewMaximizedType() + + @staticmethod + def _native_to_pa_array(data: SpaceViewMaximizedArrayLike, data_type: pa.DataType) -> pa.Array: + raise NotImplementedError # You need to implement native_to_pa_array_override in space_view_maximized_ext.py diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/viewport_layout.py b/rerun_py/rerun_sdk/rerun/blueprint/components/viewport_layout.py new file mode 100644 index 000000000000..608e7ebb897a --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/viewport_layout.py @@ -0,0 +1,32 @@ +# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs +# Based on "crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs". + +# You can extend this class by creating a "ViewportLayoutExt" class in "viewport_layout_ext.py". + +from __future__ import annotations + +from .. import datatypes +from .._baseclasses import ComponentBatchMixin + +__all__ = ["ViewportLayout", "ViewportLayoutBatch", "ViewportLayoutType"] + + +class ViewportLayout(datatypes.ViewportLayout): + """ + **Component**: A view of a space. + + Unstable. Used for the ongoing blueprint experimentations. + """ + + # You can define your own __init__ function as a member of ViewportLayoutExt in viewport_layout_ext.py + + # Note: there are no fields here because ViewportLayout delegates to datatypes.ViewportLayout + pass + + +class ViewportLayoutType(datatypes.ViewportLayoutType): + _TYPE_NAME: str = "rerun.blueprint.components.ViewportLayout" + + +class ViewportLayoutBatch(datatypes.ViewportLayoutBatch, ComponentBatchMixin): + _ARROW_TYPE = ViewportLayoutType() diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/.gitattributes new file mode 100644 index 000000000000..1f884b592f14 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/.gitattributes @@ -0,0 +1,7 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +__init__.py linguist-generated=true +query_expressions.py linguist-generated=true +space_view_component.py linguist-generated=true +viewport_layout.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py new file mode 100644 index 000000000000..b848838d60eb --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py @@ -0,0 +1,3 @@ +# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs + +from __future__ import annotations diff --git a/rerun_py/rerun_sdk/rerun/blueprint/query_expressions.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/query_expressions.py similarity index 59% rename from rerun_py/rerun_sdk/rerun/blueprint/query_expressions.py rename to rerun_py/rerun_sdk/rerun/blueprint/datatypes/query_expressions.py index 24f26b07e5cc..580d2331fb89 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/query_expressions.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/query_expressions.py @@ -1,5 +1,5 @@ # DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs -# Based on "crates/re_types/definitions/rerun/blueprint/query_expressions.fbs". +# Based on "crates/re_types/definitions/rerun/blueprint/datatypes/query_expressions.fbs". # You can extend this class by creating a "QueryExpressionsExt" class in "query_expressions_ext.py". @@ -7,6 +7,7 @@ from typing import Any, Sequence, Union +import pyarrow as pa from attrs import define, field from .._baseclasses import BaseBatch, BaseExtensionType @@ -23,14 +24,14 @@ @define(init=False) class QueryExpressions: """ - **Blueprint**: A set of expressions used for a `DataQueryBlueprint`. + **Datatype**: A set of expressions used for a `DataQueryBlueprint`. Unstable. Used for the ongoing blueprint experimentations. """ def __init__(self: Any, inclusions: list[str], exclusions: list[str]): """ - Create a new instance of the QueryExpressions blueprint. + Create a new instance of the QueryExpressions datatype. Parameters ---------- @@ -62,8 +63,34 @@ def __init__(self: Any, inclusions: list[str], exclusions: list[str]): class QueryExpressionsType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.QueryExpressions" + _TYPE_NAME: str = "rerun.blueprint.datatypes.QueryExpressions" + + def __init__(self) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field( + "inclusions", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "exclusions", + pa.list_(pa.field("item", pa.utf8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + ] + ), + self._TYPE_NAME, + ) class QueryExpressionsBatch(BaseBatch[QueryExpressionsArrayLike]): _ARROW_TYPE = QueryExpressionsType() + + @staticmethod + def _native_to_pa_array(data: QueryExpressionsArrayLike, data_type: pa.DataType) -> pa.Array: + raise NotImplementedError # You need to implement native_to_pa_array_override in query_expressions_ext.py diff --git a/rerun_py/rerun_sdk/rerun/blueprint/space_view_component.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/space_view_component.py similarity index 66% rename from rerun_py/rerun_sdk/rerun/blueprint/space_view_component.py rename to rerun_py/rerun_sdk/rerun/blueprint/datatypes/space_view_component.py index 8a22e2598126..1d46c92e6647 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/space_view_component.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/space_view_component.py @@ -1,5 +1,5 @@ # DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs -# Based on "crates/re_types/definitions/rerun/blueprint/space_view_component.fbs". +# Based on "crates/re_types/definitions/rerun/blueprint/datatypes/space_view_component.fbs". # You can extend this class by creating a "SpaceViewComponentExt" class in "space_view_component_ext.py". @@ -7,9 +7,10 @@ from typing import Any, Sequence, Union +import pyarrow as pa from attrs import define, field -from .. import datatypes +from ... import datatypes from .._baseclasses import BaseBatch, BaseExtensionType __all__ = [ @@ -33,7 +34,7 @@ def _space_view_component__space_origin__special_field_converter_override( @define(init=False) class SpaceViewComponent: """ - **Blueprint**: A view of a space. + **Datatype**: A view of a space. Unstable. Used for the ongoing blueprint experimentations. """ @@ -47,7 +48,7 @@ def __init__( contents: datatypes.UuidArrayLike, ): """ - Create a new instance of the SpaceViewComponent blueprint. + Create a new instance of the SpaceViewComponent datatype. Parameters ---------- @@ -120,8 +121,48 @@ def __init__( class SpaceViewComponentType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.SpaceViewComponent" + _TYPE_NAME: str = "rerun.blueprint.datatypes.SpaceViewComponent" + + def __init__(self) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field("display_name", pa.utf8(), nullable=False, metadata={}), + pa.field("class_identifier", pa.utf8(), nullable=False, metadata={}), + pa.field("space_origin", pa.utf8(), nullable=False, metadata={}), + pa.field("entities_determined_by_user", pa.bool_(), nullable=False, metadata={}), + pa.field( + "contents", + pa.list_( + pa.field( + "item", + pa.struct( + [ + pa.field( + "bytes", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={}), 16), + nullable=False, + metadata={}, + ) + ] + ), + nullable=False, + metadata={}, + ) + ), + nullable=False, + metadata={}, + ), + ] + ), + self._TYPE_NAME, + ) class SpaceViewComponentBatch(BaseBatch[SpaceViewComponentArrayLike]): _ARROW_TYPE = SpaceViewComponentType() + + @staticmethod + def _native_to_pa_array(data: SpaceViewComponentArrayLike, data_type: pa.DataType) -> pa.Array: + raise NotImplementedError # You need to implement native_to_pa_array_override in space_view_component_ext.py diff --git a/rerun_py/rerun_sdk/rerun/blueprint/viewport_layout.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/viewport_layout.py similarity index 60% rename from rerun_py/rerun_sdk/rerun/blueprint/viewport_layout.py rename to rerun_py/rerun_sdk/rerun/blueprint/datatypes/viewport_layout.py index 1318326d6dde..c82a0e155b8b 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/viewport_layout.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/viewport_layout.py @@ -1,5 +1,5 @@ # DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs -# Based on "crates/re_types/definitions/rerun/blueprint/viewport_layout.fbs". +# Based on "crates/re_types/definitions/rerun/blueprint/datatypes/viewport_layout.fbs". # You can extend this class by creating a "ViewportLayoutExt" class in "viewport_layout_ext.py". @@ -9,6 +9,7 @@ import numpy as np import numpy.typing as npt +import pyarrow as pa from attrs import define, field from .._baseclasses import BaseBatch, BaseExtensionType @@ -28,14 +29,14 @@ @define(init=False) class ViewportLayout: """ - **Blueprint**: A view of a space. + **Datatype**: A view of a space. Unstable. Used for the ongoing blueprint experimentations. """ def __init__(self: Any, space_view_keys: npt.ArrayLike, tree: npt.ArrayLike, auto_layout: bool): """ - Create a new instance of the ViewportLayout blueprint. + Create a new instance of the ViewportLayout datatype. Parameters ---------- @@ -74,8 +75,35 @@ def __init__(self: Any, space_view_keys: npt.ArrayLike, tree: npt.ArrayLike, aut class ViewportLayoutType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.ViewportLayout" + _TYPE_NAME: str = "rerun.blueprint.datatypes.ViewportLayout" + + def __init__(self) -> None: + pa.ExtensionType.__init__( + self, + pa.struct( + [ + pa.field( + "space_view_keys", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field( + "tree", + pa.list_(pa.field("item", pa.uint8(), nullable=False, metadata={})), + nullable=False, + metadata={}, + ), + pa.field("auto_layout", pa.bool_(), nullable=False, metadata={}), + ] + ), + self._TYPE_NAME, + ) class ViewportLayoutBatch(BaseBatch[ViewportLayoutArrayLike]): _ARROW_TYPE = ViewportLayoutType() + + @staticmethod + def _native_to_pa_array(data: ViewportLayoutArrayLike, data_type: pa.DataType) -> pa.Array: + raise NotImplementedError # You need to implement native_to_pa_array_override in viewport_layout_ext.py diff --git a/rerun_py/rerun_sdk/rerun/components/__init__.py b/rerun_py/rerun_sdk/rerun/components/__init__.py index a11cdb1f828f..ab3f4cfcfbc7 100644 --- a/rerun_py/rerun_sdk/rerun/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/components/__init__.py @@ -9,6 +9,13 @@ AnnotationContextLike, AnnotationContextType, ) +from .auto_space_views import ( + AutoSpaceViews, + AutoSpaceViewsArrayLike, + AutoSpaceViewsBatch, + AutoSpaceViewsLike, + AutoSpaceViewsType, +) from .blob import Blob, BlobArrayLike, BlobBatch, BlobLike, BlobType from .class_id import ClassId, ClassIdBatch, ClassIdType from .clear_is_recursive import ( @@ -28,6 +35,13 @@ DisconnectedSpaceType, ) from .draw_order import DrawOrder, DrawOrderArrayLike, DrawOrderBatch, DrawOrderLike, DrawOrderType +from .entity_properties_component import ( + EntityPropertiesComponent, + EntityPropertiesComponentArrayLike, + EntityPropertiesComponentBatch, + EntityPropertiesComponentLike, + EntityPropertiesComponentType, +) from .half_sizes2d import HalfSizes2D, HalfSizes2DBatch, HalfSizes2DType from .half_sizes3d import HalfSizes3D, HalfSizes3DBatch, HalfSizes3DType from .instance_key import InstanceKey, InstanceKeyArrayLike, InstanceKeyBatch, InstanceKeyLike, InstanceKeyType @@ -38,9 +52,11 @@ from .media_type import MediaType, MediaTypeBatch, MediaTypeType from .mesh_properties import MeshProperties, MeshPropertiesBatch, MeshPropertiesType from .out_of_tree_transform3d import OutOfTreeTransform3D, OutOfTreeTransform3DBatch, OutOfTreeTransform3DType +from .panel_view import PanelView, PanelViewArrayLike, PanelViewBatch, PanelViewLike, PanelViewType from .pinhole_projection import PinholeProjection, PinholeProjectionBatch, PinholeProjectionType from .position2d import Position2D, Position2DBatch, Position2DType from .position3d import Position3D, Position3DBatch, Position3DType +from .query_expressions import QueryExpressions, QueryExpressionsBatch, QueryExpressionsType from .radius import Radius, RadiusArrayLike, RadiusBatch, RadiusLike, RadiusType from .resolution import Resolution, ResolutionBatch, ResolutionType from .rotation3d import Rotation3D, Rotation3DBatch, Rotation3DType @@ -52,6 +68,14 @@ ScalarScatteringLike, ScalarScatteringType, ) +from .space_view_component import SpaceViewComponent, SpaceViewComponentBatch, SpaceViewComponentType +from .space_view_maximized import ( + SpaceViewMaximized, + SpaceViewMaximizedArrayLike, + SpaceViewMaximizedBatch, + SpaceViewMaximizedLike, + SpaceViewMaximizedType, +) from .tensor_data import TensorData, TensorDataBatch, TensorDataType from .text import Text, TextBatch, TextType from .text_log_level import TextLogLevel, TextLogLevelBatch, TextLogLevelType @@ -64,6 +88,7 @@ ViewCoordinatesLike, ViewCoordinatesType, ) +from .viewport_layout import ViewportLayout, ViewportLayoutBatch, ViewportLayoutType __all__ = [ "AnnotationContext", @@ -71,6 +96,11 @@ "AnnotationContextBatch", "AnnotationContextLike", "AnnotationContextType", + "AutoSpaceViews", + "AutoSpaceViewsArrayLike", + "AutoSpaceViewsBatch", + "AutoSpaceViewsLike", + "AutoSpaceViewsType", "Blob", "BlobArrayLike", "BlobBatch", @@ -102,6 +132,11 @@ "DrawOrderBatch", "DrawOrderLike", "DrawOrderType", + "EntityPropertiesComponent", + "EntityPropertiesComponentArrayLike", + "EntityPropertiesComponentBatch", + "EntityPropertiesComponentLike", + "EntityPropertiesComponentType", "HalfSizes2D", "HalfSizes2DBatch", "HalfSizes2DType", @@ -138,6 +173,11 @@ "OutOfTreeTransform3D", "OutOfTreeTransform3DBatch", "OutOfTreeTransform3DType", + "PanelView", + "PanelViewArrayLike", + "PanelViewBatch", + "PanelViewLike", + "PanelViewType", "PinholeProjection", "PinholeProjectionBatch", "PinholeProjectionType", @@ -147,6 +187,9 @@ "Position3D", "Position3DBatch", "Position3DType", + "QueryExpressions", + "QueryExpressionsBatch", + "QueryExpressionsType", "Radius", "RadiusArrayLike", "RadiusBatch", @@ -168,6 +211,14 @@ "ScalarScatteringLike", "ScalarScatteringType", "ScalarType", + "SpaceViewComponent", + "SpaceViewComponentBatch", + "SpaceViewComponentType", + "SpaceViewMaximized", + "SpaceViewMaximizedArrayLike", + "SpaceViewMaximizedBatch", + "SpaceViewMaximizedLike", + "SpaceViewMaximizedType", "TensorData", "TensorDataBatch", "TensorDataType", @@ -188,4 +239,7 @@ "ViewCoordinatesBatch", "ViewCoordinatesLike", "ViewCoordinatesType", + "ViewportLayout", + "ViewportLayoutBatch", + "ViewportLayoutType", ] diff --git a/rerun_py/rerun_sdk/rerun/datatypes/__init__.py b/rerun_py/rerun_sdk/rerun/datatypes/__init__.py index 89743577400d..c14f3b4ac2e5 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/__init__.py @@ -40,6 +40,13 @@ MeshPropertiesType, ) from .quaternion import Quaternion, QuaternionArrayLike, QuaternionBatch, QuaternionLike, QuaternionType +from .query_expressions import ( + QueryExpressions, + QueryExpressionsArrayLike, + QueryExpressionsBatch, + QueryExpressionsLike, + QueryExpressionsType, +) from .rgba32 import Rgba32, Rgba32ArrayLike, Rgba32Batch, Rgba32Like, Rgba32Type from .rotation3d import Rotation3D, Rotation3DArrayLike, Rotation3DBatch, Rotation3DLike, Rotation3DType from .rotation_axis_angle import ( @@ -50,6 +57,13 @@ RotationAxisAngleType, ) from .scale3d import Scale3D, Scale3DArrayLike, Scale3DBatch, Scale3DLike, Scale3DType +from .space_view_component import ( + SpaceViewComponent, + SpaceViewComponentArrayLike, + SpaceViewComponentBatch, + SpaceViewComponentLike, + SpaceViewComponentType, +) from .tensor_buffer import TensorBuffer, TensorBufferArrayLike, TensorBufferBatch, TensorBufferLike, TensorBufferType from .tensor_data import TensorData, TensorDataArrayLike, TensorDataBatch, TensorDataLike, TensorDataType from .tensor_dimension import ( @@ -83,6 +97,13 @@ from .vec2d import Vec2D, Vec2DArrayLike, Vec2DBatch, Vec2DLike, Vec2DType from .vec3d import Vec3D, Vec3DArrayLike, Vec3DBatch, Vec3DLike, Vec3DType from .vec4d import Vec4D, Vec4DArrayLike, Vec4DBatch, Vec4DLike, Vec4DType +from .viewport_layout import ( + ViewportLayout, + ViewportLayoutArrayLike, + ViewportLayoutBatch, + ViewportLayoutLike, + ViewportLayoutType, +) __all__ = [ "Angle", @@ -155,6 +176,11 @@ "QuaternionBatch", "QuaternionLike", "QuaternionType", + "QueryExpressions", + "QueryExpressionsArrayLike", + "QueryExpressionsBatch", + "QueryExpressionsLike", + "QueryExpressionsType", "Rgba32", "Rgba32ArrayLike", "Rgba32Batch", @@ -175,6 +201,11 @@ "Scale3DBatch", "Scale3DLike", "Scale3DType", + "SpaceViewComponent", + "SpaceViewComponentArrayLike", + "SpaceViewComponentBatch", + "SpaceViewComponentLike", + "SpaceViewComponentType", "TensorBuffer", "TensorBufferArrayLike", "TensorBufferBatch", @@ -250,4 +281,9 @@ "Vec4DBatch", "Vec4DLike", "Vec4DType", + "ViewportLayout", + "ViewportLayoutArrayLike", + "ViewportLayoutBatch", + "ViewportLayoutLike", + "ViewportLayoutType", ] From ff8ff552429c0f12ff9dd2d27235577be73232f9 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 21:07:24 +0100 Subject: [PATCH 07/14] Clean up usage now that we have components and datatypes --- crates/re_data_store/src/blueprint/mod.rs | 1 + crates/re_data_store/src/lib.rs | 2 +- .../src/blueprint/components/mod.rs | 1 + .../components/query_expressions_ext.rs | 21 +++++++++ crates/re_space_view/src/blueprint/mod.rs | 2 + .../re_space_view/src/data_query_blueprint.rs | 44 ++++++++----------- crates/re_space_view/src/lib.rs | 3 +- .../blueprint/components/viewport_layout.fbs | 2 +- crates/re_types/src/blueprint/mod.rs | 2 + crates/re_types_builder/src/objects.rs | 2 +- crates/re_viewer/src/app_blueprint.rs | 8 ++-- crates/re_viewer/src/blueprint/mod.rs | 7 +-- crates/re_viewer/src/blueprint_validation.rs | 8 ++-- crates/re_viewer/src/ui/selection_panel.rs | 14 +++--- .../src/space_view/view_query.rs | 2 +- .../blueprint/components/viewport_layout.rs | 2 +- crates/re_viewport/src/blueprint/mod.rs | 2 + crates/re_viewport/src/mod.rs | 2 + crates/re_viewport/src/space_view.rs | 19 ++++---- .../re_viewport/src/space_view_heuristics.rs | 6 +-- crates/re_viewport/src/viewport_blueprint.rs | 22 ++++++---- rerun_py/src/python_bridge.rs | 8 ++-- 22 files changed, 104 insertions(+), 76 deletions(-) create mode 100644 crates/re_data_store/src/blueprint/mod.rs create mode 100644 crates/re_space_view/src/blueprint/components/query_expressions_ext.rs create mode 100644 crates/re_space_view/src/blueprint/mod.rs create mode 100644 crates/re_types/src/blueprint/mod.rs create mode 100644 crates/re_viewport/src/blueprint/mod.rs create mode 100644 crates/re_viewport/src/mod.rs diff --git a/crates/re_data_store/src/blueprint/mod.rs b/crates/re_data_store/src/blueprint/mod.rs new file mode 100644 index 000000000000..f188f2c26df9 --- /dev/null +++ b/crates/re_data_store/src/blueprint/mod.rs @@ -0,0 +1 @@ +pub mod components; diff --git a/crates/re_data_store/src/lib.rs b/crates/re_data_store/src/lib.rs index 8afcb48e50e0..45f88ce9b331 100644 --- a/crates/re_data_store/src/lib.rs +++ b/crates/re_data_store/src/lib.rs @@ -31,7 +31,7 @@ use re_log_types::DataTableError; pub use re_log_types::{EntityPath, EntityPathPart, Index, TimeInt, Timeline}; #[cfg(feature = "serde")] -pub use blueprint::EntityPropertiesComponent; +pub use blueprint::components::EntityPropertiesComponent; #[cfg(feature = "serde")] pub use editable_auto_value::EditableAutoValue; diff --git a/crates/re_space_view/src/blueprint/components/mod.rs b/crates/re_space_view/src/blueprint/components/mod.rs index 42054f19856c..4503703881e3 100644 --- a/crates/re_space_view/src/blueprint/components/mod.rs +++ b/crates/re_space_view/src/blueprint/components/mod.rs @@ -1,5 +1,6 @@ // DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs mod query_expressions; +mod query_expressions_ext; pub use self::query_expressions::QueryExpressions; diff --git a/crates/re_space_view/src/blueprint/components/query_expressions_ext.rs b/crates/re_space_view/src/blueprint/components/query_expressions_ext.rs new file mode 100644 index 000000000000..851627ed564a --- /dev/null +++ b/crates/re_space_view/src/blueprint/components/query_expressions_ext.rs @@ -0,0 +1,21 @@ +use re_log_types::EntityPathExpr; + +use super::QueryExpressions; + +impl QueryExpressions { + pub fn new( + inclusions: impl Iterator, + exclusions: impl Iterator, + ) -> Self { + Self(crate::blueprint::datatypes::QueryExpressions { + inclusions: inclusions + .into_iter() + .map(|s| s.to_string().into()) + .collect(), + exclusions: exclusions + .into_iter() + .map(|s| s.to_string().into()) + .collect(), + }) + } +} diff --git a/crates/re_space_view/src/blueprint/mod.rs b/crates/re_space_view/src/blueprint/mod.rs new file mode 100644 index 000000000000..d02c881b7cb5 --- /dev/null +++ b/crates/re_space_view/src/blueprint/mod.rs @@ -0,0 +1,2 @@ +pub mod components; +pub mod datatypes; diff --git a/crates/re_space_view/src/data_query_blueprint.rs b/crates/re_space_view/src/data_query_blueprint.rs index 7f51a67d076a..e7658e9d57be 100644 --- a/crates/re_space_view/src/data_query_blueprint.rs +++ b/crates/re_space_view/src/data_query_blueprint.rs @@ -12,7 +12,9 @@ use re_viewer_context::{ use slotmap::SlotMap; use smallvec::SmallVec; -use crate::{blueprint::QueryExpressions, DataQuery, EntityOverrides, PropertyResolver}; +use crate::{ + blueprint::components::QueryExpressions, DataQuery, EntityOverrides, PropertyResolver, +}; /// An implementation of [`DataQuery`] that is built from a collection of [`QueryExpressions`] /// @@ -45,19 +47,14 @@ impl DataQueryBlueprint { pub const INDIVIDUAL_OVERRIDES_PREFIX: &'static str = "individual_overrides"; pub const RECURSIVE_OVERRIDES_PREFIX: &'static str = "recursive_overrides"; - pub fn new<'a>( + pub fn new( space_view_class_identifier: SpaceViewClassIdentifier, - queries_entities: impl Iterator, + queries_entities: impl Iterator, ) -> Self { Self { id: DataQueryId::random(), space_view_class_identifier, - expressions: QueryExpressions { - inclusions: queries_entities - .map(|exp| exp.to_string().into()) - .collect::>(), - exclusions: vec![], - }, + expressions: QueryExpressions::new(queries_entities, std::iter::empty()), } } @@ -102,15 +99,12 @@ impl DataQueryBlueprint { fn save_expressions( &self, ctx: &ViewerContext<'_>, - inclusions: &[EntityPathExpr], - exclusions: &[EntityPathExpr], + inclusions: impl Iterator, + exclusions: impl Iterator, ) { let timepoint = TimePoint::timeless(); - let expressions_component = QueryExpressions { - inclusions: inclusions.iter().map(|s| s.to_string().into()).collect(), - exclusions: exclusions.iter().map(|s| s.to_string().into()).collect(), - }; + let expressions_component = QueryExpressions::new(inclusions, exclusions); let row = DataRow::from_cells1_sized( RowId::new(), @@ -171,7 +165,7 @@ impl DataQueryBlueprint { } if edited { - self.save_expressions(ctx, &inclusions, &exclusions); + self.save_expressions(ctx, inclusions.into_iter(), exclusions.into_iter()); } } @@ -196,7 +190,7 @@ impl DataQueryBlueprint { } if edited { - self.save_expressions(ctx, &inclusions, &exclusions); + self.save_expressions(ctx, inclusions.into_iter(), exclusions.into_iter()); } } @@ -225,7 +219,7 @@ impl DataQueryBlueprint { }); if edited { - self.save_expressions(ctx, &inclusions, &exclusions); + self.save_expressions(ctx, inclusions.into_iter(), exclusions.into_iter()); } } @@ -503,7 +497,7 @@ impl DataQueryPropertyResolver<'_> { { let overridden_path = EntityPath::from(&path.as_slice()[props_path.len()..path.len()]); - prop_map.update(overridden_path, props.value.props); + prop_map.update(overridden_path, props.value.0); } }); } @@ -527,7 +521,7 @@ impl<'a> PropertyResolver for DataQueryPropertyResolver<'a> { .store() .query_timeless_component::(prefix) { - root = root.with_child(&overrides.value.props); + root = root.with_child(&overrides.value.0); } } @@ -542,7 +536,7 @@ impl<'a> PropertyResolver for DataQueryPropertyResolver<'a> { let overridden_path = EntityPath::from( &path.as_slice()[self.individual_override_root.len()..path.len()], ); - individual.update(overridden_path, props.value.props); + individual.update(overridden_path, props.value.0); } }); } @@ -723,10 +717,10 @@ mod tests { let query = DataQueryBlueprint { id: DataQueryId::random(), space_view_class_identifier: "3D".into(), - expressions: QueryExpressions { - inclusions: inclusions.into_iter().map(|s| s.into()).collect::>(), - exclusions: exclusions.into_iter().map(|s| s.into()).collect::>(), - }, + expressions: QueryExpressions::new( + inclusions.into_iter().map(EntityPathExpr::from), + exclusions.into_iter().map(EntityPathExpr::from), + ), }; let query_result = query.execute_query(&resolver, &ctx, &entities_per_system_per_class); diff --git a/crates/re_space_view/src/lib.rs b/crates/re_space_view/src/lib.rs index a93ddb6cb0f2..ac5fef09c6a6 100644 --- a/crates/re_space_view/src/lib.rs +++ b/crates/re_space_view/src/lib.rs @@ -2,7 +2,7 @@ //! //! Types & utilities for defining Space View classes and communicating with the Viewport. -mod blueprint; +pub mod blueprint; pub mod controls; mod data_query; mod data_query_blueprint; @@ -10,7 +10,6 @@ mod screenshot; mod space_view_contents; mod unreachable_transform_reason; -pub use blueprint::QueryExpressions; pub use data_query::{DataQuery, EntityOverrides, PropertyResolver, NOOP_RESOLVER}; pub use data_query_blueprint::DataQueryBlueprint; pub use screenshot::ScreenshotMode; diff --git a/crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs b/crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs index 0a0939a8fa20..bffc39728780 100644 --- a/crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs +++ b/crates/re_types/definitions/rerun/blueprint/components/viewport_layout.fbs @@ -14,7 +14,7 @@ namespace rerun.blueprint.components; /// Unstable. Used for the ongoing blueprint experimentations. table ViewportLayout ( "attr.rerun.scope": "blueprint", - "attr.rust.derive": "PartialEq", + "attr.rust.derive": "Default, PartialEq", "attr.rust.override_crate": "re_viewport" ) { viewport_layout: rerun.blueprint.datatypes.ViewportLayout (order: 100); diff --git a/crates/re_types/src/blueprint/mod.rs b/crates/re_types/src/blueprint/mod.rs new file mode 100644 index 000000000000..d02c881b7cb5 --- /dev/null +++ b/crates/re_types/src/blueprint/mod.rs @@ -0,0 +1,2 @@ +pub mod components; +pub mod datatypes; diff --git a/crates/re_types_builder/src/objects.rs b/crates/re_types_builder/src/objects.rs index 7c10a2da958f..15e7e8e75e05 100644 --- a/crates/re_types_builder/src/objects.rs +++ b/crates/re_types_builder/src/objects.rs @@ -201,7 +201,7 @@ impl ObjectKind { pub fn from_pkg_name(pkg_name: impl AsRef, attrs: &Attributes) -> Self { let scope = match attrs.try_get::(pkg_name.as_ref(), crate::ATTR_RERUN_SCOPE) { Some(scope) => format!(".{scope}"), - None => "".to_owned(), + None => String::new(), }; let pkg_name = pkg_name.as_ref().replace(".testing", ""); diff --git a/crates/re_viewer/src/app_blueprint.rs b/crates/re_viewer/src/app_blueprint.rs index e098d0c102d3..fb10e7e77435 100644 --- a/crates/re_viewer/src/app_blueprint.rs +++ b/crates/re_viewer/src/app_blueprint.rs @@ -1,4 +1,4 @@ -use crate::blueprint::PanelView; +use crate::blueprint::components::PanelView; use re_data_store::StoreDb; use re_log_types::{DataRow, EntityPath, RowId, TimePoint}; use re_viewer_context::{CommandSender, StoreContext, SystemCommand, SystemCommandSender}; @@ -88,7 +88,7 @@ pub fn setup_welcome_screen_blueprint(welcome_screen_blueprint: &mut StoreDb) { // TODO(jleibs): Seq instead of timeless? let timepoint = TimePoint::timeless(); - let component = PanelView { is_expanded }; + let component = PanelView(is_expanded); let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 1, [component]) .unwrap(); // Can only fail if we have the wrong number of instances for the component, and we don't @@ -111,7 +111,7 @@ impl<'a> AppBlueprint<'a> { // TODO(jleibs): Seq instead of timeless? let timepoint = TimePoint::timeless(); - let component = PanelView { is_expanded }; + let component = PanelView(is_expanded); let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 1, [component]) @@ -130,5 +130,5 @@ fn load_panel_state(path: &EntityPath, blueprint_db: &re_data_store::StoreDb) -> blueprint_db .store() .query_timeless_component_quiet::(path) - .map(|p| p.is_expanded) + .map(|p| p.0) } diff --git a/crates/re_viewer/src/blueprint/mod.rs b/crates/re_viewer/src/blueprint/mod.rs index 709b135a99b6..f188f2c26df9 100644 --- a/crates/re_viewer/src/blueprint/mod.rs +++ b/crates/re_viewer/src/blueprint/mod.rs @@ -1,6 +1 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/rust/api.rs - -mod panel_view; -mod panel_view_ext; - -pub use self::panel_view::PanelView; +pub mod components; diff --git a/crates/re_viewer/src/blueprint_validation.rs b/crates/re_viewer/src/blueprint_validation.rs index ac9e601ba651..5c4071044734 100644 --- a/crates/re_viewer/src/blueprint_validation.rs +++ b/crates/re_viewer/src/blueprint_validation.rs @@ -1,14 +1,14 @@ use re_arrow_store::LatestAtQuery; use re_data_store::{EntityPropertiesComponent, StoreDb}; use re_log_types::Timeline; -use re_types::blueprint::SpaceViewComponent; +use re_types::blueprint::components::SpaceViewComponent; use re_types_core::Component; use re_viewport::{ - blueprint::{AutoSpaceViews, SpaceViewMaximized, ViewportLayout}, - external::re_space_view::QueryExpressions, + blueprint::components::{AutoSpaceViews, SpaceViewMaximized, ViewportLayout}, + external::re_space_view::blueprint::components::QueryExpressions, }; -use crate::blueprint::PanelView; +use crate::blueprint::components::PanelView; fn validate_component(blueprint: &StoreDb) -> bool { let query = LatestAtQuery::latest(Timeline::default()); diff --git a/crates/re_viewer/src/ui/selection_panel.rs b/crates/re_viewer/src/ui/selection_panel.rs index a6aaf59b0021..8c03ec96ecac 100644 --- a/crates/re_viewer/src/ui/selection_panel.rs +++ b/crates/re_viewer/src/ui/selection_panel.rs @@ -5,7 +5,7 @@ use re_data_store::{ ColorMapper, Colormap, EditableAutoValue, EntityPath, EntityProperties, VisibleHistory, }; use re_data_ui::{image_meaning_for_entity, item_ui, DataUi}; -use re_log_types::{DataRow, RowId, TimePoint}; +use re_log_types::{DataRow, EntityPathExpr, RowId, TimePoint}; use re_space_view_time_series::TimeSeriesSpaceView; use re_types::{ components::{PinholeProjection, Transform3D}, @@ -17,7 +17,9 @@ use re_viewer_context::{ gpu_bridge::colormap_dropdown_button_ui, Item, SpaceViewClass, SpaceViewClassIdentifier, SpaceViewId, SystemCommand, SystemCommandSender as _, UiVerbosity, ViewerContext, }; -use re_viewport::{external::re_space_view::QueryExpressions, Viewport, ViewportBlueprint}; +use re_viewport::{ + external::re_space_view::blueprint::components::QueryExpressions, Viewport, ViewportBlueprint, +}; use crate::ui::visible_history::visible_history_ui; @@ -543,10 +545,10 @@ fn blueprint_ui( if edited_inclusions != inclusions || edited_exclusions != exclusions { let timepoint = TimePoint::timeless(); - let expressions_component = QueryExpressions { - inclusions: edited_inclusions.split('\n').map(|s| s.into()).collect(), - exclusions: edited_exclusions.split('\n').map(|s| s.into()).collect(), - }; + let expressions_component = QueryExpressions::new( + edited_inclusions.split('\n').map(EntityPathExpr::from), + edited_exclusions.split('\n').map(EntityPathExpr::from), + ); let row = DataRow::from_cells1_sized( RowId::new(), diff --git a/crates/re_viewer_context/src/space_view/view_query.rs b/crates/re_viewer_context/src/space_view/view_query.rs index 29e8f67ecb7a..737ac30e571c 100644 --- a/crates/re_viewer_context/src/space_view/view_query.rs +++ b/crates/re_viewer_context/src/space_view/view_query.rs @@ -76,7 +76,7 @@ impl DataResult { ) { re_log::debug!("Overriding {:?} with {:?}", self.override_path, props); - let component = EntityPropertiesComponent { props }; + let component = EntityPropertiesComponent(props); Some(DataCell::from([component])) } else { diff --git a/crates/re_viewport/src/blueprint/components/viewport_layout.rs b/crates/re_viewport/src/blueprint/components/viewport_layout.rs index fbbc3c24a6c0..4cc3a521d6d1 100644 --- a/crates/re_viewport/src/blueprint/components/viewport_layout.rs +++ b/crates/re_viewport/src/blueprint/components/viewport_layout.rs @@ -24,7 +24,7 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Component**: A view of a space. /// /// Unstable. Used for the ongoing blueprint experimentations. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Default, PartialEq)] pub struct ViewportLayout(pub crate::blueprint::datatypes::ViewportLayout); impl> From for ViewportLayout { diff --git a/crates/re_viewport/src/blueprint/mod.rs b/crates/re_viewport/src/blueprint/mod.rs new file mode 100644 index 000000000000..d02c881b7cb5 --- /dev/null +++ b/crates/re_viewport/src/blueprint/mod.rs @@ -0,0 +1,2 @@ +pub mod components; +pub mod datatypes; diff --git a/crates/re_viewport/src/mod.rs b/crates/re_viewport/src/mod.rs new file mode 100644 index 000000000000..f7fe499118c4 --- /dev/null +++ b/crates/re_viewport/src/mod.rs @@ -0,0 +1,2 @@ +pub use components; +pub use datatypes; diff --git a/crates/re_viewport/src/space_view.rs b/crates/re_viewport/src/space_view.rs index 08c017471fdd..f652801f91b9 100644 --- a/crates/re_viewport/src/space_view.rs +++ b/crates/re_viewport/src/space_view.rs @@ -8,7 +8,7 @@ use re_space_view::{ DataQueryBlueprint, EntityOverrides, PropertyResolver, ScreenshotMode, SpaceViewContents, }; use re_space_view_time_series::TimeSeriesSpaceView; -use re_types::blueprint::SpaceViewComponent; +use re_types::blueprint::datatypes::SpaceViewComponent; use re_viewer_context::{ DataQueryId, DataResult, DynSpaceViewClass, PerSystemDataResults, PerSystemEntities, SpaceViewClass, SpaceViewClassIdentifier, SpaceViewHighlights, SpaceViewId, SpaceViewState, @@ -106,8 +106,9 @@ impl SpaceViewBlueprint { contents, } = blueprint_db .store() - .query_timeless_component::(path) - .map(|c| c.value)?; + .query_timeless_component::(path) + .map(|c| c.value)? + .0; let id = SpaceViewId::from_entity_path(path); @@ -318,7 +319,7 @@ impl SpaceViewBlueprint { .blueprint .store() .query_timeless_component_quiet::(&self.entity_path()) - .map(|result| result.value.props); + .map(|result| result.value.0); let resolved_properties = individual_properties.clone().unwrap_or_else(|| { let mut props = EntityProperties::default(); @@ -394,7 +395,7 @@ impl SpaceViewBlueprint { { let overridden_path = EntityPath::from(&path.as_slice()[props_path.len()..path.len()]); - prop_map.update(overridden_path, props.value.props); + prop_map.update(overridden_path, props.value.0); } }); } @@ -433,7 +434,7 @@ mod tests { use super::*; fn save_override(props: EntityProperties, path: &EntityPath, store: &mut StoreDb) { - let component = EntityPropertiesComponent { props }; + let component = EntityPropertiesComponent(props); let row = DataRow::from_cells1_sized( RowId::new(), path.clone(), @@ -470,9 +471,9 @@ mod tests { DataQueryBlueprint::new( "3D".into(), [ - &"parent".into(), - &"parent/skip/child1".into(), - &"parent/skip/child2".into(), + "parent".into(), + "parent/skip/child1".into(), + "parent/skip/child2".into(), ] .into_iter(), ), diff --git a/crates/re_viewport/src/space_view_heuristics.rs b/crates/re_viewport/src/space_view_heuristics.rs index a95e3277c016..e6edac68f360 100644 --- a/crates/re_viewport/src/space_view_heuristics.rs +++ b/crates/re_viewport/src/space_view_heuristics.rs @@ -112,7 +112,7 @@ pub fn all_possible_space_views( // is way too expensive. This needs to be optimized significantly. let candidate_query = DataQueryBlueprint::new( *class_identifier, - std::iter::once(&EntityPathExpr::Recursive(candidate_space_path.clone())), + std::iter::once(EntityPathExpr::Recursive(candidate_space_path.clone())), ); let results = candidate_query.execute_query( @@ -290,7 +290,7 @@ pub fn default_created_space_views( if !result.view_parts.is_empty() { let query = DataQueryBlueprint::new( *candidate.class_identifier(), - std::iter::once(&EntityPathExpr::Exact(result.entity_path.clone())), + std::iter::once(EntityPathExpr::Exact(result.entity_path.clone())), ); let mut space_view = SpaceViewBlueprint::new( *candidate.class_identifier(), @@ -399,7 +399,7 @@ pub fn default_created_space_views( let query = DataQueryBlueprint::new( *candidate.class_identifier(), - expressions.iter(), + expressions.into_iter(), ); let mut space_view = SpaceViewBlueprint::new( diff --git a/crates/re_viewport/src/viewport_blueprint.rs b/crates/re_viewport/src/viewport_blueprint.rs index df316f084fa2..73f96086ebe2 100644 --- a/crates/re_viewport/src/viewport_blueprint.rs +++ b/crates/re_viewport/src/viewport_blueprint.rs @@ -4,7 +4,7 @@ use ahash::HashMap; use re_data_store::{EntityPath, StoreDb}; use re_log_types::{DataRow, RowId, TimePoint}; -use re_types::blueprint::SpaceViewComponent; +use re_types::blueprint::datatypes::SpaceViewComponent; use re_types_core::{archetypes::Clear, AsComponents as _}; use re_viewer_context::{ CommandSender, Item, SpaceViewClassIdentifier, SpaceViewId, SystemCommand, SystemCommandSender, @@ -12,7 +12,8 @@ use re_viewer_context::{ }; use crate::{ - blueprint::{AutoSpaceViews, SpaceViewMaximized, ViewportLayout}, + blueprint::components::{AutoSpaceViews, SpaceViewMaximized}, + blueprint::datatypes::ViewportLayout, space_info::SpaceInfoCollection, space_view::SpaceViewBlueprint, space_view_heuristics::default_created_space_views, @@ -290,11 +291,12 @@ impl<'a> ViewportBlueprint<'a> { if after.tree != before.tree || after.auto_layout != before.auto_layout { re_log::trace!("Syncing tree"); - let component = ViewportLayout { + let component: crate::blueprint::components::ViewportLayout = ViewportLayout { space_view_keys: after.space_views.keys().cloned().collect(), tree: after.tree.clone(), auto_layout: after.auto_layout, - }; + } + .into(); add_delta_from_single_component(&mut deltas, &entity_path, &timepoint, component); } @@ -385,9 +387,12 @@ pub fn load_viewport_blueprint(blueprint_db: &re_data_store::StoreDb) -> Viewpor let viewport_layout: ViewportLayout = blueprint_db .store() - .query_timeless_component_quiet::(&VIEWPORT_PATH.into()) + .query_timeless_component_quiet::( + &VIEWPORT_PATH.into(), + ) .map(|space_view| space_view.value) - .unwrap_or_default(); + .unwrap_or_default() + .0; let unknown_space_views: HashMap<_, _> = space_views .iter() @@ -431,13 +436,14 @@ pub fn sync_space_view( // TODO(jleibs): Seq instead of timeless? let timepoint = TimePoint::timeless(); - let component = SpaceViewComponent { + let component: re_types::blueprint::components::SpaceViewComponent = SpaceViewComponent { display_name: space_view.display_name.clone().into(), class_identifier: space_view.class_identifier().as_str().into(), space_origin: (&space_view.space_origin).into(), entities_determined_by_user: space_view.entities_determined_by_user, contents: space_view.queries.iter().map(|q| q.id.into()).collect(), - }; + } + .into(); add_delta_from_single_component(deltas, &space_view.entity_path(), &timepoint, component); diff --git a/rerun_py/src/python_bridge.rs b/rerun_py/src/python_bridge.rs index 95c7f796cef9..719c950372ca 100644 --- a/rerun_py/src/python_bridge.rs +++ b/rerun_py/src/python_bridge.rs @@ -721,7 +721,7 @@ fn set_panels( blueprint: Option<&PyRecordingStream>, ) { // TODO(jleibs): This should go away as part of https://github.com/rerun-io/rerun/issues/2089 - use re_viewer::blueprint::PanelView; + use re_viewer::blueprint::components::PanelView; if let Some(expanded) = blueprint_view_expanded { set_panel(PanelView::BLUEPRINT_VIEW_PATH, expanded, blueprint); @@ -740,12 +740,12 @@ fn set_panel(entity_path: &str, is_expanded: bool, blueprint: Option<&PyRecordin }; // TODO(jleibs): This should go away as part of https://github.com/rerun-io/rerun/issues/2089 - use re_viewer::blueprint::PanelView; + use re_viewer::blueprint::components::PanelView; // TODO(jleibs): Validation this is a valid blueprint path? let entity_path = parse_entity_path(entity_path); - let panel_state = PanelView { is_expanded }; + let panel_state = PanelView(is_expanded); let row = DataRow::from_cells1( RowId::new(), @@ -815,7 +815,7 @@ fn set_auto_space_views(enabled: bool, blueprint: Option<&PyRecordingStream>) { }; // TODO(jleibs): This should go away as part of https://github.com/rerun-io/rerun/issues/2089 - use re_viewport::blueprint::AutoSpaceViews; + use re_viewport::blueprint::components::AutoSpaceViews; let enable_auto_space = AutoSpaceViews(enabled); From 6b64ad1eb8c606436b21e862c75eb88d87592389 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 21:09:29 +0100 Subject: [PATCH 08/14] Lint --- crates/re_types_builder/src/codegen/python.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 5a52eeec0f54..c1d1baac4898 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -1231,17 +1231,17 @@ fn quote_import_clauses_from_fqname(obj_scope: &Option, fqname: &str) -> if let Some(scope) = obj_scope { if from.starts_with("rerun.datatypes") { - "from ... import datatypes".to_owned() + "from ... import datatypes".to_owned() // NOLINT } else if from.starts_with(format!("rerun.{scope}.datatypes").as_str()) { "from .. import datatypes".to_owned() } else if from.starts_with("rerun.components") { - "from ... import components".to_owned() + "from ... import components".to_owned() // NOLINT } else if from.starts_with(format!("rerun.{scope}.components").as_str()) { "from .. import components".to_owned() } else if from.starts_with("rerun.archetypes") { // NOTE: This is assuming importing other archetypes is legal… which whether it is or // isn't for this code generator to say. - "from ... import archetypes".to_owned() + "from ... import archetypes".to_owned() // NOLINT } else if from.starts_with(format!("rerun.{scope}.archetytpes").as_str()) { "from .. import archetypes".to_owned() } else if from.is_empty() { From d9276c27de17f6a7e4249c142af4c06ee55b27f6 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 21:12:10 +0100 Subject: [PATCH 09/14] Fix python relative imports --- crates/re_types_builder/src/codegen/python.rs | 8 +++++++- .../rerun/blueprint/components/auto_space_views.py | 2 +- .../blueprint/components/entity_properties_component.py | 4 ++-- .../rerun_sdk/rerun/blueprint/components/panel_view.py | 2 +- .../rerun/blueprint/components/query_expressions.py | 2 +- .../rerun/blueprint/components/space_view_component.py | 2 +- .../rerun/blueprint/components/space_view_maximized.py | 4 ++-- .../rerun/blueprint/components/viewport_layout.py | 2 +- .../rerun/blueprint/datatypes/query_expressions.py | 2 +- .../rerun/blueprint/datatypes/space_view_component.py | 2 +- .../rerun/blueprint/datatypes/viewport_layout.py | 4 ++-- 11 files changed, 20 insertions(+), 14 deletions(-) diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index c1d1baac4898..f1a656b0c51b 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -346,7 +346,13 @@ impl PythonCodeGenerator { let manifest = quote_manifest(names); - let rerun_path = if obj.is_testing() { "rerun." } else { ".." }; + let rerun_path = if obj.is_testing() { + "rerun." + } else if obj.scope().is_some() { + "..." // NOLINT + } else { + ".." + }; code.push_unindented_text( format!( 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 index e121f8ffe91e..d5e9acbf0d7a 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/auto_space_views.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/auto_space_views.py @@ -10,7 +10,7 @@ import pyarrow as pa from attrs import define, field -from .._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin +from ..._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin __all__ = [ "AutoSpaceViews", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/entity_properties_component.py b/rerun_py/rerun_sdk/rerun/blueprint/components/entity_properties_component.py index 6ca80c0f3219..90ba638c4e2f 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/entity_properties_component.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/entity_properties_component.py @@ -12,8 +12,8 @@ import pyarrow as pa from attrs import define, field -from .._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin -from .._converters import ( +from ..._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin +from ..._converters import ( to_np_uint8, ) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/panel_view.py b/rerun_py/rerun_sdk/rerun/blueprint/components/panel_view.py index 49cc35d03463..7c60347826f2 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/panel_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/panel_view.py @@ -10,7 +10,7 @@ import pyarrow as pa from attrs import define, field -from .._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin +from ..._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin __all__ = ["PanelView", "PanelViewArrayLike", "PanelViewBatch", "PanelViewLike", "PanelViewType"] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/query_expressions.py b/rerun_py/rerun_sdk/rerun/blueprint/components/query_expressions.py index 280a97a26b20..4319b4265cad 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/query_expressions.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/query_expressions.py @@ -5,8 +5,8 @@ from __future__ import annotations +from ..._baseclasses import ComponentBatchMixin from .. import datatypes -from .._baseclasses import ComponentBatchMixin __all__ = ["QueryExpressions", "QueryExpressionsBatch", "QueryExpressionsType"] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_component.py b/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_component.py index 55804f86849e..515cba2b87f4 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_component.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_component.py @@ -5,8 +5,8 @@ from __future__ import annotations +from ..._baseclasses import ComponentBatchMixin from .. import datatypes -from .._baseclasses import ComponentBatchMixin __all__ = ["SpaceViewComponent", "SpaceViewComponentBatch", "SpaceViewComponentType"] 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 index 27c040d7b09f..da9d49aa0269 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_maximized.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/space_view_maximized.py @@ -12,8 +12,8 @@ import pyarrow as pa from attrs import define, field -from .._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin -from .._converters import ( +from ..._baseclasses import BaseBatch, BaseExtensionType, ComponentBatchMixin +from ..._converters import ( to_np_uint8, ) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/viewport_layout.py b/rerun_py/rerun_sdk/rerun/blueprint/components/viewport_layout.py index 608e7ebb897a..cb12396b5f9f 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/viewport_layout.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/viewport_layout.py @@ -5,8 +5,8 @@ from __future__ import annotations +from ..._baseclasses import ComponentBatchMixin from .. import datatypes -from .._baseclasses import ComponentBatchMixin __all__ = ["ViewportLayout", "ViewportLayoutBatch", "ViewportLayoutType"] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/query_expressions.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/query_expressions.py index 580d2331fb89..cf172f453503 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/query_expressions.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/query_expressions.py @@ -10,7 +10,7 @@ import pyarrow as pa from attrs import define, field -from .._baseclasses import BaseBatch, BaseExtensionType +from ..._baseclasses import BaseBatch, BaseExtensionType __all__ = [ "QueryExpressions", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/space_view_component.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/space_view_component.py index 1d46c92e6647..a949d9af7a15 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/space_view_component.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/space_view_component.py @@ -11,7 +11,7 @@ from attrs import define, field from ... import datatypes -from .._baseclasses import BaseBatch, BaseExtensionType +from ..._baseclasses import BaseBatch, BaseExtensionType __all__ = [ "SpaceViewComponent", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/viewport_layout.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/viewport_layout.py index c82a0e155b8b..235a4eb0a3f4 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/viewport_layout.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/viewport_layout.py @@ -12,8 +12,8 @@ import pyarrow as pa from attrs import define, field -from .._baseclasses import BaseBatch, BaseExtensionType -from .._converters import ( +from ..._baseclasses import BaseBatch, BaseExtensionType +from ..._converters import ( to_np_uint8, ) From 3b1ecf537cf960946a44d7132aca36ea6966150d Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 21:22:42 +0100 Subject: [PATCH 10/14] Properly handle scope for generation of the init modules --- crates/re_types_builder/src/codegen/python.rs | 12 ++-- .../rerun/blueprint/components/__init__.py | 58 +++++++++++++++++++ .../rerun/blueprint/datatypes/__init__.py | 40 +++++++++++++ .../rerun_sdk/rerun/components/__init__.py | 54 ----------------- .../rerun_sdk/rerun/datatypes/__init__.py | 36 ------------ 5 files changed, 104 insertions(+), 96 deletions(-) diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index f1a656b0c51b..e3b71f0d14a4 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -269,13 +269,12 @@ impl PythonCodeGenerator { object_kind: ObjectKind, files_to_write: &mut BTreeMap, ) { - let mut known_scopes = HashSet::<_>::default(); - let kind_path = self.pkg_path.join(object_kind.plural_snake_case()); let test_kind_path = self.testing_pkg_path.join(object_kind.plural_snake_case()); // (module_name, [object_name]) let mut mods = BTreeMap::>::new(); + let mut scoped_mods = BTreeMap::>>::new(); let mut test_mods = BTreeMap::>::new(); // Generate folder contents: @@ -284,7 +283,6 @@ impl PythonCodeGenerator { let scope = obj.scope(); let kind_path = if let Some(scope) = scope { - known_scopes.insert(scope.clone()); self.pkg_path .join(scope) .join(object_kind.plural_snake_case()) @@ -323,6 +321,8 @@ impl PythonCodeGenerator { // and archetypes separately (and even then it's a bit shady, eh). if obj.is_testing() { &mut test_mods + } else if let Some(scope) = obj.scope() { + scoped_mods.entry(scope).or_default() } else { &mut mods } @@ -442,15 +442,15 @@ impl PythonCodeGenerator { files_to_write.insert(filepath.clone(), code); } - // rerun/{datatypes|components|archetypes}/__init__.py + // rerun/[{scope}]/{datatypes|components|archetypes}/__init__.py write_init_file(&kind_path, &mods, files_to_write); write_init_file(&test_kind_path, &test_mods, files_to_write); - for scope in known_scopes { + for (scope, mods) in scoped_mods { let scoped_kind_path = self .pkg_path .join(scope) .join(object_kind.plural_snake_case()); - write_init_file(&scoped_kind_path, &BTreeMap::new(), files_to_write); + write_init_file(&scoped_kind_path, &mods, files_to_write); } } } diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py index b848838d60eb..befa4ff5d11e 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py @@ -1,3 +1,61 @@ # DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs from __future__ import annotations + +from .auto_space_views import ( + AutoSpaceViews, + AutoSpaceViewsArrayLike, + AutoSpaceViewsBatch, + AutoSpaceViewsLike, + AutoSpaceViewsType, +) +from .entity_properties_component import ( + EntityPropertiesComponent, + EntityPropertiesComponentArrayLike, + EntityPropertiesComponentBatch, + EntityPropertiesComponentLike, + EntityPropertiesComponentType, +) +from .panel_view import PanelView, PanelViewArrayLike, PanelViewBatch, PanelViewLike, PanelViewType +from .query_expressions import QueryExpressions, QueryExpressionsBatch, QueryExpressionsType +from .space_view_component import SpaceViewComponent, SpaceViewComponentBatch, SpaceViewComponentType +from .space_view_maximized import ( + SpaceViewMaximized, + SpaceViewMaximizedArrayLike, + SpaceViewMaximizedBatch, + SpaceViewMaximizedLike, + SpaceViewMaximizedType, +) +from .viewport_layout import ViewportLayout, ViewportLayoutBatch, ViewportLayoutType + +__all__ = [ + "AutoSpaceViews", + "AutoSpaceViewsArrayLike", + "AutoSpaceViewsBatch", + "AutoSpaceViewsLike", + "AutoSpaceViewsType", + "EntityPropertiesComponent", + "EntityPropertiesComponentArrayLike", + "EntityPropertiesComponentBatch", + "EntityPropertiesComponentLike", + "EntityPropertiesComponentType", + "PanelView", + "PanelViewArrayLike", + "PanelViewBatch", + "PanelViewLike", + "PanelViewType", + "QueryExpressions", + "QueryExpressionsBatch", + "QueryExpressionsType", + "SpaceViewComponent", + "SpaceViewComponentBatch", + "SpaceViewComponentType", + "SpaceViewMaximized", + "SpaceViewMaximizedArrayLike", + "SpaceViewMaximizedBatch", + "SpaceViewMaximizedLike", + "SpaceViewMaximizedType", + "ViewportLayout", + "ViewportLayoutBatch", + "ViewportLayoutType", +] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py index b848838d60eb..3df0c34df7be 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py @@ -1,3 +1,43 @@ # DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs from __future__ import annotations + +from .query_expressions import ( + QueryExpressions, + QueryExpressionsArrayLike, + QueryExpressionsBatch, + QueryExpressionsLike, + QueryExpressionsType, +) +from .space_view_component import ( + SpaceViewComponent, + SpaceViewComponentArrayLike, + SpaceViewComponentBatch, + SpaceViewComponentLike, + SpaceViewComponentType, +) +from .viewport_layout import ( + ViewportLayout, + ViewportLayoutArrayLike, + ViewportLayoutBatch, + ViewportLayoutLike, + ViewportLayoutType, +) + +__all__ = [ + "QueryExpressions", + "QueryExpressionsArrayLike", + "QueryExpressionsBatch", + "QueryExpressionsLike", + "QueryExpressionsType", + "SpaceViewComponent", + "SpaceViewComponentArrayLike", + "SpaceViewComponentBatch", + "SpaceViewComponentLike", + "SpaceViewComponentType", + "ViewportLayout", + "ViewportLayoutArrayLike", + "ViewportLayoutBatch", + "ViewportLayoutLike", + "ViewportLayoutType", +] diff --git a/rerun_py/rerun_sdk/rerun/components/__init__.py b/rerun_py/rerun_sdk/rerun/components/__init__.py index ab3f4cfcfbc7..a11cdb1f828f 100644 --- a/rerun_py/rerun_sdk/rerun/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/components/__init__.py @@ -9,13 +9,6 @@ AnnotationContextLike, AnnotationContextType, ) -from .auto_space_views import ( - AutoSpaceViews, - AutoSpaceViewsArrayLike, - AutoSpaceViewsBatch, - AutoSpaceViewsLike, - AutoSpaceViewsType, -) from .blob import Blob, BlobArrayLike, BlobBatch, BlobLike, BlobType from .class_id import ClassId, ClassIdBatch, ClassIdType from .clear_is_recursive import ( @@ -35,13 +28,6 @@ DisconnectedSpaceType, ) from .draw_order import DrawOrder, DrawOrderArrayLike, DrawOrderBatch, DrawOrderLike, DrawOrderType -from .entity_properties_component import ( - EntityPropertiesComponent, - EntityPropertiesComponentArrayLike, - EntityPropertiesComponentBatch, - EntityPropertiesComponentLike, - EntityPropertiesComponentType, -) from .half_sizes2d import HalfSizes2D, HalfSizes2DBatch, HalfSizes2DType from .half_sizes3d import HalfSizes3D, HalfSizes3DBatch, HalfSizes3DType from .instance_key import InstanceKey, InstanceKeyArrayLike, InstanceKeyBatch, InstanceKeyLike, InstanceKeyType @@ -52,11 +38,9 @@ from .media_type import MediaType, MediaTypeBatch, MediaTypeType from .mesh_properties import MeshProperties, MeshPropertiesBatch, MeshPropertiesType from .out_of_tree_transform3d import OutOfTreeTransform3D, OutOfTreeTransform3DBatch, OutOfTreeTransform3DType -from .panel_view import PanelView, PanelViewArrayLike, PanelViewBatch, PanelViewLike, PanelViewType from .pinhole_projection import PinholeProjection, PinholeProjectionBatch, PinholeProjectionType from .position2d import Position2D, Position2DBatch, Position2DType from .position3d import Position3D, Position3DBatch, Position3DType -from .query_expressions import QueryExpressions, QueryExpressionsBatch, QueryExpressionsType from .radius import Radius, RadiusArrayLike, RadiusBatch, RadiusLike, RadiusType from .resolution import Resolution, ResolutionBatch, ResolutionType from .rotation3d import Rotation3D, Rotation3DBatch, Rotation3DType @@ -68,14 +52,6 @@ ScalarScatteringLike, ScalarScatteringType, ) -from .space_view_component import SpaceViewComponent, SpaceViewComponentBatch, SpaceViewComponentType -from .space_view_maximized import ( - SpaceViewMaximized, - SpaceViewMaximizedArrayLike, - SpaceViewMaximizedBatch, - SpaceViewMaximizedLike, - SpaceViewMaximizedType, -) from .tensor_data import TensorData, TensorDataBatch, TensorDataType from .text import Text, TextBatch, TextType from .text_log_level import TextLogLevel, TextLogLevelBatch, TextLogLevelType @@ -88,7 +64,6 @@ ViewCoordinatesLike, ViewCoordinatesType, ) -from .viewport_layout import ViewportLayout, ViewportLayoutBatch, ViewportLayoutType __all__ = [ "AnnotationContext", @@ -96,11 +71,6 @@ "AnnotationContextBatch", "AnnotationContextLike", "AnnotationContextType", - "AutoSpaceViews", - "AutoSpaceViewsArrayLike", - "AutoSpaceViewsBatch", - "AutoSpaceViewsLike", - "AutoSpaceViewsType", "Blob", "BlobArrayLike", "BlobBatch", @@ -132,11 +102,6 @@ "DrawOrderBatch", "DrawOrderLike", "DrawOrderType", - "EntityPropertiesComponent", - "EntityPropertiesComponentArrayLike", - "EntityPropertiesComponentBatch", - "EntityPropertiesComponentLike", - "EntityPropertiesComponentType", "HalfSizes2D", "HalfSizes2DBatch", "HalfSizes2DType", @@ -173,11 +138,6 @@ "OutOfTreeTransform3D", "OutOfTreeTransform3DBatch", "OutOfTreeTransform3DType", - "PanelView", - "PanelViewArrayLike", - "PanelViewBatch", - "PanelViewLike", - "PanelViewType", "PinholeProjection", "PinholeProjectionBatch", "PinholeProjectionType", @@ -187,9 +147,6 @@ "Position3D", "Position3DBatch", "Position3DType", - "QueryExpressions", - "QueryExpressionsBatch", - "QueryExpressionsType", "Radius", "RadiusArrayLike", "RadiusBatch", @@ -211,14 +168,6 @@ "ScalarScatteringLike", "ScalarScatteringType", "ScalarType", - "SpaceViewComponent", - "SpaceViewComponentBatch", - "SpaceViewComponentType", - "SpaceViewMaximized", - "SpaceViewMaximizedArrayLike", - "SpaceViewMaximizedBatch", - "SpaceViewMaximizedLike", - "SpaceViewMaximizedType", "TensorData", "TensorDataBatch", "TensorDataType", @@ -239,7 +188,4 @@ "ViewCoordinatesBatch", "ViewCoordinatesLike", "ViewCoordinatesType", - "ViewportLayout", - "ViewportLayoutBatch", - "ViewportLayoutType", ] diff --git a/rerun_py/rerun_sdk/rerun/datatypes/__init__.py b/rerun_py/rerun_sdk/rerun/datatypes/__init__.py index c14f3b4ac2e5..89743577400d 100644 --- a/rerun_py/rerun_sdk/rerun/datatypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/__init__.py @@ -40,13 +40,6 @@ MeshPropertiesType, ) from .quaternion import Quaternion, QuaternionArrayLike, QuaternionBatch, QuaternionLike, QuaternionType -from .query_expressions import ( - QueryExpressions, - QueryExpressionsArrayLike, - QueryExpressionsBatch, - QueryExpressionsLike, - QueryExpressionsType, -) from .rgba32 import Rgba32, Rgba32ArrayLike, Rgba32Batch, Rgba32Like, Rgba32Type from .rotation3d import Rotation3D, Rotation3DArrayLike, Rotation3DBatch, Rotation3DLike, Rotation3DType from .rotation_axis_angle import ( @@ -57,13 +50,6 @@ RotationAxisAngleType, ) from .scale3d import Scale3D, Scale3DArrayLike, Scale3DBatch, Scale3DLike, Scale3DType -from .space_view_component import ( - SpaceViewComponent, - SpaceViewComponentArrayLike, - SpaceViewComponentBatch, - SpaceViewComponentLike, - SpaceViewComponentType, -) from .tensor_buffer import TensorBuffer, TensorBufferArrayLike, TensorBufferBatch, TensorBufferLike, TensorBufferType from .tensor_data import TensorData, TensorDataArrayLike, TensorDataBatch, TensorDataLike, TensorDataType from .tensor_dimension import ( @@ -97,13 +83,6 @@ from .vec2d import Vec2D, Vec2DArrayLike, Vec2DBatch, Vec2DLike, Vec2DType from .vec3d import Vec3D, Vec3DArrayLike, Vec3DBatch, Vec3DLike, Vec3DType from .vec4d import Vec4D, Vec4DArrayLike, Vec4DBatch, Vec4DLike, Vec4DType -from .viewport_layout import ( - ViewportLayout, - ViewportLayoutArrayLike, - ViewportLayoutBatch, - ViewportLayoutLike, - ViewportLayoutType, -) __all__ = [ "Angle", @@ -176,11 +155,6 @@ "QuaternionBatch", "QuaternionLike", "QuaternionType", - "QueryExpressions", - "QueryExpressionsArrayLike", - "QueryExpressionsBatch", - "QueryExpressionsLike", - "QueryExpressionsType", "Rgba32", "Rgba32ArrayLike", "Rgba32Batch", @@ -201,11 +175,6 @@ "Scale3DBatch", "Scale3DLike", "Scale3DType", - "SpaceViewComponent", - "SpaceViewComponentArrayLike", - "SpaceViewComponentBatch", - "SpaceViewComponentLike", - "SpaceViewComponentType", "TensorBuffer", "TensorBufferArrayLike", "TensorBufferBatch", @@ -281,9 +250,4 @@ "Vec4DBatch", "Vec4DLike", "Vec4DType", - "ViewportLayout", - "ViewportLayoutArrayLike", - "ViewportLayoutBatch", - "ViewportLayoutLike", - "ViewportLayoutType", ] From b6d9b2b458cc3f76054aaf46f596ef5ce92e1c38 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 21:24:23 +0100 Subject: [PATCH 11/14] Fix the linter --- scripts/lint.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/lint.py b/scripts/lint.py index 65643ecde573..a4d6c81e66f9 100755 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -28,6 +28,7 @@ explicit_quotes = re.compile(r'[^(]\\"\{\w*\}\\"') # looks for: \"{foo}\" ellipsis = re.compile(r"[^.]\.\.\.([^\-.0-9a-zA-Z]|$)") ellipsis_expression = re.compile(r"[\[(<].*\.\.\..*[\])>]") +ellipsis_import = re.compile(r"from \.\.\.") ellipsis_reference = re.compile(r"&\.\.\.") ellipsis_bare = re.compile(r"^\s*\.\.\.\s*$") @@ -83,6 +84,7 @@ def lint_line( if ( ellipsis.search(line) and not ellipsis_expression.search(line) + and not ellipsis_import.search(line) and not ellipsis_bare.search(line) and not ellipsis_reference.search(line) ): From 6db63a139e4db19e9a3b73bb55239aa1f80d57c3 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 21:35:24 +0100 Subject: [PATCH 12/14] Remove old c++ types --- rerun_cpp/src/rerun/blueprint/.gitattributes | 17 --- .../src/rerun/blueprint/auto_space_views.cpp | 59 -------- .../src/rerun/blueprint/auto_space_views.hpp | 59 -------- .../rerun/blueprint/blueprint/.gitattributes | 6 - .../rerun/blueprint/blueprint/archetypes.hpp | 3 - .../rerun/blueprint/blueprint/components.hpp | 11 -- .../rerun/blueprint/blueprint/datatypes.hpp | 7 - .../blueprint/entity_properties_component.cpp | 76 ----------- .../blueprint/entity_properties_component.hpp | 61 --------- rerun_cpp/src/rerun/blueprint/panel_view.cpp | 63 --------- rerun_cpp/src/rerun/blueprint/panel_view.hpp | 58 -------- .../src/rerun/blueprint/query_expressions.cpp | 95 ------------- .../src/rerun/blueprint/query_expressions.hpp | 58 -------- .../rerun/blueprint/space_view_component.cpp | 127 ------------------ .../rerun/blueprint/space_view_component.hpp | 75 ----------- .../rerun/blueprint/space_view_maximized.cpp | 72 ---------- .../rerun/blueprint/space_view_maximized.hpp | 62 --------- .../src/rerun/blueprint/viewport_layout.cpp | 102 -------------- .../src/rerun/blueprint/viewport_layout.hpp | 60 --------- 19 files changed, 1071 deletions(-) delete mode 100644 rerun_cpp/src/rerun/blueprint/.gitattributes delete mode 100644 rerun_cpp/src/rerun/blueprint/auto_space_views.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/auto_space_views.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes delete mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/components.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/entity_properties_component.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/entity_properties_component.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/panel_view.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/panel_view.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/query_expressions.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/query_expressions.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/space_view_component.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/space_view_component.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/space_view_maximized.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/space_view_maximized.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/viewport_layout.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/viewport_layout.hpp diff --git a/rerun_cpp/src/rerun/blueprint/.gitattributes b/rerun_cpp/src/rerun/blueprint/.gitattributes deleted file mode 100644 index 61a66315e64c..000000000000 --- a/rerun_cpp/src/rerun/blueprint/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs - -.gitattributes linguist-generated=true -auto_space_views.cpp linguist-generated=true -auto_space_views.hpp linguist-generated=true -entity_properties_component.cpp linguist-generated=true -entity_properties_component.hpp linguist-generated=true -panel_view.cpp linguist-generated=true -panel_view.hpp linguist-generated=true -query_expressions.cpp linguist-generated=true -query_expressions.hpp linguist-generated=true -space_view_component.cpp linguist-generated=true -space_view_component.hpp linguist-generated=true -space_view_maximized.cpp linguist-generated=true -space_view_maximized.hpp linguist-generated=true -viewport_layout.cpp linguist-generated=true -viewport_layout.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/auto_space_views.cpp b/rerun_cpp/src/rerun/blueprint/auto_space_views.cpp deleted file mode 100644 index 5b6d09e5c475..000000000000 --- a/rerun_cpp/src/rerun/blueprint/auto_space_views.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/auto_space_views.fbs". - -#include "auto_space_views.hpp" - -#include -#include - -namespace rerun::blueprint {} - -namespace rerun { - const std::shared_ptr& Loggable::arrow_datatype() { - static const auto datatype = arrow::boolean(); - return datatype; - } - - rerun::Error Loggable::fill_arrow_array_builder( - arrow::BooleanBuilder* builder, const blueprint::AutoSpaceViews* elements, - size_t num_elements - ) { - if (builder == nullptr) { - return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); - } - if (elements == nullptr) { - return rerun::Error( - ErrorCode::UnexpectedNullArgument, - "Cannot serialize null pointer to arrow array." - ); - } - - static_assert(sizeof(*elements) == sizeof(elements->enabled)); - ARROW_RETURN_NOT_OK(builder->AppendValues( - reinterpret_cast(&elements->enabled), - static_cast(num_elements) - )); - - return Error::ok(); - } - - Result> Loggable::to_arrow( - const blueprint::AutoSpaceViews* instances, size_t num_instances - ) { - // TODO(andreas): Allow configuring the memory pool. - arrow::MemoryPool* pool = arrow::default_memory_pool(); - auto datatype = arrow_datatype(); - - ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) - if (instances && num_instances > 0) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - static_cast(builder.get()), - instances, - num_instances - )); - } - std::shared_ptr array; - ARROW_RETURN_NOT_OK(builder->Finish(&array)); - return array; - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/auto_space_views.hpp b/rerun_cpp/src/rerun/blueprint/auto_space_views.hpp deleted file mode 100644 index 4950955be366..000000000000 --- a/rerun_cpp/src/rerun/blueprint/auto_space_views.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/auto_space_views.fbs". - -#pragma once - -#include "../result.hpp" - -#include -#include - -namespace arrow { - class Array; - class BooleanBuilder; - class DataType; -} // namespace arrow - -namespace rerun::blueprint { - /// **Blueprint**: A flag indicating space views should be automatically populated. - /// - /// Unstable. Used for the ongoing blueprint experimentations. - struct AutoSpaceViews { - bool enabled; - - public: - AutoSpaceViews() = default; - - AutoSpaceViews(bool enabled_) : enabled(enabled_) {} - - AutoSpaceViews& operator=(bool enabled_) { - enabled = enabled_; - return *this; - } - }; -} // namespace rerun::blueprint - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.AutoSpaceViews"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::BooleanBuilder* builder, const blueprint::AutoSpaceViews* elements, - size_t num_elements - ); - - /// Serializes an array of `rerun::blueprint::AutoSpaceViews` into an arrow array. - static Result> to_arrow( - const blueprint::AutoSpaceViews* instances, size_t num_instances - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes b/rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes deleted file mode 100644 index 435e1f8fe40d..000000000000 --- a/rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs - -.gitattributes linguist-generated=true -archetypes.hpp linguist-generated=true -components.hpp linguist-generated=true -datatypes.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp deleted file mode 100644 index dcdf9bcbede6..000000000000 --- a/rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp +++ /dev/null @@ -1,3 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs - -#pragma once diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp deleted file mode 100644 index 526517caf42c..000000000000 --- a/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp +++ /dev/null @@ -1,11 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs - -#pragma once - -#include "blueprint/components/auto_space_views.hpp" -#include "blueprint/components/entity_properties_component.hpp" -#include "blueprint/components/panel_view.hpp" -#include "blueprint/components/query_expressions.hpp" -#include "blueprint/components/space_view_component.hpp" -#include "blueprint/components/space_view_maximized.hpp" -#include "blueprint/components/viewport_layout.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp deleted file mode 100644 index 3d21d0d3d0ba..000000000000 --- a/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp +++ /dev/null @@ -1,7 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs - -#pragma once - -#include "blueprint/datatypes/query_expressions.hpp" -#include "blueprint/datatypes/space_view_component.hpp" -#include "blueprint/datatypes/viewport_layout.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/entity_properties_component.cpp b/rerun_cpp/src/rerun/blueprint/entity_properties_component.cpp deleted file mode 100644 index 83ee59613a28..000000000000 --- a/rerun_cpp/src/rerun/blueprint/entity_properties_component.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/entity_properties_component.fbs". - -#include "entity_properties_component.hpp" - -#include -#include - -namespace rerun::blueprint {} - -namespace rerun { - const std::shared_ptr& - Loggable::arrow_datatype() { - static const auto datatype = arrow::struct_({ - arrow::field("props", arrow::list(arrow::field("item", arrow::uint8(), false)), false), - }); - return datatype; - } - - rerun::Error Loggable::fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::EntityPropertiesComponent* elements, - size_t num_elements - ) { - if (builder == nullptr) { - return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); - } - if (elements == nullptr) { - return rerun::Error( - ErrorCode::UnexpectedNullArgument, - "Cannot serialize null pointer to arrow array." - ); - } - - { - auto field_builder = static_cast(builder->field_builder(0)); - auto value_builder = static_cast(field_builder->value_builder()); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); - - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto& element = elements[elem_idx]; - ARROW_RETURN_NOT_OK(field_builder->Append()); - ARROW_RETURN_NOT_OK(value_builder->AppendValues( - element.props.data(), - static_cast(element.props.size()), - nullptr - )); - } - } - ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); - - return Error::ok(); - } - - Result> Loggable::to_arrow( - const blueprint::EntityPropertiesComponent* instances, size_t num_instances - ) { - // TODO(andreas): Allow configuring the memory pool. - arrow::MemoryPool* pool = arrow::default_memory_pool(); - auto datatype = arrow_datatype(); - - ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) - if (instances && num_instances > 0) { - RR_RETURN_NOT_OK( - Loggable::fill_arrow_array_builder( - static_cast(builder.get()), - instances, - num_instances - ) - ); - } - std::shared_ptr array; - ARROW_RETURN_NOT_OK(builder->Finish(&array)); - return array; - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/entity_properties_component.hpp b/rerun_cpp/src/rerun/blueprint/entity_properties_component.hpp deleted file mode 100644 index f963e5d7bb35..000000000000 --- a/rerun_cpp/src/rerun/blueprint/entity_properties_component.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/entity_properties_component.fbs". - -#pragma once - -#include "../collection.hpp" -#include "../result.hpp" - -#include -#include -#include - -namespace arrow { - class Array; - class DataType; - class StructBuilder; -} // namespace arrow - -namespace rerun::blueprint { - /// **Blueprint**: The configurable set of overridable properties. - /// - /// Unstable. Used for the ongoing blueprint experimentations. - struct EntityPropertiesComponent { - rerun::Collection props; - - public: - EntityPropertiesComponent() = default; - - EntityPropertiesComponent(rerun::Collection props_) : props(std::move(props_)) {} - - EntityPropertiesComponent& operator=(rerun::Collection props_) { - props = std::move(props_); - return *this; - } - }; -} // namespace rerun::blueprint - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.EntityPropertiesComponent"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::EntityPropertiesComponent* elements, - size_t num_elements - ); - - /// Serializes an array of `rerun::blueprint::EntityPropertiesComponent` into an arrow array. - static Result> to_arrow( - const blueprint::EntityPropertiesComponent* instances, size_t num_instances - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/panel_view.cpp b/rerun_cpp/src/rerun/blueprint/panel_view.cpp deleted file mode 100644 index c5bcaf0db2e9..000000000000 --- a/rerun_cpp/src/rerun/blueprint/panel_view.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/panel_view.fbs". - -#include "panel_view.hpp" - -#include -#include - -namespace rerun::blueprint {} - -namespace rerun { - const std::shared_ptr& Loggable::arrow_datatype() { - static const auto datatype = arrow::struct_({ - arrow::field("is_expanded", arrow::boolean(), false), - }); - return datatype; - } - - rerun::Error Loggable::fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::PanelView* elements, size_t num_elements - ) { - if (builder == nullptr) { - return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); - } - if (elements == nullptr) { - return rerun::Error( - ErrorCode::UnexpectedNullArgument, - "Cannot serialize null pointer to arrow array." - ); - } - - { - auto field_builder = static_cast(builder->field_builder(0)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - ARROW_RETURN_NOT_OK(field_builder->Append(elements[elem_idx].is_expanded)); - } - } - ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); - - return Error::ok(); - } - - Result> Loggable::to_arrow( - const blueprint::PanelView* instances, size_t num_instances - ) { - // TODO(andreas): Allow configuring the memory pool. - arrow::MemoryPool* pool = arrow::default_memory_pool(); - auto datatype = arrow_datatype(); - - ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) - if (instances && num_instances > 0) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - static_cast(builder.get()), - instances, - num_instances - )); - } - std::shared_ptr array; - ARROW_RETURN_NOT_OK(builder->Finish(&array)); - return array; - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/panel_view.hpp b/rerun_cpp/src/rerun/blueprint/panel_view.hpp deleted file mode 100644 index 8f0bc6544aaa..000000000000 --- a/rerun_cpp/src/rerun/blueprint/panel_view.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/panel_view.fbs". - -#pragma once - -#include "../result.hpp" - -#include -#include - -namespace arrow { - class Array; - class DataType; - class StructBuilder; -} // namespace arrow - -namespace rerun::blueprint { - /// **Blueprint**: The state of the panels. - /// - /// Unstable. Used for the ongoing blueprint experimentations. - struct PanelView { - bool is_expanded; - - public: - PanelView() = default; - - PanelView(bool is_expanded_) : is_expanded(is_expanded_) {} - - PanelView& operator=(bool is_expanded_) { - is_expanded = is_expanded_; - return *this; - } - }; -} // namespace rerun::blueprint - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.PanelView"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::PanelView* elements, size_t num_elements - ); - - /// Serializes an array of `rerun::blueprint::PanelView` into an arrow array. - static Result> to_arrow( - const blueprint::PanelView* instances, size_t num_instances - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/query_expressions.cpp b/rerun_cpp/src/rerun/blueprint/query_expressions.cpp deleted file mode 100644 index 2c8474403168..000000000000 --- a/rerun_cpp/src/rerun/blueprint/query_expressions.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/query_expressions.fbs". - -#include "query_expressions.hpp" - -#include -#include - -namespace rerun::blueprint {} - -namespace rerun { - const std::shared_ptr& Loggable::arrow_datatype( - ) { - static const auto datatype = arrow::struct_({ - arrow::field( - "inclusions", - arrow::list(arrow::field("item", arrow::utf8(), false)), - false - ), - arrow::field( - "exclusions", - arrow::list(arrow::field("item", arrow::utf8(), false)), - false - ), - }); - return datatype; - } - - rerun::Error Loggable::fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::QueryExpressions* elements, - size_t num_elements - ) { - if (builder == nullptr) { - return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); - } - if (elements == nullptr) { - return rerun::Error( - ErrorCode::UnexpectedNullArgument, - "Cannot serialize null pointer to arrow array." - ); - } - - { - auto field_builder = static_cast(builder->field_builder(0)); - auto value_builder = static_cast(field_builder->value_builder()); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); - - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto& element = elements[elem_idx]; - ARROW_RETURN_NOT_OK(field_builder->Append()); - for (size_t item_idx = 0; item_idx < element.inclusions.size(); item_idx += 1) { - ARROW_RETURN_NOT_OK(value_builder->Append(element.inclusions[item_idx])); - } - } - } - { - auto field_builder = static_cast(builder->field_builder(1)); - auto value_builder = static_cast(field_builder->value_builder()); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); - - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto& element = elements[elem_idx]; - ARROW_RETURN_NOT_OK(field_builder->Append()); - for (size_t item_idx = 0; item_idx < element.exclusions.size(); item_idx += 1) { - ARROW_RETURN_NOT_OK(value_builder->Append(element.exclusions[item_idx])); - } - } - } - ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); - - return Error::ok(); - } - - Result> Loggable::to_arrow( - const blueprint::QueryExpressions* instances, size_t num_instances - ) { - // TODO(andreas): Allow configuring the memory pool. - arrow::MemoryPool* pool = arrow::default_memory_pool(); - auto datatype = arrow_datatype(); - - ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) - if (instances && num_instances > 0) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - static_cast(builder.get()), - instances, - num_instances - )); - } - std::shared_ptr array; - ARROW_RETURN_NOT_OK(builder->Finish(&array)); - return array; - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/query_expressions.hpp b/rerun_cpp/src/rerun/blueprint/query_expressions.hpp deleted file mode 100644 index dd5b843745f0..000000000000 --- a/rerun_cpp/src/rerun/blueprint/query_expressions.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/query_expressions.fbs". - -#pragma once - -#include "../collection.hpp" -#include "../result.hpp" - -#include -#include -#include - -namespace arrow { - class Array; - class DataType; - class StructBuilder; -} // namespace arrow - -namespace rerun::blueprint { - /// **Blueprint**: A set of expressions used for a `DataQueryBlueprint`. - /// - /// Unstable. Used for the ongoing blueprint experimentations. - struct QueryExpressions { - /// A set of strings representing `EntityPathExpression`s to be included. - rerun::Collection inclusions; - - /// A set of strings representing `EntityPathExpression`s to be excluded. - rerun::Collection exclusions; - - public: - QueryExpressions() = default; - }; -} // namespace rerun::blueprint - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.QueryExpressions"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::QueryExpressions* elements, - size_t num_elements - ); - - /// Serializes an array of `rerun::blueprint::QueryExpressions` into an arrow array. - static Result> to_arrow( - const blueprint::QueryExpressions* instances, size_t num_instances - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/space_view_component.cpp b/rerun_cpp/src/rerun/blueprint/space_view_component.cpp deleted file mode 100644 index 273ed68758a7..000000000000 --- a/rerun_cpp/src/rerun/blueprint/space_view_component.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/space_view_component.fbs". - -#include "space_view_component.hpp" - -#include "../datatypes/entity_path.hpp" -#include "../datatypes/uuid.hpp" - -#include -#include - -namespace rerun::blueprint {} - -namespace rerun { - const std::shared_ptr& Loggable::arrow_datatype( - ) { - static const auto datatype = arrow::struct_({ - arrow::field("display_name", arrow::utf8(), false), - arrow::field("class_identifier", arrow::utf8(), false), - arrow::field( - "space_origin", - Loggable::arrow_datatype(), - false - ), - arrow::field("entities_determined_by_user", arrow::boolean(), false), - arrow::field( - "contents", - arrow::list( - arrow::field("item", Loggable::arrow_datatype(), false) - ), - false - ), - }); - return datatype; - } - - rerun::Error Loggable::fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::SpaceViewComponent* elements, - size_t num_elements - ) { - if (builder == nullptr) { - return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); - } - if (elements == nullptr) { - return rerun::Error( - ErrorCode::UnexpectedNullArgument, - "Cannot serialize null pointer to arrow array." - ); - } - - { - auto field_builder = static_cast(builder->field_builder(0)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - ARROW_RETURN_NOT_OK(field_builder->Append(elements[elem_idx].display_name)); - } - } - { - auto field_builder = static_cast(builder->field_builder(1)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - ARROW_RETURN_NOT_OK(field_builder->Append(elements[elem_idx].class_identifier)); - } - } - { - auto field_builder = static_cast(builder->field_builder(2)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - field_builder, - &elements[elem_idx].space_origin, - 1 - )); - } - } - { - auto field_builder = static_cast(builder->field_builder(3)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - ARROW_RETURN_NOT_OK( - field_builder->Append(elements[elem_idx].entities_determined_by_user) - ); - } - } - { - auto field_builder = static_cast(builder->field_builder(4)); - auto value_builder = static_cast(field_builder->value_builder()); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); - - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto& element = elements[elem_idx]; - ARROW_RETURN_NOT_OK(field_builder->Append()); - if (element.contents.data()) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - value_builder, - element.contents.data(), - element.contents.size() - )); - } - } - } - ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); - - return Error::ok(); - } - - Result> Loggable::to_arrow( - const blueprint::SpaceViewComponent* instances, size_t num_instances - ) { - // TODO(andreas): Allow configuring the memory pool. - arrow::MemoryPool* pool = arrow::default_memory_pool(); - auto datatype = arrow_datatype(); - - ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) - if (instances && num_instances > 0) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - static_cast(builder.get()), - instances, - num_instances - )); - } - std::shared_ptr array; - ARROW_RETURN_NOT_OK(builder->Finish(&array)); - return array; - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/space_view_component.hpp b/rerun_cpp/src/rerun/blueprint/space_view_component.hpp deleted file mode 100644 index d267e00bb276..000000000000 --- a/rerun_cpp/src/rerun/blueprint/space_view_component.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/space_view_component.fbs". - -#pragma once - -#include "../collection.hpp" -#include "../datatypes/entity_path.hpp" -#include "../datatypes/uuid.hpp" -#include "../result.hpp" - -#include -#include -#include - -namespace arrow { - class Array; - class DataType; - class StructBuilder; -} // namespace arrow - -namespace rerun::blueprint { - /// **Blueprint**: A view of a space. - /// - /// Unstable. Used for the ongoing blueprint experimentations. - struct SpaceViewComponent { - /// The name of the view. - std::string display_name; - - /// The class of the view. - std::string class_identifier; - - /// 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. - rerun::datatypes::EntityPath space_origin; - - /// True if the user is expected to add entities themselves. False otherwise. - bool entities_determined_by_user; - - /// `BlueprintId`s of the `DataQuery`s that make up this `SpaceView`. - /// - /// It determines which entities are part of the spaceview. - rerun::Collection contents; - - public: - SpaceViewComponent() = default; - }; -} // namespace rerun::blueprint - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.SpaceViewComponent"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::SpaceViewComponent* elements, - size_t num_elements - ); - - /// Serializes an array of `rerun::blueprint::SpaceViewComponent` into an arrow array. - static Result> to_arrow( - const blueprint::SpaceViewComponent* instances, size_t num_instances - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/space_view_maximized.cpp b/rerun_cpp/src/rerun/blueprint/space_view_maximized.cpp deleted file mode 100644 index fc353ffb7074..000000000000 --- a/rerun_cpp/src/rerun/blueprint/space_view_maximized.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/space_view_maximized.fbs". - -#include "space_view_maximized.hpp" - -#include -#include - -namespace rerun::blueprint {} - -namespace rerun { - const std::shared_ptr& Loggable::arrow_datatype( - ) { - static const auto datatype = arrow::list(arrow::field("item", arrow::uint8(), false)); - return datatype; - } - - rerun::Error Loggable::fill_arrow_array_builder( - arrow::ListBuilder* builder, const blueprint::SpaceViewMaximized* elements, - size_t num_elements - ) { - if (builder == nullptr) { - return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); - } - if (elements == nullptr) { - return rerun::Error( - ErrorCode::UnexpectedNullArgument, - "Cannot serialize null pointer to arrow array." - ); - } - - auto value_builder = static_cast(builder->value_builder()); - ARROW_RETURN_NOT_OK(builder->Reserve(static_cast(num_elements))); - ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 1))); - - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto& element = elements[elem_idx]; - if (element.id.has_value()) { - ARROW_RETURN_NOT_OK(builder->Append()); - ARROW_RETURN_NOT_OK(value_builder->AppendValues( - element.id.value().data(), - static_cast(element.id.value().size()), - nullptr - )); - } else { - ARROW_RETURN_NOT_OK(builder->AppendNull()); - } - } - - return Error::ok(); - } - - Result> Loggable::to_arrow( - const blueprint::SpaceViewMaximized* instances, size_t num_instances - ) { - // TODO(andreas): Allow configuring the memory pool. - arrow::MemoryPool* pool = arrow::default_memory_pool(); - auto datatype = arrow_datatype(); - - ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) - if (instances && num_instances > 0) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - static_cast(builder.get()), - instances, - num_instances - )); - } - std::shared_ptr array; - ARROW_RETURN_NOT_OK(builder->Finish(&array)); - return array; - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/space_view_maximized.hpp b/rerun_cpp/src/rerun/blueprint/space_view_maximized.hpp deleted file mode 100644 index e95d5e261bf2..000000000000 --- a/rerun_cpp/src/rerun/blueprint/space_view_maximized.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/space_view_maximized.fbs". - -#pragma once - -#include "../collection.hpp" -#include "../result.hpp" - -#include -#include -#include -#include - -namespace arrow { - class Array; - class DataType; - class ListBuilder; -} // namespace arrow - -namespace rerun::blueprint { - /// **Blueprint**: Whether a space view is maximized. - /// - /// Unstable. Used for the ongoing blueprint experimentations. - struct SpaceViewMaximized { - std::optional> id; - - public: - SpaceViewMaximized() = default; - - SpaceViewMaximized(std::optional> id_) : id(std::move(id_)) {} - - SpaceViewMaximized& operator=(std::optional> id_) { - id = std::move(id_); - return *this; - } - }; -} // namespace rerun::blueprint - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.SpaceViewMaximized"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::ListBuilder* builder, const blueprint::SpaceViewMaximized* elements, - size_t num_elements - ); - - /// Serializes an array of `rerun::blueprint::SpaceViewMaximized` into an arrow array. - static Result> to_arrow( - const blueprint::SpaceViewMaximized* instances, size_t num_instances - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/viewport_layout.cpp b/rerun_cpp/src/rerun/blueprint/viewport_layout.cpp deleted file mode 100644 index 91f56cb881b9..000000000000 --- a/rerun_cpp/src/rerun/blueprint/viewport_layout.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/viewport_layout.fbs". - -#include "viewport_layout.hpp" - -#include -#include - -namespace rerun::blueprint {} - -namespace rerun { - const std::shared_ptr& Loggable::arrow_datatype() { - static const auto datatype = arrow::struct_({ - arrow::field( - "space_view_keys", - arrow::list(arrow::field("item", arrow::uint8(), false)), - false - ), - arrow::field("tree", arrow::list(arrow::field("item", arrow::uint8(), false)), false), - arrow::field("auto_layout", arrow::boolean(), false), - }); - return datatype; - } - - rerun::Error Loggable::fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::ViewportLayout* elements, - size_t num_elements - ) { - if (builder == nullptr) { - return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); - } - if (elements == nullptr) { - return rerun::Error( - ErrorCode::UnexpectedNullArgument, - "Cannot serialize null pointer to arrow array." - ); - } - - { - auto field_builder = static_cast(builder->field_builder(0)); - auto value_builder = static_cast(field_builder->value_builder()); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); - - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto& element = elements[elem_idx]; - ARROW_RETURN_NOT_OK(field_builder->Append()); - ARROW_RETURN_NOT_OK(value_builder->AppendValues( - element.space_view_keys.data(), - static_cast(element.space_view_keys.size()), - nullptr - )); - } - } - { - auto field_builder = static_cast(builder->field_builder(1)); - auto value_builder = static_cast(field_builder->value_builder()); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); - - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto& element = elements[elem_idx]; - ARROW_RETURN_NOT_OK(field_builder->Append()); - ARROW_RETURN_NOT_OK(value_builder->AppendValues( - element.tree.data(), - static_cast(element.tree.size()), - nullptr - )); - } - } - { - auto field_builder = static_cast(builder->field_builder(2)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - ARROW_RETURN_NOT_OK(field_builder->Append(elements[elem_idx].auto_layout)); - } - } - ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); - - return Error::ok(); - } - - Result> Loggable::to_arrow( - const blueprint::ViewportLayout* instances, size_t num_instances - ) { - // TODO(andreas): Allow configuring the memory pool. - arrow::MemoryPool* pool = arrow::default_memory_pool(); - auto datatype = arrow_datatype(); - - ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) - if (instances && num_instances > 0) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - static_cast(builder.get()), - instances, - num_instances - )); - } - std::shared_ptr array; - ARROW_RETURN_NOT_OK(builder->Finish(&array)); - return array; - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/viewport_layout.hpp b/rerun_cpp/src/rerun/blueprint/viewport_layout.hpp deleted file mode 100644 index a5f321f8f4f8..000000000000 --- a/rerun_cpp/src/rerun/blueprint/viewport_layout.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/re_types/definitions/rerun/blueprint/viewport_layout.fbs". - -#pragma once - -#include "../collection.hpp" -#include "../result.hpp" - -#include -#include - -namespace arrow { - class Array; - class DataType; - class StructBuilder; -} // namespace arrow - -namespace rerun::blueprint { - /// **Blueprint**: A view of a space. - /// - /// Unstable. Used for the ongoing blueprint experimentations. - struct ViewportLayout { - /// space_view_keys - rerun::Collection space_view_keys; - - /// tree - rerun::Collection tree; - - /// auto_layout - bool auto_layout; - - public: - ViewportLayout() = default; - }; -} // namespace rerun::blueprint - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.ViewportLayout"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::ViewportLayout* elements, - size_t num_elements - ); - - /// Serializes an array of `rerun::blueprint::ViewportLayout` into an arrow array. - static Result> to_arrow( - const blueprint::ViewportLayout* instances, size_t num_instances - ); - }; -} // namespace rerun From d8d2c665dca380b11b664688a5e179f6c1e3978a Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Mon, 11 Dec 2023 21:48:58 +0100 Subject: [PATCH 13/14] Fix c++ module files --- crates/re_types_builder/src/codegen/cpp/mod.rs | 14 +++++++++----- rerun_cpp/src/rerun/blueprint/.gitattributes | 5 +++++ .../rerun}/blueprint/blueprint/.gitattributes | 0 .../rerun}/blueprint/blueprint/archetypes.hpp | 0 .../src/rerun/blueprint/blueprint/components.hpp | 11 +++++++++++ .../src/rerun/blueprint/blueprint/datatypes.hpp | 7 +++++++ rerun_cpp/src/rerun/blueprint/components.hpp | 11 +++++++++++ rerun_cpp/src/rerun/blueprint/datatypes.hpp | 7 +++++++ .../generated/blueprint/blueprint/components.hpp | 3 --- .../generated/blueprint/blueprint/datatypes.hpp | 3 --- 10 files changed, 50 insertions(+), 11 deletions(-) create mode 100644 rerun_cpp/src/rerun/blueprint/.gitattributes rename rerun_cpp/{tests/generated => src/rerun}/blueprint/blueprint/.gitattributes (100%) rename rerun_cpp/{tests/generated => src/rerun}/blueprint/blueprint/archetypes.hpp (100%) create mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/components.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/components.hpp create mode 100644 rerun_cpp/src/rerun/blueprint/datatypes.hpp delete mode 100644 rerun_cpp/tests/generated/blueprint/blueprint/components.hpp delete mode 100644 rerun_cpp/tests/generated/blueprint/blueprint/datatypes.hpp diff --git a/crates/re_types_builder/src/codegen/cpp/mod.rs b/crates/re_types_builder/src/codegen/cpp/mod.rs index 5e47a4a92056..037adaa52a38 100644 --- a/crates/re_types_builder/src/codegen/cpp/mod.rs +++ b/crates/re_types_builder/src/codegen/cpp/mod.rs @@ -213,7 +213,11 @@ impl CppCodeGenerator { let header_file_names = ordered_objects .iter() .filter(|obj| obj.is_testing() == testing) - .map(|obj| format!("{folder_name}/{}.hpp", obj.snake_case_name())); + .map(|obj| format!("{folder_name}/{}.hpp", obj.snake_case_name())) + .collect_vec(); + if header_file_names.is_empty() { + continue; + } let tokens = quote! { #pragma_once #(#hash include #header_file_names "NEWLINE_TOKEN")* @@ -223,10 +227,10 @@ impl CppCodeGenerator { } else { &folder_path_sdk }; - let filepath = folder_path - .parent() - .unwrap() - .join(format!("{folder_name}.hpp")); + let filepath = folder_path.parent().unwrap().join(format!( + "{}.hpp", + object_kind.plural_snake_case().to_owned() + )); let contents = string_from_token_stream(&tokens, None); files_to_write.insert(filepath, contents); } diff --git a/rerun_cpp/src/rerun/blueprint/.gitattributes b/rerun_cpp/src/rerun/blueprint/.gitattributes new file mode 100644 index 000000000000..46edb742f8b7 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/.gitattributes @@ -0,0 +1,5 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +components.hpp linguist-generated=true +datatypes.hpp linguist-generated=true diff --git a/rerun_cpp/tests/generated/blueprint/blueprint/.gitattributes b/rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes similarity index 100% rename from rerun_cpp/tests/generated/blueprint/blueprint/.gitattributes rename to rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes diff --git a/rerun_cpp/tests/generated/blueprint/blueprint/archetypes.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp similarity index 100% rename from rerun_cpp/tests/generated/blueprint/blueprint/archetypes.hpp rename to rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp new file mode 100644 index 000000000000..9b865f885835 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp @@ -0,0 +1,11 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs + +#pragma once + +#include "components/auto_space_views.hpp" +#include "components/entity_properties_component.hpp" +#include "components/panel_view.hpp" +#include "components/query_expressions.hpp" +#include "components/space_view_component.hpp" +#include "components/space_view_maximized.hpp" +#include "components/viewport_layout.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp new file mode 100644 index 000000000000..07b63377f764 --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp @@ -0,0 +1,7 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs + +#pragma once + +#include "datatypes/query_expressions.hpp" +#include "datatypes/space_view_component.hpp" +#include "datatypes/viewport_layout.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/components.hpp b/rerun_cpp/src/rerun/blueprint/components.hpp new file mode 100644 index 000000000000..526517caf42c --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/components.hpp @@ -0,0 +1,11 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs + +#pragma once + +#include "blueprint/components/auto_space_views.hpp" +#include "blueprint/components/entity_properties_component.hpp" +#include "blueprint/components/panel_view.hpp" +#include "blueprint/components/query_expressions.hpp" +#include "blueprint/components/space_view_component.hpp" +#include "blueprint/components/space_view_maximized.hpp" +#include "blueprint/components/viewport_layout.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/datatypes.hpp b/rerun_cpp/src/rerun/blueprint/datatypes.hpp new file mode 100644 index 000000000000..3d21d0d3d0ba --- /dev/null +++ b/rerun_cpp/src/rerun/blueprint/datatypes.hpp @@ -0,0 +1,7 @@ +// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs + +#pragma once + +#include "blueprint/datatypes/query_expressions.hpp" +#include "blueprint/datatypes/space_view_component.hpp" +#include "blueprint/datatypes/viewport_layout.hpp" diff --git a/rerun_cpp/tests/generated/blueprint/blueprint/components.hpp b/rerun_cpp/tests/generated/blueprint/blueprint/components.hpp deleted file mode 100644 index dcdf9bcbede6..000000000000 --- a/rerun_cpp/tests/generated/blueprint/blueprint/components.hpp +++ /dev/null @@ -1,3 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs - -#pragma once diff --git a/rerun_cpp/tests/generated/blueprint/blueprint/datatypes.hpp b/rerun_cpp/tests/generated/blueprint/blueprint/datatypes.hpp deleted file mode 100644 index dcdf9bcbede6..000000000000 --- a/rerun_cpp/tests/generated/blueprint/blueprint/datatypes.hpp +++ /dev/null @@ -1,3 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs - -#pragma once From 0e68b7923a60c2668be717a2638c626d5637cb15 Mon Sep 17 00:00:00 2001 From: Jeremy Leibs Date: Tue, 12 Dec 2023 13:10:33 +0100 Subject: [PATCH 14/14] Remove orphaned blueprint headers --- .../src/rerun/blueprint/blueprint/.gitattributes | 6 ------ .../src/rerun/blueprint/blueprint/archetypes.hpp | 3 --- .../src/rerun/blueprint/blueprint/components.hpp | 11 ----------- rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp | 7 ------- 4 files changed, 27 deletions(-) delete mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes delete mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/components.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes b/rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes deleted file mode 100644 index 435e1f8fe40d..000000000000 --- a/rerun_cpp/src/rerun/blueprint/blueprint/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs - -.gitattributes linguist-generated=true -archetypes.hpp linguist-generated=true -components.hpp linguist-generated=true -datatypes.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp deleted file mode 100644 index dcdf9bcbede6..000000000000 --- a/rerun_cpp/src/rerun/blueprint/blueprint/archetypes.hpp +++ /dev/null @@ -1,3 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs - -#pragma once diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp deleted file mode 100644 index 9b865f885835..000000000000 --- a/rerun_cpp/src/rerun/blueprint/blueprint/components.hpp +++ /dev/null @@ -1,11 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs - -#pragma once - -#include "components/auto_space_views.hpp" -#include "components/entity_properties_component.hpp" -#include "components/panel_view.hpp" -#include "components/query_expressions.hpp" -#include "components/space_view_component.hpp" -#include "components/space_view_maximized.hpp" -#include "components/viewport_layout.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp b/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp deleted file mode 100644 index 07b63377f764..000000000000 --- a/rerun_cpp/src/rerun/blueprint/blueprint/datatypes.hpp +++ /dev/null @@ -1,7 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs - -#pragma once - -#include "datatypes/query_expressions.hpp" -#include "datatypes/space_view_component.hpp" -#include "datatypes/viewport_layout.hpp"