scene.interaction
Pointer hits, clicks, hover state, and dragging.
6 functions / 8 types
Index
| Function | Description |
|---|---|
| clicks | Report the clicks on the viewport since the last time this action was called. |
| get_interactable | Get whether a scene object is currently interactable. |
| hovers | Report the hovers on the viewport since the last time this action was called. |
| is_dragging | Check if a scene object is being actively dragged |
| set_draggable | Set a scene object as draggable and poll for recent changes This will also make it interactible. |
| set_interactable | Set whether a scene object is interactable. |
| Type | Description |
|---|---|
| BlockModelHitData | Kind-specific data about hitting a block model |
| Click | One click on a scene node, as reported by Clicks. |
| Hit | One scene node under the cursor, as reported by Hovers. |
| HitData | Kind-specific data about hitting an object |
| MeshHitData | Kind-specific data about hitting a mesh |
| PointCloudHitData | Kind-specific data about hitting a point cloud |
| PolylineHitData | Kind-specific data about hitting a polyline |
| ShapeHitData | Kind-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) -> boolGet 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) -> boolCheck 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
) -> NoneSet 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
) -> NoneSet 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
value : BlockModelHitData
HitData.PointCloud
HitData.PointCloud(value: types.scene.interaction.PointCloudHitData)Kind-specific data about hitting a point cloud
value : PointCloudHitData
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
value : PolylineHitData
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