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

Example of how to embed the Rerun Viewer inside your own GUI (+ ergonomic improvements) #2250

Merged
merged 25 commits into from May 29, 2023

Conversation

emilk
Copy link
Member

@emilk emilk commented May 29, 2023

Closes #2243

What

Add an example showing how to wrap the Rerun Viewer in your own GUI, using eframe and egui.

This example can be useful for anyone who wants to extend the viewer with their own controls and widgets. The example shows how to read from the data store.

Analytics are supported but is an opt-in feature in the example Cargo.toml.

I created a re_crash_handler crate so that the example can get useful info on panics and signals, and have them sent to rerun if they enable analytics.

Only works on main (not on 0.6.0).

image

TODO

Checklist

PR Build Summary: https://build.rerun.io/pr/2250

@emilk emilk added ui concerns graphical user interface examples Issues relating to the Rerun examples labels May 29, 2023
@emilk emilk marked this pull request as ready for review May 29, 2023 14:48
@Wumpf Wumpf self-requested a review May 29, 2023 14:57
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your title & description isn't doing the many small improvements you got in here justice :)

crates/re_data_ui/src/component.rs Outdated Show resolved Hide resolved
Comment on lines +12 to +13
# Turn on if you want to share analytics with Rerun (e.g. callstacks on crashes).
analytics = ["re_crash_handler/analytics", "re_viewer/analytics"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reckon this is opt-in since we want to force the user to make a conscious choice to have analytics that may include their own callstack? A bit unfortunate since this might make us miss a lot of analytics going forward 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, exactly. I'm not sure if we want to see a lot of analytics from unwrap()s in our users code though.

examples/rust/extend_viewer_ui/src/main.rs Outdated Show resolved Hide resolved
});
ui.separator();

if let Some(log_db) = self.rerun_app.log_db() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kinda out of scope, but if we'd expose the ViewerContext instead, we could do extra nice things like showing our data ui on on_hover 🤔

@emilk emilk changed the title Example of how to embed the Rerun Viewer inside your own GUI Example of how to embed the Rerun Viewer inside your own GUI (+ ergonomic improvements) May 29, 2023
@emilk emilk merged commit c138a8c into main May 29, 2023
17 checks passed
@emilk emilk deleted the emilk/extend-rerun-viewer-ui-example branch May 29, 2023 17:23
emilk added a commit that referenced this pull request Jun 15, 2023
…omic improvements) (#2250)

Closes #2243

Add an example showing how to wrap the Rerun Viewer in your own GUI,
using
[`eframe`](https://github.com/emilk/egui/tree/master/crates/eframe) and
[`egui`](https://github.com/emilk/egui).

This example can be useful for anyone who wants to extend the viewer
with their own controls and widgets. The example shows how to read from
the data store.

Analytics are supported but is an opt-in feature in the example
`Cargo.toml`.

I created a `re_crash_handler` crate so that the example can get useful
info on panics and signals, and have them sent to rerun if they enable
analytics.

Only works on `main` (not on 0.6.0).

![image](https://github.com/rerun-io/rerun/assets/1148717/cbbad63e-9b18-4e54-bafe-b6ffd723f63e)

* [ ] Top-level docs at https://www.rerun.io/docs

* [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)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2250

---------

Co-authored-by: Andreas Reich <andreas@rerun.io>
This was referenced Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Issues relating to the Rerun examples ui concerns graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Example of custom egui app wrapping the Rerun Viewer
3 participants