Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into andreas/rename-applic…
Browse files Browse the repository at this point in the history
…ability-to-maybevisualizable
  • Loading branch information
Wumpf committed Jan 22, 2025
2 parents 885fa79 + 85fc27d commit b690802
Show file tree
Hide file tree
Showing 224 changed files with 5,229 additions and 1,586 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5636,7 +5636,9 @@ name = "re_blueprint_tree"
version = "0.22.0-alpha.1+dev"
dependencies = [
"egui",
"egui_kittest",
"itertools 0.13.0",
"re_chunk_store",
"re_context_menu",
"re_data_ui",
"re_entity_db",
Expand All @@ -5645,6 +5647,7 @@ dependencies = [
"re_tracing",
"re_types",
"re_ui",
"re_view_spatial",
"re_viewer_context",
"re_viewport_blueprint",
"smallvec",
Expand Down Expand Up @@ -6761,7 +6764,6 @@ version = "0.22.0-alpha.1+dev"
dependencies = [
"ahash",
"egui",
"egui_kittest",
"fjadra",
"itertools 0.13.0",
"nohash-hasher",
Expand Down
305 changes: 230 additions & 75 deletions crates/build/re_types_builder/src/codegen/cpp/mod.rs

Large diffs are not rendered by default.

41 changes: 39 additions & 2 deletions crates/build/re_types_builder/src/codegen/rust/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::{BTreeMap, HashMap, HashSet};

use anyhow::Context as _;
use camino::{Utf8Path, Utf8PathBuf};
use itertools::Itertools as _;
use itertools::Itertools;
use proc_macro2::TokenStream;
use quote::{format_ident, quote};

Expand Down Expand Up @@ -1922,10 +1922,47 @@ fn quote_builder_from_obj(reporter: &Reporter, objects: &Objects, obj: &Object)
}
});

let columnar_methods = obj.is_eager_rust_archetype().then(|| {
let columns_doc = unindent::unindent("\
Partitions the component data into multiple sub-batches.
Specifically, this transforms the existing [`SerializedComponentBatch`]es data into [`SerializedComponentColumn`]s
instead, via [`SerializedComponentBatch::partitioned`].
This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
The specified `lengths` must sum to the total length of the component batch.
[`SerializedComponentColumn`]: [::re_types_core::SerializedComponentColumn]
");
let columns_doc = quote_doc_lines(&columns_doc.lines().map(|l| l.to_owned()).collect_vec());

let fields = required.iter().chain(optional.iter()).map(|field| {
let field_name = format_ident!("{}", field.name);
quote!(self.#field_name.map(|#field_name| #field_name.partitioned(_lengths.clone())).transpose()?)
});

quote! {
#columns_doc
#[inline]
pub fn columns<I>(
self,
_lengths: I, // prefixed so it doesn't conflict with fields of the same name
) -> SerializationResult<impl Iterator<Item = ::re_types_core::SerializedComponentColumn>>
where
I: IntoIterator<Item = usize> + Clone,
{
let columns = [ #(#fields),* ];
let indicator_column = ::re_types_core::indicator_column::<Self>(_lengths.into_iter().count())?;
Ok(columns.into_iter().chain([indicator_column]).flatten())
}
}
});

let with_methods = if obj.is_eager_rust_archetype() {
quote! {
#partial_update_methods

#columnar_methods
#(#eager_with_methods)*
}
} else {
Expand Down
1 change: 1 addition & 0 deletions crates/build/re_types_builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ pub const ATTR_RERUN_EXPERIMENTAL: &str = "attr.rerun.experimental";
pub const ATTR_PYTHON_ALIASES: &str = "attr.python.aliases";
pub const ATTR_PYTHON_ARRAY_ALIASES: &str = "attr.python.array_aliases";

pub const ATTR_CPP_ARCHETYPE_EAGER: &str = "attr.cpp.archetype_eager";
pub const ATTR_CPP_NO_FIELD_CTORS: &str = "attr.cpp.no_field_ctors";
pub const ATTR_CPP_RENAME_FIELD: &str = "attr.cpp.rename_field";

Expand Down
1 change: 1 addition & 0 deletions crates/store/re_log_types/src/path/entity_path_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub enum EntityPathFilterError {
///
/// Important: the same substitutions must be used in every place we resolve [`EntityPathFilter`] to
/// [`ResolvedEntityPathFilter`].
#[derive(Debug)]
pub struct EntityPathSubs(HashMap<String, String>);

impl EntityPathSubs {
Expand Down
6 changes: 6 additions & 0 deletions crates/store/re_types/definitions/attributes/cpp.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ attribute "attr.cpp.no_field_ctors";
/// Changes the name of a field in the generated C++ code.
/// This can be used to avoid name clashes with C++ keywords or methods.
attribute "attr.cpp.rename_field";

/// The generated C++ object should be eagerly serialized, i.e. only comprised of Arrow arrays.
///
/// Applies only to archetypes. No-op otherwise.
// TODO(#7245): This should be always enabled.
attribute "attr.cpp.archetype_eager";
1 change: 1 addition & 0 deletions crates/store/re_types/definitions/attributes/rust.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ attribute "attr.rust.archetype_native";
/// The generated Rust object should be eagerly serialized, i.e. only comprised of Arrow arrays.
///
/// Applies only to archetypes. No-op otherwise.
// TODO(#7245): This should be always enabled.
attribute "attr.rust.archetype_eager";
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace rerun.archetypes;
/// \example archetypes/annotation_context_connections !api title="Connections" image="https://static.rerun.io/annotation_context_connections/4a8422bc154699c5334f574ff01b55c5cd1748e3/1200w.png"
table AnnotationContext (
// TODO(#7245): "attr.rust.archetype_eager",
"attr.cpp.archetype_eager",
"attr.rust.derive": "Eq, PartialEq",
"attr.docs.view_types": "Spatial2DView, Spatial3DView"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace rerun.archetypes;
/// \example archetypes/arrows2d_simple title="Simple batch of 2D arrows" image="https://static.rerun.io/arrow2d_simple/59f044ccc03f7bc66ee802288f75706618b29a6e/1200w.png"
table Arrows2D (
"attr.rust.archetype_eager",
"attr.cpp.archetype_eager",
"attr.rust.derive": "PartialEq",
"attr.rust.new_pub_crate",
"attr.cpp.no_field_ctors",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace rerun.archetypes;
/// \example archetypes/arrows3d_simple title="Simple batch of 3D arrows" image="https://static.rerun.io/arrow3d_simple/55e2f794a520bbf7527d7b828b0264732146c5d0/1200w.png"
table Arrows3D (
"attr.rust.archetype_eager",
"attr.cpp.archetype_eager",
"attr.rust.derive": "PartialEq",
"attr.rust.new_pub_crate",
"attr.cpp.no_field_ctors",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ namespace rerun.archetypes;
/// \example archetypes/points3d_ui_radius title="Log points with radii given in UI points" image="https://static.rerun.io/point3d_ui_radius/e051a65b4317438bcaea8d0eee016ac9460b5336/1200w.png"
/// \example archetypes/points3d_send_columns title="Send several point clouds with varying point count over time in a single call" image="https://static.rerun.io/points3d_send_columns/633b524a2ee439b0e3afc3f894f4927ce938a3ec/1200w.png" missing="rs"
table Points3D (
"attr.rust.archetype_eager": "",
"attr.rust.archetype_eager",
"attr.cpp.archetype_eager",
"attr.rust.derive": "PartialEq",
"attr.docs.category": "Spatial 3D",
"attr.docs.view_types": "Spatial3DView, Spatial2DView: if logged above active projection"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace rerun.archetypes;
/// \example archetypes/transform3d_hierarchy title="Transform hierarchy" image="https://static.rerun.io/transform_hierarchy/cb7be7a5a31fcb2efc02ba38e434849248f87554/1200w.png"
table Transform3D (
"attr.rust.archetype_eager",
"attr.cpp.archetype_eager",
"attr.docs.category": "Spatial 3D",
"attr.docs.view_types": "Spatial3DView, Spatial2DView: if logged above active projection",
"attr.rerun.log_missing_as_empty", // See https://github.com/rerun-io/rerun/issues/6909
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ namespace rerun.blueprint.archetypes;

/// Configuration for the background of a view.
table Background (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.python.aliases": "datatypes.Rgba32Like, blueprint_components.BackgroundKindLike",
"attr.rerun.scope": "blueprint",
"attr.rust.archetype_eager"
"attr.rerun.scope": "blueprint"
) {
// --- Required ---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace rerun.blueprint.archetypes;
/// The description of a container.
table ContainerBlueprint (
"attr.rerun.scope": "blueprint",
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rust.archetype_native"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace rerun.blueprint.archetypes;

/// The query for the dataframe view.
table DataframeQuery (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace rerun.blueprint.archetypes;

/// Tries to move the center of mass of the graph to the origin.
struct ForceCenter (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace rerun.blueprint.archetypes;

/// Resolves collisions between the bounding circles, according to the radius of the nodes.
struct ForceCollisionRadius (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace rerun.blueprint.archetypes;

/// Aims to achieve a target distance between two nodes that are connected by an edge.
struct ForceLink (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace rerun.blueprint.archetypes;
///
/// If `strength` is smaller than 0, it pushes nodes apart, if it is larger than 0 it pulls them together.
struct ForceManyBody (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace rerun.blueprint.archetypes;

/// Similar to gravity, this force pulls nodes towards a specific position.
struct ForcePosition (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace rerun.blueprint.archetypes;

/// Configuration for the 3D line grid.
table LineGrid3D (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace rerun.blueprint.archetypes;

/// Configuration for the background map of the map view.
table MapBackground (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint",
"attr.python.aliases": "blueprint_components.MapProviderLike"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace rerun.blueprint.archetypes;
/// Configuration of the map view zoom level.
//TODO(ab): Turn this archetype into `MapArea` and include a `center: LatLon` componnent or similar
table MapZoom (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint",
"attr.python.aliases": "datatypes.Float64Like"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace rerun.blueprint.archetypes;

/// Controls the distance to the near clip plane in 3D scene units.
table NearClipPlane (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace rerun.blueprint.archetypes;

/// Shared state for the 3 collapsible panels.
table PanelBlueprint (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace rerun.blueprint.archetypes;

/// Configuration for the legend of a plot.
table PlotLegend (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace rerun.blueprint.archetypes;

/// Configuration for the scalar axis of a plot.
table ScalarAxis (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace rerun.blueprint.archetypes;

/// Configures how tensor scalars are mapped to color.
table TensorScalarMapping (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace rerun.blueprint.archetypes;

/// Specifies a 2D slice of a tensor.
table TensorSliceSelection (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace rerun.blueprint.archetypes;

/// Configures how a selected tensor slice is shown on screen.
table TensorViewFit (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace rerun.blueprint.archetypes;

/// The description of a single view.
table ViewBlueprint (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace rerun.blueprint.archetypes;
/// The last rule matching `/world` is `- /world`, so it is excluded.
/// The last rule matching `/world/house` is `+ /world/**`, so it is included.
table ViewContents (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace rerun.blueprint.archetypes;

/// The top-level description of the viewport.
table ViewportBlueprint (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace rerun.blueprint.archetypes;
/// - For time series views, the default is to show the entire timeline.
/// - For any other view, the default is to apply latest-at semantics.
table VisibleTimeRanges (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace rerun.blueprint.archetypes;
/// If no visual bounds are set, it will be determined automatically,
/// based on the bounding-box of the data or other camera information present in the view.
table VisualBounds2D (
"attr.cpp.archetype_eager",
"attr.rust.archetype_eager",
"attr.rerun.scope": "blueprint"
) {
Expand Down
Loading

0 comments on commit b690802

Please sign in to comment.