XrSessionState(bpy_struct)

base class — bpy_struct

class bpy.types.XrSessionState(bpy_struct)

Runtime state information about the VR session

actionmaps

(default None, readonly)

Type:

XrActionMaps[XrActionMap]

active_actionmap

(in [-inf, inf], default 0)

Type:

int

navigation_location

Location offset to apply to base pose when determining viewer location (array of 3 items, in [-inf, inf], default (0.0, 0.0, 0.0))

Type:

mathutils.Vector

navigation_rotation

Rotation offset to apply to base pose when determining viewer rotation (array of 4 items, in [-inf, inf], default (0.0, 0.0, 0.0, 0.0))

Type:

mathutils.Quaternion

navigation_scale

Additional scale multiplier to apply to base scale when determining viewer scale (in [-inf, inf], default 0.0, readonly)

Type:

float

selected_actionmap

(in [-inf, inf], default 0)

Type:

int

viewer_pose_location

Last known location of the viewer pose (center between the eyes) in world space (array of 3 items, in [-inf, inf], default (0.0, 0.0, 0.0), readonly)

Type:

mathutils.Vector

viewer_pose_rotation

Last known rotation of the viewer pose (center between the eyes) in world space (array of 4 items, in [-inf, inf], default (0.0, 0.0, 0.0, 0.0), readonly)

Type:

mathutils.Quaternion

classmethod is_running(context)

Query if the VR session is currently running

Parameters:

context (Context) – (never None)

Returns:

Result

Return type:

bool

classmethod reset_to_base_pose(context)

Force resetting of position and rotation deltas

Parameters:

context (Context) – (never None)

classmethod action_set_create(context, actionmap)

Create a VR action set

Parameters:
Returns:

Result

Return type:

bool

classmethod action_create(context, actionmap, actionmap_item)

Create a VR action

Parameters:
Returns:

Result

Return type:

bool

classmethod action_binding_create(context, actionmap, actionmap_item, actionmap_binding)

Create a VR action binding

Parameters:
Returns:

Result

Return type:

bool

classmethod active_action_set_set(context, action_set)

Set the active VR action set

Parameters:
  • context (Context) – (never None)

  • action_set (str) – Action Set, Action set name (never None)

Returns:

Result

Return type:

bool

classmethod controller_pose_actions_set(context, action_set, grip_action, aim_action)

Set the actions that determine the VR controller poses

Parameters:
  • context (Context) – (never None)

  • action_set (str) – Action Set, Action set name (never None)

  • grip_action (str) – Grip Action, Name of the action representing the controller grips (never None)

  • aim_action (str) – Aim Action, Name of the action representing the controller aims (never None)

Returns:

Result

Return type:

bool

classmethod action_state_get(context, action_set_name, action_name, user_path)

Get the current state of a VR action

Parameters:
  • context (Context) – (never None)

  • action_set_name (str) – Action Set, Action set name (never None)

  • action_name (str) – Action, Action name (never None)

  • user_path (str) – User Path, OpenXR user path (never None)

Returns:

Action State, Current state of the VR action. Second float value is only set for 2D vector type actions. (array of 2 items, in [-inf, inf], never None)

Return type:

bpy_prop_array[float]

classmethod haptic_action_apply(context, action_set_name, action_name, user_path, duration, frequency, amplitude)

Apply a VR haptic action

Parameters:
  • context (Context) – (never None)

  • action_set_name (str) – Action Set, Action set name (never None)

  • action_name (str) – Action, Action name (never None)

  • user_path (str) – User Path, Optional OpenXR user path. If not set, the action will be applied to all paths. (never None)

  • duration (float) – Duration, Haptic duration in seconds. 0.0 is the minimum supported duration. (in [0, inf])

  • frequency (float) – Frequency, Frequency of the haptic vibration in hertz. 0.0 specifies the OpenXR runtime’s default frequency. (in [0, inf])

  • amplitude (float) – Amplitude, Haptic amplitude, ranging from 0.0 to 1.0 (in [0, 1])

Returns:

Result

Return type:

bool

classmethod haptic_action_stop(context, action_set_name, action_name, user_path)

Stop a VR haptic action

Parameters:
  • context (Context) – (never None)

  • action_set_name (str) – Action Set, Action set name (never None)

  • action_name (str) – Action, Action name (never None)

  • user_path (str) – User Path, Optional OpenXR user path. If not set, the action will be stopped for all paths. (never None)

classmethod controller_grip_location_get(context, index)

Get the last known controller grip location in world space

Parameters:
  • context (Context) – (never None)

  • index (int) – Index, Controller index (in [0, 255])

Returns:

Location, Controller grip location (array of 3 items, in [-inf, inf], never None)

Return type:

mathutils.Vector

classmethod controller_grip_rotation_get(context, index)

Get the last known controller grip rotation (quaternion) in world space

Parameters:
  • context (Context) – (never None)

  • index (int) – Index, Controller index (in [0, 255])

Returns:

Rotation, Controller grip quaternion rotation (array of 4 items, in [-inf, inf], never None)

Return type:

mathutils.Quaternion

classmethod controller_aim_location_get(context, index)

Get the last known controller aim location in world space

Parameters:
  • context (Context) – (never None)

  • index (int) – Index, Controller index (in [0, 255])

Returns:

Location, Controller aim location (array of 3 items, in [-inf, inf], never None)

Return type:

mathutils.Vector

classmethod controller_aim_rotation_get(context, index)

Get the last known controller aim rotation (quaternion) in world space

Parameters:
  • context (Context) – (never None)

  • index (int) – Index, Controller index (in [0, 255])

Returns:

Rotation, Controller aim quaternion rotation (array of 4 items, in [-inf, inf], never None)

Return type:

mathutils.Quaternion

classmethod bl_rna_get_subclass(id, default=None, /)
Parameters:
  • id (str) – The RNA type identifier.

  • default (bpy.types.Struct | None) – The value to return when not found.

Returns:

The RNA type or default when not found.

Return type:

bpy.types.Struct

classmethod bl_rna_get_subclass_py(id, default=None, /)
Parameters:
  • id (str) – The RNA type identifier.

  • default (type | None) – The value to return when not found.

Returns:

The class or default when not found.

Return type:

type

Inherited Properties

Inherited Functions

References