FakeXrExtensions.FakeNodeTransaction


class FakeXrExtensions.FakeNodeTransaction : Closeable


A fake implementation of the XR extensions Node transaction.

All modifications happen immediately and not when the transaction is applied.

Summary

Public functions

Unit

Submits the queued transactions to backend.

Unit

Closes and releases the native transaction object without applying it.

NodeTransaction

Disables reform UX for a node.

NodeTransaction
enableReform(node: Node, options: ReformOptions)

Enables reform UX for a node.

NodeTransaction
setAlpha(node: Node, value: Float)

Sets the opacity of the node's content to a value between [0..1].

NodeTransaction
setAnchorId(node: Node, anchorId: IBinder?)

Sets the transform of the node on a per-frame basis from a previously created anchor.

NodeTransaction
setCornerRadius(node: Node, cornerRadius: Float)

Sets the corner radius for 2D surfaces under this node.

NodeTransaction

This function is deprecated.

This method is no longer supported.

NodeTransaction
setGltfModel(node: Node, gltfModelToken: GltfModelToken)

This function is deprecated.

This method is no longer supported.

NodeTransaction
setName(node: Node, name: String)

Sets a name for the node that is used to it in `adb dumpsys cpm` output log.

NodeTransaction
setOrientation(node: Node, x: Float, y: Float, z: Float, w: Float)

Rotates the node by the quaternion specified by x, y, z, and w components in the local coordinate space.

NodeTransaction
setParent(node: Node, parent: Node?)

Sets the parent of this node to the given node.

NodeTransaction
setPassthroughState(
    node: Node,
    passthroughOpacity: Float,
    passthroughMode: Int
)

Updates the passthrough state.

NodeTransaction
setPosition(node: Node, x: Float, y: Float, z: Float)

Sets the position of the node in the local coordinate space (parent space).

NodeTransaction
setReformSize(node: Node, reformSize: Vec3)

Updates the size of the reform UX.

NodeTransaction
setScale(node: Node, sx: Float, sy: Float, sz: Float)

Scales the node along the x, y, and z axis in the local coordinate space.

NodeTransaction
setSurfacePackage(
    node: Node?,
    surfacePackage: SurfaceControlViewHost.SurfacePackage
)

Configures the node to host and control the given surface data.

NodeTransaction
setVisibility(node: Node, isVisible: Boolean)

Changes the visibility of the node and its content.

NodeTransaction
setWindowBounds(
    surfacePackage: SurfaceControlViewHost.SurfacePackage,
    widthPx: Int,
    heightPx: Int
)

Crops the 2D buffer of the Surface hosted by this node to match the given bounds in pixels.

Inherited functions

From java.io.Closeable
abstract Unit

Public functions

apply

Added in 1.0.0-alpha01
fun apply(): Unit

Submits the queued transactions to backend.

This method will clear the existing transaction state so the same transaction object can be used for the next set of updates.

close

Added in 1.0.0-alpha01
fun close(): Unit

Closes and releases the native transaction object without applying it.

Note that a closed transaction cannot be used again.

disableReform

Added in 1.0.0-alpha01
fun disableReform(node: Node): NodeTransaction

Disables reform UX for a node.

Parameters
node: Node

The node to be updated.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

enableReform

Added in 1.0.0-alpha01
fun enableReform(node: Node, options: ReformOptions): NodeTransaction

Enables reform UX for a node.

Parameters
node: Node

The node to be updated.

options: ReformOptions

Configuration options for the reform UX.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setAlpha

Added in 1.0.0-alpha01
fun setAlpha(node: Node, value: Float): NodeTransaction

Sets the opacity of the node's content to a value between [0..1].

Parameters
node: Node

The node to be updated.

value: Float

The new opacity amount in range of [0..1].

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setAnchorId

Added in 1.0.0-alpha01
fun setAnchorId(node: Node, anchorId: IBinder?): NodeTransaction

Sets the transform of the node on a per-frame basis from a previously created anchor.

The client who created the anchor and provided the ID will always remain the owner of the anchor.

Modifying the transform of the node will only be applied if or when the anchor is no longer linked to the node, or if the anchor is no longer locatable.

A node can be unlinked from an anchor by setting the ID to null. Note that this does not destroy the actual anchor.

Parameters
node: Node

The node to be updated.

anchorId: IBinder?

The ID of a previously created anchor.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setCornerRadius

Added in 1.0.0-alpha01
fun setCornerRadius(node: Node, cornerRadius: Float): NodeTransaction

Sets the corner radius for 2D surfaces under this node.

The corner radius is propagated to child nodes.

Parameters
node: Node

The node to be updated.

cornerRadius: Float

The corner radius for 2D surfaces under this node, in meters.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setEnvironment

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun setEnvironment(node: Node, token: EnvironmentToken?): NodeTransaction

setGltfModel

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun setGltfModel(node: Node, gltfModelToken: GltfModelToken): NodeTransaction

setName

Added in 1.0.0-alpha01
fun setName(node: Node, name: String): NodeTransaction

Sets a name for the node that is used to it in `adb dumpsys cpm` output log.

While the name does not have to be globally unique, it is recommended to set a unique name for each node for ease of debugging.

Parameters
node: Node

The node to be updated.

name: String

The debug name of the node.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setOrientation

Added in 1.0.0-alpha01
fun setOrientation(node: Node, x: Float, y: Float, z: Float, w: Float): NodeTransaction

Rotates the node by the quaternion specified by x, y, z, and w components in the local coordinate space.

Parameters
node: Node

The node to be updated.

x: Float

The x component of the quaternion.

y: Float

The y component of the quaternion.

z: Float

The z component of the quaternion.

w: Float

The w component of the quaternion.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setParent

Added in 1.0.0-alpha01
fun setParent(node: Node, parent: Node?): NodeTransaction

Sets the parent of this node to the given node.

This method detaches the node from its current branch and moves into the new parent's hierarchy (if any). If parent parameter is `null`, the node will be orphaned and removed from the rendering tree until it is reattached to another node that is in the root hierarchy.

Parameters
node: Node

The node to be updated.

parent: Node?

The new parent of the node or `null` if the node is to be removed from the rendering tree.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setPassthroughState

Added in 1.0.0-alpha01
fun setPassthroughState(
    node: Node,
    passthroughOpacity: Float,
    passthroughMode: Int
): NodeTransaction

Updates the passthrough state.

Parameters
node: Node

The node to be updated.

passthroughOpacity: Float

The opacity of the passthrough layer where 0.0 means no passthrough and 1.0 means full passthrough.

passthroughMode: Int

The PassthroughState.Mode mode that the passthrough will use.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setPosition

Added in 1.0.0-alpha01
fun setPosition(node: Node, x: Float, y: Float, z: Float): NodeTransaction

Sets the position of the node in the local coordinate space (parent space).

Parameters
node: Node

The node to be updated.

x: Float

The 'x' distance in meters from parent's origin.

y: Float

The 'y' distance in meters from parent's origin.

z: Float

The 'z' distance in meters from parent's origin.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setReformSize

Added in 1.0.0-alpha01
fun setReformSize(node: Node, reformSize: Vec3): NodeTransaction

Updates the size of the reform UX.

Parameters
node: Node

The node to be updated.

reformSize: Vec3

The new size in meters that should be used to lay out the reform UX.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setScale

Added in 1.0.0-alpha01
fun setScale(node: Node, sx: Float, sy: Float, sz: Float): NodeTransaction

Scales the node along the x, y, and z axis in the local coordinate space.

For 2D panels, this method scales the panel in the world, increasing its visual size without changing the buffer size. It will not trigger a relayout and will not affect its enclosing view's layout configuration.

Parameters
node: Node

The node to be updated.

sx: Float

The scaling factor along the x-axis.

sy: Float

The scaling factor along the y-axis.

sz: Float

The scaling factor along the z-axis.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setSurfacePackage

Added in 1.0.0-alpha01
fun setSurfacePackage(
    node: Node?,
    surfacePackage: SurfaceControlViewHost.SurfacePackage
): NodeTransaction

Configures the node to host and control the given surface data.

This method is similar to setSurfaceControl and is provided for convenience.

Parameters
node: Node?

The node to be updated.

surfacePackage: SurfaceControlViewHost.SurfacePackage

The package that contains the SurfaceControl, or 'null' to disassociate the currently hosted surface from the node.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setVisibility

Added in 1.0.0-alpha01
fun setVisibility(node: Node, isVisible: Boolean): NodeTransaction

Changes the visibility of the node and its content.

Parameters
node: Node

The node to be updated.

isVisible: Boolean

Whether the node is visible.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.

setWindowBounds

Added in 1.0.0-alpha01
fun setWindowBounds(
    surfacePackage: SurfaceControlViewHost.SurfacePackage,
    widthPx: Int,
    heightPx: Int
): NodeTransaction

Crops the 2D buffer of the Surface hosted by this node to match the given bounds in pixels.

This method is similar to setWindowBounds and is provided for convenience.

Parameters
surfacePackage: SurfaceControlViewHost.SurfacePackage

The package that contains the SurfaceControl.

widthPx: Int

The width of the surface in pixels.

heightPx: Int

The height of the surface in pixels.

Returns
NodeTransaction

The reference to this NodeTransaction object that is currently being updated.