Skip to content

Enable picking points from TriangleMeshModels in O3D Visualizer - #5978

Merged
ssheorey merged 3 commits into
masterfrom
errissa/fix-model-point-selection
Mar 8, 2023
Merged

ssheorey merged 3 commits into
masterfrom
errissa/fix-model-point-selection

Conversation

@errissa

@errissa errissa commented Mar 8, 2023 •

Copy link
Copy Markdown
Collaborator

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

update-docs Bot commented Mar 8, 2023

Copy link
Copy Markdown

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

@ssheorey ssheorey left a comment •

Copy link
Copy Markdown
Member

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

ssheorey commented Mar 8, 2023

Copy link
Copy Markdown
Member

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