Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpaceViewBlueprint is now python serializable #5401

Merged
merged 10 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions crates/re_data_ui/src/blueprint_data.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use re_types::blueprint::components::IncludedQueries;
use re_types::blueprint::components::IncludedQuery;
use re_viewer_context::{
BlueprintId, BlueprintIdRegistry, DataQueryId, UiVerbosity, ViewerContext,
};

use crate::{item_ui::entity_path_button_to, DataUi};

impl DataUi for IncludedQueries {
impl DataUi for IncludedQuery {
#[allow(clippy::only_used_in_recursion)]
fn data_ui(
&self,
Expand All @@ -15,18 +15,9 @@ impl DataUi for IncludedQueries {
query: &re_data_store::LatestAtQuery,
store: &re_data_store::DataStore,
) {
match verbosity {
UiVerbosity::Small => {
ui.label(format!("{} Queries", self.0.len()));
}
UiVerbosity::Full | UiVerbosity::LimitHeight | UiVerbosity::Reduced => {
for data_query in &self.0 {
let data_query: DataQueryId = (*data_query).into();
data_query.data_ui(_ctx, ui, verbosity, query, store);
ui.end_row();
}
}
}
let data_query: DataQueryId = self.0.into();
data_query.data_ui(_ctx, ui, verbosity, query, store);
ui.end_row();
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/re_data_ui/src/component_ui_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn create_component_ui_registry() -> ComponentUiRegistry {
add_to_registry::<re_types::components::OutOfTreeTransform3D>(&mut registry);
add_to_registry::<re_types::components::ViewCoordinates>(&mut registry);

add_to_registry::<re_types::blueprint::components::IncludedQueries>(&mut registry);
add_to_registry::<re_types::blueprint::components::IncludedQuery>(&mut registry);

register_editors(&mut registry);

Expand Down

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

3 changes: 1 addition & 2 deletions crates/re_space_view/src/space_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ impl SpaceViewBlueprint {

let queries = contents
.unwrap_or_default()
.0
.into_iter()
.map(DataQueryId::from)
.map(|included| DataQueryId::from(included.0))
.filter_map(|id| {
DataQueryBlueprint::try_from_db(id, blueprint_db, query, class_identifier)
})
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/definitions/rerun/blueprint.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ include "./blueprint/components/container_kind.fbs";
include "./blueprint/components/entities_determined_by_user.fbs";
include "./blueprint/components/entity_properties_component.fbs";
include "./blueprint/components/grid_columns.fbs";
include "./blueprint/components/included_query.fbs";
include "./blueprint/components/included_content.fbs";
include "./blueprint/components/included_queries.fbs";
include "./blueprint/components/included_space_view.fbs";
include "./blueprint/components/panel_view.fbs";
include "./blueprint/components/query_expressions.fbs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ namespace rerun.blueprint.archetypes;

/// The top-level description of the Viewport.
table SpaceViewBlueprint (
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default"
"attr.rerun.scope": "blueprint"
) {
// --- Required ---

Expand All @@ -27,15 +26,15 @@ table SpaceViewBlueprint (
/// The transform at this path forms the reference point for all scene->world transforms in this space view.
/// I.e. the position of this entity path in space forms the origin of the coordinate system in this space view.
/// Furthermore, this is the primary indicator for heuristics on what entities we show in this space view.
space_origin: rerun.blueprint.components.SpaceViewOrigin ("attr.rerun.component_optional", nullable, order: 300);
space_origin: rerun.blueprint.components.SpaceViewOrigin ("attr.rerun.component_optional", nullable, order: 300);

/// True if the user is has added entities themselves. False otherwise.
entities_determined_by_user: rerun.blueprint.components.EntitiesDeterminedByUser ("attr.rerun.component_optional", nullable, order: 400);

/// `BlueprintId`s of the `DataQuery`s that make up this `SpaceView`.
/// Ids of the `DataQuery`s that make up this `SpaceView`.
///
/// It determines which entities are part of the spaceview.
contents: rerun.blueprint.components.IncludedQueries ("attr.rerun.component_optional", nullable, order: 500);
/// They determine which entities are part of the spaceview.
contents: [rerun.blueprint.components.IncludedQuery] ("attr.rerun.component_optional", nullable, order: 500);

/// Whether this space view is visible.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct AutoSpaceViews (
"attr.arrow.transparent",
"attr.rerun.scope": "blueprint",
"attr.python.aliases": "bool",
"attr.rust.derive": "Copy, Default",
"attr.rust.derive": "Copy, Default, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.override_crate": "re_viewport",
"attr.rust.repr": "transparent",
"attr.rust.tuple_struct"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace rerun.blueprint.components;
table EntitiesDeterminedByUser (
"attr.arrow.transparent",
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord",
"attr.python.aliases": "bool",
"attr.rust.derive": "Copy, Default, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.repr": "transparent",
"attr.rust.tuple_struct"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ namespace rerun.blueprint.components;
// ---


/// All the queries belonging to a given `SpaceView`.
/// Each query id refers to a `QueryExpression` component.
///
/// Unstable. Used for the ongoing blueprint experimentations.
table IncludedQueries (
table IncludedQuery (
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default",
"attr.rust.repr": "transparent"
) {
query_ids: [rerun.datatypes.Uuid] (order: 100);
query_id: rerun.datatypes.Uuid (order: 100);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace rerun.blueprint.components;
/// (`/world/**` matches both `/world` and `/world/car/driver`).
/// Other uses of `*` are not (yet) supported.
///
/// `EntityPathFilter` sorts the rule by entity path, with recursive coming before non-recursive.
/// Internally, `EntityPathFilter` sorts the rule by entity path, with recursive coming before non-recursive.
/// This means the last matching rule is also the most specific one.
/// For instance:
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ namespace rerun.blueprint.components;

/// The class of a `SpaceView`.
table SpaceViewClass (
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.repr": "transparent"
"attr.arrow.transparent",
"attr.rerun.scope": "blueprint",
"attr.python.aliases": "str",
"attr.rust.derive": "PartialEq, Eq, PartialOrd, Ord",
"attr.rust.repr": "transparent"
) {
value: string (order: 100);
value: rerun.datatypes.Utf8 (order: 100);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ namespace rerun.blueprint.components;

/// The origin of a `SpaceView`.
table SpaceViewOrigin (
"attr.arrow.transparent",
"attr.rerun.scope": "blueprint",
"attr.python.aliases": "str",
"attr.rust.derive": "PartialEq, Eq, PartialOrd, Ord",
"attr.rust.repr": "transparent"
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace rerun.blueprint.components;

/// Whether the container, space view, entity or instance is currently visible.
struct Visible (
"attr.arrow.transparent",
"attr.rerun.scope": "blueprint",
"attr.python.aliases": "bool",
"attr.rust.derive": "Copy, PartialEq, Eq",
"attr.rust.repr": "transparent",
"attr.rust.tuple_struct"
"attr.arrow.transparent",
"attr.rerun.scope": "blueprint",
"attr.python.aliases": "bool",
"attr.rust.derive": "Copy, Default, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.repr": "transparent",
"attr.rust.tuple_struct"
) {
visible: bool (order: 100);
visible: bool (order: 100);
}
35 changes: 19 additions & 16 deletions crates/re_types/src/blueprint/archetypes/space_view_blueprint.rs

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

2 changes: 1 addition & 1 deletion crates/re_types/src/blueprint/components/.gitattributes

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.

Loading
Loading