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

Double-clicking an entity in the blueprint & time panels focuses the 3D camera on it #4799

Merged
merged 15 commits into from
Jan 16, 2024

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Jan 12, 2024

What

This PR introduces on-the-fly determined per-entity bounding boxes and unifies a lot of behavior under the hood: A double click of a hovered item (pretty much everywhere) causes now a "focused" event for that item. Focuses are right now set on the viewer context for a single frame, so each part of the viewer can react on it as it pleases. The 3D Space view reacts by focusing the camera on the entity (using the new bounding box) and tracks cameras.
Tracking of entities has been unified - originally this PR tracked entities as well, but I found this a bit too confusing for this action, we should instead have something more explicit (this was disabled in 86ddf0d so it's easy to get it back).

Screen.Recording.2024-01-12.at.16.05.53.mov

Tradeoffs:

  • can't focus on instances
    -> before focused on 3D positions (without knowing anything about the object under it) now focusing on entities; different behavior, sometimes worse, sometimes better
    -> note that tracking an instance rarely what you want here (e.g. point instance ids vary widely)
  • tracking an entity is not always what you want -> disabled it
    • it's very hard to tell that we're tracking something, can sometimes be surprising
  • Alternative design of focus: Send a focus event to space views that should be interested in it. This makes would unify the dispatching code for this which is nicer going forward. But for the moment it was just a lot easier to implement it the way I did. I'm fairly sure though about making focus not sticky in the global state since this way we'd end up with two levels of selection.

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

@Wumpf Wumpf added enhancement New feature or request 📺 re_viewer affects re_viewer itself include in changelog labels Jan 12, 2024
@emilk emilk self-requested a review January 15, 2024 10:10
crates/re_space_view_spatial/src/scene_bounding_boxes.rs Outdated Show resolved Hide resolved
crates/re_space_view_spatial/src/ui_3d.rs Outdated Show resolved Hide resolved
crates/re_space_view_spatial/src/ui_3d.rs Outdated Show resolved Hide resolved
crates/re_space_view_spatial/src/ui_3d.rs Outdated Show resolved Hide resolved
crates/re_space_view_spatial/src/ui_3d.rs Outdated Show resolved Hide resolved
crates/re_space_view_spatial/src/ui_3d.rs Outdated Show resolved Hide resolved
crates/re_space_view_spatial/src/ui_3d.rs Outdated Show resolved Hide resolved
crates/re_space_view_spatial/src/ui_3d.rs Outdated Show resolved Hide resolved
crates/re_viewer_context/src/selection_state.rs Outdated Show resolved Hide resolved
@Wumpf Wumpf added the do-not-merge Do not merge this PR label Jan 15, 2024
@Wumpf
Copy link
Member Author

Wumpf commented Jan 15, 2024

when testing one last time on the web I found that camera tracking lags behind, so this regressed

@emilk
Copy link
Member

emilk commented Jan 15, 2024

I think you should also try a scene with a lot of entities to see that perf hasn't regressed

@Wumpf
Copy link
Member Author

Wumpf commented Jan 16, 2024

added a primitive benchmark that adds lots of entitites. No measurable regression, but it's shocking how few entities we can handle

@Wumpf Wumpf removed the do-not-merge Do not merge this PR label Jan 16, 2024
@Wumpf Wumpf merged commit 1989951 into main Jan 16, 2024
40 of 42 checks passed
@Wumpf Wumpf deleted the andreas/spatial-object-focus branch January 16, 2024 14:24
@teh-cmc teh-cmc changed the title Double click on entity in blueprint & timepanel focuses camera on it in 3D space views Double-clicking an entity in the blueprint & time panels focuses the 3D camera on it Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request include in changelog 📺 re_viewer affects re_viewer itself
Projects
None yet
2 participants