Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow setting view status from json string #6241

Merged
merged 1 commit into from
Jul 7, 2023
Merged

Conversation

yxlao
Copy link
Collaborator

@yxlao yxlao commented Jun 30, 2023

This PR allows setting view status from a json string. This allows setting the visualizer to the exact same view points.

Example usage:

  1. Launch the Open3D visualizer (legacy)
  2. Press ctrl+c to copy the view status as a json string
  3. As an example, in a new visualizer, you can use the following code to set the view status
    vis = o3d.visualization.Visualizer()
    vis.create_window()
    vis.add_geometry(mesh)
    vis.update_geometry(mesh)
    vis.set_view_status(view_status_str)  # view_status_str is the json string
    vis.poll_events()
    vis.update_renderer()
    buffer = vis.capture_screen_float_buffer()
    vis.destroy_window()

Changes:

  • Visualizer::CopyViewStatusToClipboard(): unchanged
  • Visualizer::CopyViewStatusFromClipboard(): unchanged
  • Visualizer::GetViewStatus(): added
  • SetViewStatus(const std::string &view_status_str): added

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

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.
    • (N/A) Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • (N/A) 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


This change is Reviewable

@update-docs
Copy link

update-docs bot commented Jun 30, 2023

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

@yxlao yxlao requested a review from ssheorey June 30, 2023 14:59
@ssheorey ssheorey requested a review from errissa June 30, 2023 15:32
@ssheorey ssheorey merged commit 5676513 into master Jul 7, 2023
@ssheorey ssheorey deleted the yixing/set-view-status branch July 7, 2023 05:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants