Scene Handles#
A handle is created for each object that is added to the scene. These can be used to read and set state, as well as detect clicks.
When a scene node is added to a server (for example, via
viser.ViserServer.add_frame()
), state is synchronized between all
connected clients. When a scene node is added to a client (for example, via
viser.ClientHandle.add_frame()
), state is local to a specific client.
- class viser.SceneNodeHandle[source]#
Handle base class for interacting with scene nodes.
- property wxyz: ndarray#
Orientation of the scene node. This is the quaternion representation of the R in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- property position: ndarray#
Position of the scene node. This is equivalent to the t in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- property visible: bool#
Whether the scene node is visible or not. Synchronized to clients automatically when assigned.
- class viser.CameraFrustumHandle[source]#
Handle for camera frustums.
- on_click(func: Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None] #
Attach a callback for when a scene node is clicked.
- Parameters:
self (TSceneNodeHandle) –
func (Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) –
- Return type:
Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]
- property position: ndarray#
Position of the scene node. This is equivalent to the t in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- remove() None #
Remove the node from the scene.
- Return type:
None
- property visible: bool#
Whether the scene node is visible or not. Synchronized to clients automatically when assigned.
- property wxyz: ndarray#
Orientation of the scene node. This is the quaternion representation of the R in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- class viser.FrameHandle[source]#
Handle for coordinate frames.
- on_click(func: Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None] #
Attach a callback for when a scene node is clicked.
- Parameters:
self (TSceneNodeHandle) –
func (Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) –
- Return type:
Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]
- property position: ndarray#
Position of the scene node. This is equivalent to the t in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- remove() None #
Remove the node from the scene.
- Return type:
None
- property visible: bool#
Whether the scene node is visible or not. Synchronized to clients automatically when assigned.
- property wxyz: ndarray#
Orientation of the scene node. This is the quaternion representation of the R in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- class viser.GlbHandle[source]#
Handle for GLB objects.
- on_click(func: Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None] #
Attach a callback for when a scene node is clicked.
- Parameters:
self (TSceneNodeHandle) –
func (Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) –
- Return type:
Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]
- property position: ndarray#
Position of the scene node. This is equivalent to the t in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- remove() None #
Remove the node from the scene.
- Return type:
None
- property visible: bool#
Whether the scene node is visible or not. Synchronized to clients automatically when assigned.
- property wxyz: ndarray#
Orientation of the scene node. This is the quaternion representation of the R in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- class viser.Gui3dContainerHandle[source]#
Use as a context to place GUI elements into a 3D GUI container.
- property position: ndarray#
Position of the scene node. This is equivalent to the t in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- property visible: bool#
Whether the scene node is visible or not. Synchronized to clients automatically when assigned.
- property wxyz: ndarray#
Orientation of the scene node. This is the quaternion representation of the R in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- class viser.ImageHandle[source]#
Handle for 2D images, rendered in 3D.
- on_click(func: Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None] #
Attach a callback for when a scene node is clicked.
- Parameters:
self (TSceneNodeHandle) –
func (Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) –
- Return type:
Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]
- property position: ndarray#
Position of the scene node. This is equivalent to the t in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- remove() None #
Remove the node from the scene.
- Return type:
None
- property visible: bool#
Whether the scene node is visible or not. Synchronized to clients automatically when assigned.
- property wxyz: ndarray#
Orientation of the scene node. This is the quaternion representation of the R in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- class viser.LabelHandle[source]#
Handle for 2D label objects. Does not support click events.
- property position: ndarray#
Position of the scene node. This is equivalent to the t in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- remove() None #
Remove the node from the scene.
- Return type:
None
- property visible: bool#
Whether the scene node is visible or not. Synchronized to clients automatically when assigned.
- property wxyz: ndarray#
Orientation of the scene node. This is the quaternion representation of the R in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- class viser.MeshHandle[source]#
Handle for mesh objects.
- on_click(func: Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None] #
Attach a callback for when a scene node is clicked.
- Parameters:
self (TSceneNodeHandle) –
func (Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) –
- Return type:
Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]
- property position: ndarray#
Position of the scene node. This is equivalent to the t in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- remove() None #
Remove the node from the scene.
- Return type:
None
- property visible: bool#
Whether the scene node is visible or not. Synchronized to clients automatically when assigned.
- property wxyz: ndarray#
Orientation of the scene node. This is the quaternion representation of the R in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- class viser.PointCloudHandle[source]#
Handle for point clouds. Does not support click events.
- property position: ndarray#
Position of the scene node. This is equivalent to the t in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- remove() None #
Remove the node from the scene.
- Return type:
None
- property visible: bool#
Whether the scene node is visible or not. Synchronized to clients automatically when assigned.
- property wxyz: ndarray#
Orientation of the scene node. This is the quaternion representation of the R in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- class viser.TransformControlsHandle[source]#
Handle for interacting with transform control gizmos.
- on_click(func: Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None] #
Attach a callback for when a scene node is clicked.
- Parameters:
self (TSceneNodeHandle) –
func (Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]) –
- Return type:
Callable[[SceneNodePointerEvent[TSceneNodeHandle]], None]
- property position: ndarray#
Position of the scene node. This is equivalent to the t in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- remove() None #
Remove the node from the scene.
- Return type:
None
- property visible: bool#
Whether the scene node is visible or not. Synchronized to clients automatically when assigned.
- property wxyz: ndarray#
Orientation of the scene node. This is the quaternion representation of the R in
p_parent = [R | t] p_local
. Synchronized to clients automatically when assigned.
- property update_timestamp: float#
- on_update(func: Callable[[TransformControlsHandle], None]) Callable[[TransformControlsHandle], None] [source]#
Attach a callback for when the gizmo is moved.
- Parameters:
func (Callable[[TransformControlsHandle], None]) –
- Return type:
Callable[[TransformControlsHandle], None]