Skip to content

scene.interaction

Pointer hits, clicks, hover state, and dragging.

6 functions / 8 types

Index

FunctionDescription
clicksReport the clicks on the viewport since the last time this action was called.
get_interactableGet whether a scene object is currently interactable.
hoversReport the hovers on the viewport since the last time this action was called.
is_draggingCheck if a scene object is being actively dragged
set_draggableSet a scene object as draggable and poll for recent changes This will also make it interactible.
set_interactableSet whether a scene object is interactable.
TypeDescription
BlockModelHitDataKind-specific data about hitting a block model
ClickOne click on a scene node, as reported by Clicks.
HitOne scene node under the cursor, as reported by Hovers.
HitDataKind-specific data about hitting an object
MeshHitDataKind-specific data about hitting a mesh
PointCloudHitDataKind-specific data about hitting a point cloud
PolylineHitDataKind-specific data about hitting a polyline
ShapeHitDataKind-specific data about hitting a shape

clicks

def clicks(
    *,
    _transaction_id: str | None = None
) -> tuple[types.scene.interaction.Click, ...]

Report the clicks on the viewport since the last time this action was called.

Returns tuple[Click, ...].

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

get_interactable

def get_interactable(*, node: types.scene.Node, _transaction_id: str | None = None) -> bool

Get whether a scene object is currently interactable.

Returns bool.

node : Node

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

hovers

def hovers(
    *,
    _transaction_id: str | None = None
) -> tuple[types.scene.interaction.Hit, ...]

Report the hovers on the viewport since the last time this action was called.

Returns tuple[Hit, ...].

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

is_dragging

def is_dragging(*, node: types.scene.Node, _transaction_id: str | None = None) -> bool

Check if a scene object is being actively dragged

Returns bool.

node : Node

The NodeSchema of the shape to make draggable.

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

set_draggable

def set_draggable(
    *,
    node: types.scene.Node,
    drag_kind: types.scene.DragKind | None = None,
    _transaction_id: str | None = None
) -> None

Set a scene object as draggable and poll for recent changes This will also make it interactible.

Returns None.

node : Node

The NodeSchema of the shape to make draggable.

drag_kind optional : DragKind | None

How the drag moves the shape. Absent leaves it dragging in the plane facing the camera. Defaults to None.

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

set_interactable

def set_interactable(
    *,
    node: types.scene.Node,
    interactible: bool | None = None,
    _transaction_id: str | None = None
) -> None

Set whether a scene object is interactable.

Returns None.

node : Node

interactible optional : bool | None

If unset, this will default to true. Defaults to None.

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

BlockModelHitData

BlockModelHitData(*, leaf: types.scene.LeafDescription)

Kind-specific data about hitting a block model

leaf : LeafDescription

The element to pass to the component’s inspect_leaf query.

Click

Click(*, mouse_button: int, hit: types.scene.interaction.Hit)

One click on a scene node, as reported by Clicks.

mouse_button : int

Which mouse button: 0 primary, 1 secondary, 2 middle.

hit : Hit

The underlying hit.

Hit

Hit(
    *,
    position: types.math.Vec3,
    node: types.scene.Node,
    info: types.scene.interaction.HitData
)

One scene node under the cursor, as reported by Hovers.

position : Vec3

World position of the point under the cursor.

node : Node

The scene node under the cursor.

info : HitData

Additional data specific to the kind of scene object hit

HitData

HitData()

Kind-specific data about hitting an object

Construct one of the nested classes. Use isinstance to check its type.

HitData.BlockModel

HitData.BlockModel(value: types.scene.interaction.BlockModelHitData)

Kind-specific data about hitting a block model

HitData.PointCloud

HitData.PointCloud(value: types.scene.interaction.PointCloudHitData)

Kind-specific data about hitting a point cloud

HitData.Mesh

HitData.Mesh(value: types.scene.interaction.MeshHitData)

Kind-specific data about hitting a mesh

value : MeshHitData

HitData.Polyline

HitData.Polyline(value: types.scene.interaction.PolylineHitData)

Kind-specific data about hitting a polyline

HitData.Shape

HitData.Shape(value: types.scene.interaction.ShapeHitData)

Kind-specific data about hitting a shape

value : ShapeHitData

MeshHitData

MeshHitData()

Kind-specific data about hitting a mesh

PointCloudHitData

PointCloudHitData(*, leaf: types.scene.LeafDescription)

Kind-specific data about hitting a point cloud

leaf : LeafDescription

The element to pass to the component’s inspect_leaf query.

PolylineHitData

PolylineHitData()

Kind-specific data about hitting a polyline

ShapeHitData

ShapeHitData()

Kind-specific data about hitting a shape