Index · Object → OpenXRExtensionWrapper → OpenXRSpatialAnchorCapability

OpenXRSpatialAnchorCapability

Implementation for handling spatial entity anchor logic.

Class Description

This is an internal class that handles the OpenXR anchor spatial entity extension.

Methods

func create_default_persistence_context(user_callback: Callable = Callable()) -> OpenXRFutureResult

Calls create_persistence_context() with a configuration that likely works with the XR runtime.

user_callback is called when the context is created.

func create_new_anchor(transform: Transform3D, spatial_context: RID = RID(), next: OpenXRStructureBase = null) -> OpenXRAnchorTracker

Creates a new anchor that will be tracked by the XR runtime. The transform should be a transform in the local space of your XROrigin3D node. If spatial_context is not specified the default will be used, this requires ProjectSettings.xr/openxr/extensions/spatial_entity/enable_builtin_anchor_detection to be set. The returned tracker will track the location in case our reference space changes.

next must be a valid next object for the XrSpatialAnchorCreateInfoEXT chain.

func create_persistence_context(scope: OpenXRSpatialAnchorCapability.PersistenceScope, user_callback: Callable = Callable()) -> OpenXRFutureResult

Creates a new persistence context for storing persistent data.

Note: This is an asynchronous method and returns an OpenXRFutureResult object with which to track the status, discarding this object will not cancel the creation process. On success user_callback will be called if specified. The result value for this function is the RID for our persistence context.

func do_entity_update(spatial_context: RID, component_data: OpenXRSpatialComponentData[], next_snapshot_create: OpenXRStructureBase = null, next_snapshot_query: OpenXRStructureBase = null) -> void

Calls OpenXRSpatialEntityExtension.update_spatial_entities() and OpenXRSpatialEntityExtension.query_snapshot() with the anchor entities associated with spatial_context.

component_data are the OpenXRSpatialComponentDatas to update for this anchor capability.

If next_snapshot_create is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.update_spatial_entities().

If next_snapshot_query is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.query_snapshot().

func free_persistence_context(persistence_context: RID) -> void

Frees a persistence context previously created with create_persistence_context().

func get_persistence_context_handle(persistence_context: RID) -> int

Returns the internal handle for this persistence context.

Note: For GDExtension implementations.

func is_persistence_scope_supported(scope: OpenXRSpatialAnchorCapability.PersistenceScope) -> bool

Returns true if this persistence scope is supported by our spatial anchor capability.

Note: Only valid after an OpenXR instance has been created.

func is_spatial_anchor_supported() -> bool

Returns true if spatial anchors are supported by the hardware. Only returns a valid value after OpenXR has been initialized.

func is_spatial_persistence_supported() -> bool

Returns true if persistent spatial anchors are supported by the hardware. Only returns a valid value after OpenXR has been initialized.

func persist_anchor(anchor_tracker: OpenXRAnchorTracker, persistence_context: RID = RID(), user_callback: Callable = Callable()) -> OpenXRFutureResult

Changes this anchor into a persistent anchor. This means its location will be stored on the device and the anchor will be restored the next time your application starts. If persistence_context is not specified the default will be used, this requires ProjectSettings.xr/openxr/extensions/spatial_entity/enable_builtin_anchor_detection to be set.

Note: This is an asynchronous method and returns an OpenXRFutureResult object with which to track the status, discarding this object will not cancel the creation process. On success user_callback will be called if specified. The result value for this function is a boolean which will be set to true on successful completion.

func remove_anchor(anchor_tracker: OpenXRAnchorTracker) -> void

Remove an anchor previously created with create_new_anchor(). If this anchor was persistent you must first call unpersist_anchor() and await its callback.

func start_entity_discovery(spatial_context: RID, component_data: OpenXRSpatialComponentData[], next_snapshot_create: OpenXRStructureBase = null, next_snapshot_query: OpenXRStructureBase = null, user_callback: Callable = Callable()) -> OpenXRFutureResult

Calls OpenXRSpatialEntityExtension.discover_spatial_entities() and OpenXRSpatialEntityExtension.query_snapshot() with the anchor entities associated with spatial_context.

component_data are the OpenXRSpatialComponentDatas to discover for this anchor capability.

If next_snapshot_create is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.discover_spatial_entities().

If next_snapshot_query is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.query_snapshot().

user_callback, when non-null, is called with two parameters usually twice. The first parameter is the RID of the discovery snapshot and the second parameter is a boolean where false indicates the discovery snapshot is about to be processed, and true indicates the discovery snapshot has been processed and component_data has valid data. The second call is skipped if an error was encountered.

The returned OpenXRFutureResult is identical to the return from OpenXRSpatialEntityExtension.discover_spatial_entities().

func unpersist_anchor(anchor_tracker: OpenXRAnchorTracker, persistence_context: RID = RID(), user_callback: Callable = Callable()) -> OpenXRFutureResult

Removes the persistent data from this anchor. The runtime will not recreate the anchor when your application restarts. If persistence_context is not specified the default will be used, this requires ProjectSettings.xr/openxr/extensions/spatial_entity/enabled to be set.

Note: This is an asynchronous method and returns an OpenXRFutureResult object with which to track the status, discarding this object will not cancel the creation process. On success user_callback will be called if specified. The result value for this function is a boolean which will be set to true on successful completion.

Inherited from OpenXRExtensionWrapper (47)
func _on_event_polled(event: const void*) -> bool
func _on_instance_created(instance: int) -> void
func _on_instance_destroyed() -> void
func _on_post_draw_viewport(viewport: RID) -> void
func _on_pre_draw_viewport(viewport: RID) -> void
func _on_pre_render() -> void
func _on_process() -> void
func _on_register_metadata(interaction_profile_metadata: OpenXRInteractionProfileMetadata) -> void
func _on_session_created(session: int) -> void
func _on_session_destroyed() -> void
func _on_state_exiting() -> void
func _on_state_focused() -> void
func _on_state_idle() -> void
func _on_state_loss_pending() -> void
func _on_state_ready() -> void
func _on_state_stopping() -> void
func _on_state_synchronized() -> void
func _on_state_visible() -> void
func _on_sync_actions() -> void
func _on_viewport_composition_layer_destroyed(layer: const void*) -> void
func _prepare_view_configuration(view_count: int) -> void
func _set_frame_end_info_and_get_next_pointer(next_pointer: void*) -> int
func _set_frame_wait_info_and_get_next_pointer(next_pointer: void*) -> int
func _set_hand_joint_locations_and_get_next_pointer(hand_index: int, next_pointer: void*) -> int
func _set_instance_create_info_and_get_next_pointer(xr_version: int, next_pointer: void*) -> int
func _set_projection_layer_and_get_next_pointer(next_pointer: void*) -> int
func _set_projection_views_and_get_next_pointer(view_index: int, next_pointer: void*) -> int
func _set_reference_space_create_info_and_get_next_pointer(reference_space_type: int, next_pointer: void*) -> int
func _set_session_create_and_get_next_pointer(next_pointer: void*) -> int
func _set_view_configuration_and_get_next_pointer(view: int, next_pointer: void*) -> int
func _set_view_locate_info_and_get_next_pointer(next_pointer: void*) -> int
func _set_viewport_composition_layer_and_get_next_pointer(layer: const void*, property_values: Dictionary, next_pointer: void*) -> int
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

Inherited from Object (2)

Enums & Constants

enum PersistenceScope
PERSISTENCE_SCOPE_SYSTEM_MANAGED = 1

Provides the application with read-only access (i.e. application cannot modify this scope) to spatial entities persisted and managed by the system. The application can use the UUID in the persistence component for this scope to correlate entities across spatial contexts and device reboots.

PERSISTENCE_SCOPE_LOCAL_ANCHORS = 1000781000

Persistence operations and data access is limited to spatial anchors, on the same device, for the same user and same app (using persist_anchor() and unpersist_anchor() functions)