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

Space view traitification & custom space view plugins #2249

Closed
6 tasks done
Wumpf opened this issue May 29, 2023 · 0 comments
Closed
6 tasks done

Space view traitification & custom space view plugins #2249

Wumpf opened this issue May 29, 2023 · 0 comments
Assignees
Labels
📺 re_viewer affects re_viewer itself

Comments

@Wumpf
Copy link
Member

Wumpf commented May 29, 2023

Part of more general re_viewer refactor (#1873).

Overview

We want to move towards strongly typed space views that are determined upon creation.

Each SpaceViewType should implement a trait that:

  • exposes types that are stored in the blueprint (a trait impl may have additional "ephermeral" state, but that state is not serialized!)
  • handles ui interaction
  • provide list of SceneElement (new!)
  • setup re_renderer viewbuilder internally and return ready command buffer to user
  • type name, type icon, help text...

SceneElement is essentially what we refer to as ScenePart so far.
It defines how a single specified archetype is displayed. It can do so by implementing a ui method (which operates on an egui::Ui instance) and/or by returning one or more re_renderer::DrawData.
Concept of archetypes is being introduced as part of

By defining a list of SceneElements the trait can provide a list of archetypes!
TODO: This list is probably just internal to the traits internal framework, to the outside we only need a list of archetypes!

Note that any SpaceViewState

Space view types are fixed upon creation, obsoleting

This also replaces the notion of SpaceViewCategory which in this world is dynamically controlled via archetypes. Thus formalizing https://www.rerun.io/docs/reference/viewer/viewport

Sidenote: 2D & 3D space views should be separate type again (with plenty of code sharing though). Removing the "nav mode" again

New crates

  • re_viewport, the place where we lay out all the space views. Currently often-times inaccurately to as the blueprint. It also brokers potential state sharing between space views etc..
  • re_spaceview, the framework & utilities for defining spaceviews goes to a new crate re_spaceview. re_viewport knows only about the interfaces defined there.
  • re_builtin_spaceviews, all built-in ("first party") space views that we have today. Apart from type registry, nothing in the viewer should know about the particular space view types.

With this system it should be fairly easy to provide a native example that registers a custom space view type. We should add a Rust demo doing so!

Checklist

  • re_viewport
  • re_spaceview
    • SceneElement
    • ...
  • traitify existing space views
  • custom plugin demo

Some open questions

  • can we make good separations between ui, query and re_renderer bridge?
    • it would be desirable to have "pure" crates & trait-impls. But on the flip side it may be much easier to have all these things defined by a single trait
  • better name for SceneElement?
  • ...
@Wumpf Wumpf added the 📺 re_viewer affects re_viewer itself label May 29, 2023
Wumpf added a commit that referenced this issue May 29, 2023
…ort crate (#2251)

<!--
Open the PR up as a draft until you feel it is ready for a proper
review.

Do not make PR:s from your own `main` branch, as that makes it difficult
for reviewers to add their own fixes.

Add any improvements to the branch as new commits to make it easier for
reviewers to follow the progress. All commits will be squashed to a
single commit once the PR is merged into `main`.

Make sure you mention any issues that this PR closes in the description,
as well as any other related issues.

To get an auto-generated PR description you can put "copilot:summary" or
"copilot:walkthrough" anywhere.
-->

### What

First step towards:
* #2249 

and getting close to finish of:
* #1873 

This PR moves almost everything viewport related out to a separate crate
that is eclipses the `re_viewer` package in size now. In upcoming steps
space view definition will be separated out of this new crate in turn.
Also, blueprint things will likely need a new home as well similar to
`re_log_types`. But one thing after the other :)

### 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)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2251
@Wumpf Wumpf self-assigned this May 30, 2023
Wumpf added a commit that referenced this issue May 31, 2023
…View trait system (#2281)

<!--
Open the PR up as a draft until you feel it is ready for a proper
review.

Do not make PR:s from your own `main` branch, as that makes it difficult
for reviewers to add their own fixes.

Add any improvements to the branch as new commits to make it easier for
reviewers to follow the progress. All commits will be squashed to a
single commit once the PR is merged into `main`.

Make sure you mention any issues that this PR closes in the description,
as well as any other related issues.

To get an auto-generated PR description you can put "copilot:summary" or
"copilot:walkthrough" anywhere.
-->

### What

Main pieces of:
* #2249 
* #1873 

Introduces a new framework for space view classes that will eventually
replace `ViewCategory` (right now the systems live side by side,
creating some oddities).
Ports text & text-box space views to this new system.

### Why

This paves the way for more structured space views, more streamlined
blueprint configuration and user defined space views.
In fact, this PR already enables user defined space views, but does not
yet expose a way to add them to the viewport (this can be done with some
small hacks to the space view adding code though and works very well!)

### Future work / discussion

There is still a lot of open question on the space view trait and it
will require changes as we move the other space views over to it.

Most notably, archetypes are defined by have no effect yet!
Overall, scene definition can be regarded as experimental at this point.
I chose to have a hard separation of `SceneElement` (the successor of
`ScenePart`) in the hope of providing a more powerful framework and an
easy hook for future parallelization. We'll need to see how this pans
out though!

Unlike planned, the definition of the space view class trait (as well as
implementation utilities) are not in a separate crate, but part of the
viewer context since global access to the space view type registry
proved very valuable.
We could still separate some parts of it out if desirable, but this
seems not very important at the moment.

### 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)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2281
Wumpf added a commit that referenced this issue Jun 8, 2023
<!--
Open the PR up as a draft until you feel it is ready for a proper
review.

Do not make PR:s from your own `main` branch, as that makes it difficult
for reviewers to add their own fixes.

Add any improvements to the branch as new commits to make it easier for
reviewers to follow the progress. All commits will be squashed to a
single commit once the PR is merged into `main`.

Make sure you mention any issues that this PR closes in the description,
as well as any other related issues.

To get an auto-generated PR description you can put "copilot:summary" or
"copilot:walkthrough" anywhere.
-->

### What

Adds an example for custom Space Views.


https://github.com/rerun-io/rerun/assets/1220815/50033dfd-fdba-44b6-9b6d-ad4a1071ccd6

Simplified handling of empty context & empty state.

Significant part of #2249 
* #2249 

### 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)

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

<!-- pr-link-docs:start -->
Docs preview: https://rerun.io/preview/33ca881/docs
Examples preview: https://rerun.io/preview/33ca881/examples
<!-- pr-link-docs:end -->
emilk pushed a commit that referenced this issue Jun 9, 2023
<!--
Open the PR up as a draft until you feel it is ready for a proper
review.

Do not make PR:s from your own `main` branch, as that makes it difficult
for reviewers to add their own fixes.

Add any improvements to the branch as new commits to make it easier for
reviewers to follow the progress. All commits will be squashed to a
single commit once the PR is merged into `main`.

Make sure you mention any issues that this PR closes in the description,
as well as any other related issues.

To get an auto-generated PR description you can put "copilot:summary" or
"copilot:walkthrough" anywhere.
-->

### What

Moves the last Space View to the new Space View framework and a separate
crate.
One of the last pieces of #2249 

Detangles viewport from all concrete Space Views:
`cargo depgraph --all-deps --workspace-only --all-features
--dedup-transitive-deps | dot -Tpng > deps.png`

![deps](https://github.com/rerun-io/rerun/assets/1220815/c5996f26-fd31-461b-9043-484ec2fb7637)


### 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)

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

<!-- pr-link-docs:start -->
Docs preview: https://rerun.io/preview/89dd232/docs
Examples preview: https://rerun.io/preview/89dd232/examples
<!-- pr-link-docs:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📺 re_viewer affects re_viewer itself
Projects
None yet
Development

No branches or pull requests

2 participants