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

Add O3DVisualizer API to enable collapse control of verts in the side panel #6865

Merged
merged 6 commits into from
Jul 25, 2024

Conversation

EwingKang
Copy link
Contributor

Add API SetCollapsableVertOpen to control the toggling of the verts in the side panel

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes #
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

When we have start the viewer with side panel ("show settings"), the default toggle vert (pane) in the side panel defaults to ON for the "Mouse Controls" and "Scene", but no "Lighting". These default on panels took a lot of space and I find myself always collapsing the settings since I mostly want to control the visibility of objects in "Geometries". This becomes quite annoying very soon.

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

Before: Side vert "Mouse Controls" and "Scene" always defaults to ON

Screenshot from 2024-07-10 11-44-12

After The displayed result after calling the new API

O3DVisualizer::SetCollapsableVertOpen("Mouse Controls", false);

Screenshot from 2024-07-11 09-59-02

* Add API SetCollapsableVertOpen to control the toggling of the verts in the side panel
Copy link

update-docs bot commented Jul 11, 2024

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

@EwingKang EwingKang changed the title Add O3DVisualizer API to enable collapse control of verts in side panel Add O3DVisualizer API to enable collapse control of verts in the side panel Jul 11, 2024
Copy link
Member

@ssheorey ssheorey left a comment

Choose a reason for hiding this comment

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

Hi @EwingKang thanks for this PR.

One suggestion to simplify this is to addCollapsableVert::GetText() in Layout.cpp. This way, there is no need to store the text -> pointer map. You can instead iterate through all the children of the vert panel and just match the text.

Also, please add python bindings.

@EwingKang
Copy link
Contributor Author

EwingKang commented Jul 18, 2024

Hi @ssheorey
Thanks for your reply. I'll add the Python bindings (not sure how to do that exactly, but I'll try)
Also, adding CollapsableVert::GetText() in Layout.cpp is not a problem.

However, for the pointers suggestion, do you suggest having a std::vector<CollapsableVert *> instead of a map here? Does that mean the removal of CollapsableVert *mouse_panel, CollapsableVert *scene_panel, CollapsableVert *light_panel, and CollapsableVert *geometries_panel?
The upside is the simplification of members. We'll only have one pointer per object.
The downside is the increasing difficulties of using the object and slower speed if there are a lot of panels. For example, if someone wants to use geometries_panel within the O3DVisualizer.cpp, they would now have to find the pointer to that CollapsableVert * through the same look API with a key string. The API would have O(N) instead of O(logN). Of course, the former might still be faster, considering we have only 4 panels now.

@EwingKang
Copy link
Contributor Author

Add GetText() and SetText() to CollapsableVert
Here are some test screenshots of setting the text (the "hahahaha#" was originally "Advanced lighting")
Screenshot from 2024-07-18 10-28-43
Screenshot from 2024-07-18 10-28-47

@EwingKang EwingKang force-pushed the collapsable_toggle branch from c7106d7 to 284cd2c Compare July 18, 2024 06:46
@EwingKang EwingKang force-pushed the collapsable_toggle branch from 284cd2c to e965381 Compare July 18, 2024 08:16
Copy link
Member

@ssheorey ssheorey left a comment

Choose a reason for hiding this comment

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

Looks good after a few minor updates. Thanks @EwingKang

cpp/open3d/visualization/visualizer/O3DVisualizer.cpp Outdated Show resolved Hide resolved
cpp/open3d/visualization/visualizer/O3DVisualizer.h Outdated Show resolved Hide resolved
cpp/pybind/visualization/o3dvisualizer.cpp Outdated Show resolved Hide resolved
Copy link
Member

@ssheorey ssheorey left a comment

Choose a reason for hiding this comment

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

Thanks @EwingKang Looks good!

@ssheorey ssheorey merged commit 78e4bfd into isl-org:main Jul 25, 2024
36 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants