Skip to content

Commit

Permalink
Add a stub Dataframe view blueprint and improve the generated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Sep 25, 2024
1 parent 14ff694 commit b4e274d
Show file tree
Hide file tree
Showing 45 changed files with 279 additions and 14 deletions.
40 changes: 26 additions & 14 deletions crates/build/re_types_builder/src/codegen/docs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use crate::{
ATTR_DOCS_VIEW_TYPES,
};

pub const DATAFRAME_VIEW_FQNAME: &str = "rerun.blueprint.views.DataframeView";

macro_rules! putln {
($o:ident) => ( writeln!($o).ok() );
($o:ident, $($tt:tt)*) => ( writeln!($o, $($tt)*).ok() );
Expand Down Expand Up @@ -574,9 +576,10 @@ fn write_archetype_fields(
putln!(page, "**Optional**: {}", optional.join(", "));
}

putln!(page);
putln!(page, "## Shown in");

if let Some(view_types) = view_per_archetype.get(&object.fqname) {
putln!(page);
putln!(page, "## Shown in");
for ViewReference {
view_name,
explanation,
Expand All @@ -592,6 +595,9 @@ fn write_archetype_fields(
putln!(page);
}
}

// Special case for dataframe view: it can display anything.
putln!(page, "* [DataframeView](../views/dataframe_view.md)");
}

fn write_visualized_archetypes(
Expand All @@ -614,7 +620,7 @@ fn write_visualized_archetypes(
}
}

if archetype_fqnames.is_empty() {
if archetype_fqnames.is_empty() && view.fqname != DATAFRAME_VIEW_FQNAME {
reporter.error(&view.virtpath, &view.fqname, "No archetypes use this view.");
return;
}
Expand All @@ -624,18 +630,24 @@ fn write_visualized_archetypes(

putln!(page, "## Visualized archetypes");
putln!(page);
for (fqname, explanation) in archetype_fqnames {
let object = &objects[&fqname];
page.push_str(&format!(
"* [`{}`](../{}/{}.md)",
object.name,
object.kind.plural_snake_case(),
object.snake_case_name()
));
if let Some(explanation) = explanation {
page.push_str(&format!(" ({explanation})"));

// special case for dataframe view
if view.fqname == DATAFRAME_VIEW_FQNAME {
putln!(page, "Any data can be displayed by the Dataframe view.");
} else {
for (fqname, explanation) in archetype_fqnames {
let object = &objects[&fqname];
page.push_str(&format!(
"* [`{}`](../{}/{}.md)",
object.name,
object.kind.plural_snake_case(),
object.snake_case_name()
));
if let Some(explanation) = explanation {
page.push_str(&format!(" ({explanation})"));
}
putln!(page);
}
putln!(page);
}
putln!(page);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace rerun.blueprint.views;

/// A view to display any data in a tabular form.
///
/// \example views/dataframe title="Use a blueprint to customize a DataframeView."
//TODO(#6896): add a thumbnail when the example becomes interesting
table DataframeView (
"attr.rerun.view_identifier": "Dataframe"
) {
/// Query of the dataframe.
//TODO(#6896): this will be enabled in a later PR in the chain
//query: rerun.blueprint.archetypes.DataframeQueryV2 (order: 1000);
}
1 change: 1 addition & 0 deletions crates/store/re_types/src/blueprint/views/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions crates/store/re_types/src/blueprint/views/dataframe_view.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/store/re_types/src/blueprint/views/mod.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/arrows2d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/arrows3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/asset3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/content/reference/types/archetypes/asset_video.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/bar_chart.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/boxes2d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/boxes3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/clear.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/depth_image.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/ellipsoids3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/encoded_image.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/image.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/line_strips2d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/line_strips3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/mesh3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/pinhole.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/points2d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/points3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/scalar.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/series_line.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/series_point.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/tensor.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/text_document.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/text_log.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/transform3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b4e274d

Please sign in to comment.