LensStudio:Preview.InspectionSession
ClassHandle 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
readonlyisActive:boolean
Whether the session's runtime scene is still available.
scene
readonlyscene:Scene
Scene that mirrors the Lens's runtime scene, or null once the session is inactive.
Methods
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
stop()
stop():
void
Stops the inspection, making this session inactive. Does nothing if the session is already inactive.
Returns
void