forked from rerun-io/rerun
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
{Viewport, SpaceView, Container}Blueprint
to new `re_viewport_…
…blueprint` crate (rerun-io#6405) ### What - Closes rerun-io#5421 - Unlocks rerun-io#6414 - Unlocks rerun-io#6415 This enable more general access to manipulating the blueprint and unlock further crate splitting. ![](https://static.rerun.io/crates/f0024a424aa35efab710ae88ba6a1ed741e7c248/1200w.png) ### TODO - [x] delete the traits in `data_query.rs` and use concrete types instead - [x] move the UI function introduced by Andreas back to `re_space_view` ### 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 examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/6405?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/6405?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 * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/6405) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`.
- Loading branch information
Showing
47 changed files
with
323 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ _deps | |
__pycache__ | ||
*.pyc | ||
*.so | ||
**/.pytest_cache | ||
|
||
# Pixi environment | ||
.pixi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
use re_types_core::Archetype; | ||
use re_ui::list_item; | ||
use re_viewer_context::{SpaceViewId, ViewerContext}; | ||
use re_viewport_blueprint::entity_path_for_view_property; | ||
|
||
/// Display the UI for editing all components of a blueprint archetype. | ||
/// | ||
/// Note that this will show default values for components that are null. | ||
pub fn view_property_ui<A: Archetype>( | ||
ctx: &ViewerContext<'_>, | ||
space_view_id: SpaceViewId, | ||
ui: &mut egui::Ui, | ||
) { | ||
let blueprint_db = ctx.store_context.blueprint; | ||
let blueprint_query = ctx.blueprint_query; | ||
let blueprint_path = entity_path_for_view_property::<A>(space_view_id, blueprint_db.tree()); | ||
|
||
let component_names = A::all_components(); | ||
let component_results = blueprint_db.latest_at( | ||
blueprint_query, | ||
&blueprint_path, | ||
component_names.iter().copied(), | ||
); | ||
|
||
let sub_prop_ui = |re_ui: &re_ui::ReUi, ui: &mut egui::Ui| { | ||
for component_name in component_names.as_ref() { | ||
if component_name.is_indicator_component() { | ||
continue; | ||
} | ||
|
||
list_item::ListItem::new(re_ui) | ||
.interactive(false) | ||
.show_flat( | ||
ui, | ||
// TODO(andreas): Note that we loose the archetype's field name here, instead we label the item with the component name. | ||
list_item::PropertyContent::new(component_name.short_name()).value_fn( | ||
|_, ui, _| { | ||
ctx.component_ui_registry.edit_ui( | ||
ctx, | ||
ui, | ||
re_viewer_context::UiLayout::List, | ||
blueprint_query, | ||
blueprint_db, | ||
&blueprint_path, | ||
&blueprint_path, | ||
component_results.get_or_empty(*component_name), | ||
component_name, | ||
&0.into(), | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
}; | ||
|
||
list_item::ListItem::new(ctx.re_ui) | ||
.interactive(false) | ||
.show_hierarchical_with_children( | ||
ui, | ||
A::name().full_name(), | ||
true, | ||
list_item::LabelContent::new(A::name().short_name()), | ||
sub_prop_ui, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.