how to use animation callbacks with o3d.visualization.draw()?
- Dominant language
- C++
- Stars
- 14k
- Forks
- 2.6k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 6
Description
### Checklist
- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).
### My Question
I am trying to structure a visualization loop for my application. All the various `draw...()` functions seem to support different subsets of features. I need an animation callback, and key callbacks, and to specify a camera view (eg with lookat, eye, up).
Then in this 2020 [comment](https://github.com/isl-org/Open3D/issues/1885#issuecomment-748388278) I learned about [open3d.visualization.draw()](http://www.open3d.org/docs/latest/python_api/open3d.visualization.draw.html) which appears to be a generalization over all the visualization properties. Yay!
The doc for open3d.visualization.draw() is extremely terse, just a list of the allowable parameters. As mentioned in that comment, the [source](https://github.com/isl-org/Open3D/blob/a5be78cfe3da627ce6a38a7905e3e5cd6a64d811/python/open3d/visualization/draw.py) adds some detail, but not for example: how do I use an animation callback? While there are two seemingly relevant parameters, I could not get them to work. For example, here is a callback that recolors a mesh:
import numpy as np
import open3d as o3d
mesh = o3d.geometry.TriangleMesh.create_octahedron()
def recolor(vis):
mesh.paint_uniform_color(np.random.rand(3))
vis.update_geometry(mesh)
return False
It works using `draw_geometries_with_animation_callback()`:
o3d.visualization.draw_geometries_with_animation_callback([mesh], recolor)
but neither of those `draw()` parameters mentioning “animation” seem to do anything:
o3d.visualization.draw([mesh], on_animation_frame=recolor)
o3d.visualization.draw([mesh], on_animation_tick=recolor)
Good chance that my callback is incorrect, but where can I learn how to do it correctly?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.