Skip to content

Commit

Permalink
Persist Auto vs Columns for Grid into the Blueprint (#4686)
Browse files Browse the repository at this point in the history
### What
 - Resolves: #4685

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/4686/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/4686/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/4686/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4686)
- [Docs
preview](https://rerun.io/preview/eeab9f0740e014ab7be07368b97a842eabf0359e/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/eeab9f0740e014ab7be07368b97a842eabf0359e/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
  • Loading branch information
jleibs committed Jan 5, 2024
1 parent f873bf3 commit 85350d4
Show file tree
Hide file tree
Showing 19 changed files with 521 additions and 10 deletions.
1 change: 1 addition & 0 deletions crates/re_types/definitions/rerun/blueprint.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include "./blueprint/components/auto_space_views.fbs";
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_contents.fbs";
include "./blueprint/components/included_queries.fbs";
include "./blueprint/components/included_space_views.fbs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ table ContainerBlueprint (
/// For `Horizontal`/`Vertical` containers, the length of this list should always match the number of contents.
primary_weights: rerun.blueprint.components.PrimaryWeights ("attr.rerun.component_optional", nullable, order: 400);

/// The weights of the secondary axis. For `Grid` this is the row weights. Ignored for `Horizontal`/`Vertical` containers.
/// The weights of the secondary axis. For `Grid` this is the row weights.
///
/// Ignored for `Horizontal`/`Vertical` containers.
secondary_weights: rerun.blueprint.components.SecondaryWeights ("attr.rerun.component_optional", nullable, order: 500);

/// Which tab is active.
Expand All @@ -44,4 +46,11 @@ table ContainerBlueprint (
///
/// Defaults to true if not specified.
visible: rerun.blueprint.components.Visible ("attr.rerun.component_optional", nullable, order: 700);

/// How many columns this grid should have.
///
/// If unset, the grid layout will be auto.
///
/// Ignored for `Horizontal`/`Vertical` containers.
grid_columns: rerun.blueprint.components.GridColumns ("attr.rerun.component_optional", nullable, order: 800);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include "arrow/attributes.fbs";
include "python/attributes.fbs";
include "rust/attributes.fbs";

include "rerun/datatypes.fbs";
include "rerun/attributes.fbs";

namespace rerun.blueprint.components;


/// How many columns a grid container should have.
table GridColumns (
"attr.rerun.scope": "blueprint",
"attr.docs.unreleased",
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.override_crate": "re_viewport"
) {
/// The number of columns.
columns: uint (order: 100);
}
6 changes: 6 additions & 0 deletions crates/re_viewer/src/ui/selection_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ fn container_top_level_properties(
}
}

let original_layout = grid.layout;

egui::ComboBox::from_id_source("container_grid_columns")
.selected_text(grid_layout_to_string(&grid.layout))
.show_ui(ui, |ui| {
Expand All @@ -559,6 +561,10 @@ fn container_top_level_properties(
}
});

// TODO(jleibs): Manually marking edited like this is way too error prone.
// Need to detect this in a better way.
viewport.edited |= original_layout != grid.layout;

ui.end_row();
}

Expand Down
43 changes: 39 additions & 4 deletions crates/re_viewport/src/blueprint/archetypes/container_blueprint.rs

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

1 change: 1 addition & 0 deletions crates/re_viewport/src/blueprint/components/.gitattributes

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

155 changes: 155 additions & 0 deletions crates/re_viewport/src/blueprint/components/grid_columns.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/re_viewport/src/blueprint/components/mod.rs

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

Loading

0 comments on commit 85350d4

Please sign in to comment.