Describe the bug
When I add a key using register_key_callback(key, callback), it doesn't work. Callback is not called when key is pressed. Also, the key encoding is not clear from the docs.
To Reproduce
import numpy as np
import open3d as o3d
def key_callback(vis):
print('key')
points = np.random.rand(100000, 3)
point_cloud = o3d.PointCloud()
point_cloud.points = o3d.Vector3dVector(points)
vis = o3d.visualization.VisualizerWithKeyCallback()
vis.create_window()
vis.add_geometry(point_cloud)
vis.register_key_callback(41, key_callback)
vis.run()
vis.destroy_window()
Expected behavior
When I press A, which should be keycode 41, I expect 'key' to be printed. Also, when running and I hit H, I can see that the key is not registered under:
Keys registered for callback functions --
[)]
The default functions of these keys will be overridden.
Environment (please complete the following information):
We are using GLFW_KEY for register_key_callback function. Based on this document, a is 65.
The following code should work out of the box (with Open3D 0.9):
import numpy as np
import open3d as o3d
def key_callback(vis):
print('key')
points = np.random.rand(100000, 3)
point_cloud = o3d.geometry.PointCloud()
point_cloud.points = o3d.utility.Vector3dVector(points)
vis = o3d.visualization.VisualizerWithKeyCallback()
vis.create_window()
vis.add_geometry(point_cloud)
vis.register_key_callback(65, key_callback)
vis.run()
vis.destroy_window()
Most helpful comment
We are using
GLFW_KEYforregister_key_callbackfunction. Based on this document,ais65.The following code should work out of the box (with Open3D 0.9):