Skip to main content

LensStudio:Preview.InspectionSession

Class

Handle to the Lens's runtime scene during preview inspection, returned by startInspection().

Handle to the Lens's runtime scene during preview inspection, returned by startInspection(). The session becomes inactive when it is stopped, when the preview input changes, or when the preview is destroyed.

Index

Example

List the root objects of the Lens's runtime scene, then stop inspecting. Inspection snapshots the running Lens, so wait until the preview has rendered a frame before starting it. Read the scene while the session is active; changing the preview input also ends the session.

import { LensPreview } from 'LensStudio:LensPreview';

export async function listRuntimeRoots(preview: LensPreview): Promise<string[]> {
await preview.tryScreenshot(20000); // the Lens is loaded and running
const session = await preview.startInspection();
try {
return session.scene.rootSceneObjects.map(object => object.name);
} finally {
session.stop();
}
}

Extends

Properties

isActive

readonly isActive: boolean

Whether the session's runtime scene is still available.


scene

readonly scene: Scene

Scene that mirrors the Lens's runtime scene, or null once the session is inactive.

Methods

getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame


stop()

stop(): void

Stops the inspection, making this session inactive. Does nothing if the session is already inactive.

Returns

void