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

Enable picking points from TriangleMeshModels in O3D Visualizer #5978

Merged
merged 3 commits into from
Mar 8, 2023

Conversation

errissa
Copy link
Collaborator

@errissa errissa commented Mar 8, 2023

Description

Add ability to select points from a TriangleMeshModel in O3D Visualizer (e.g., draw.py). Previously, attempting to do so caused a crash with a cryptic message.

The following script demonstrates the new capability:

import open3d as o3d
monkey = o3d.data.MonkeyModel()
m = o3d.io.read_triangle_model(monkey.path)
o3d.visualization.draw(m, show_ui=True, actions=[["Print selection", lambda o3dvis: print(o3dvis.get_selection_sets())]])

Output:

[Open3D WARNING] Geometry Object 1 has already been added to scene graph.
[{'Object 1': {{ index: 47335, order: 5, point: (5.42036, -0.955666, -2.12278) }, { index: 49813, order: 3, point: (-1.15616, -0.0953989, -1.86053) }, { index: 53731, order: 4, point: (-0.625896, -0.964231, -6.8371) }, { index: 40037, order: 1, point: (-4.25987, -0.402343, -1.95247) }, { index: 57889, order: 2, point: (-4.27602, -0.404048, -1.47792) }, { index: 40561, order: 0, point: (-1.6692, -0.834914, -2.62355) }}}]

Select the "Selection" tab at the top right. Previously, selection the tab would cause a crash. Now, you can Ctrl-click to select points from the Monkey model.


This change is Reviewable

@update-docs
Copy link

update-docs bot commented Mar 8, 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.

@errissa errissa requested a review from ssheorey March 8, 2023 16:02
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. Tested with a different mesh and added output to PR description.

Question: Is the point index in the selection set a single index over all meshes? So to recover the index for a specific mesh, we would need the mesh number, right?

@ssheorey ssheorey added this to the v0.17 milestone Mar 8, 2023
@ssheorey
Copy link
Member

ssheorey commented Mar 8, 2023

Warning is gone. LGTM.

@ssheorey ssheorey merged commit 8869397 into master Mar 8, 2023
@ssheorey ssheorey deleted the errissa/fix-model-point-selection branch March 8, 2023 21:00
dbs4261 pushed a commit to dbs4261/Open3D that referenced this pull request Apr 13, 2023
…org#5978)

* Allow TriangleModel meshes to be selected
* Use mesh name instead of object name
# 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