Skip to main content

Editor.Model.MetaInfo

Class

Metadata of the current project's Lens.

Index

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const metaInfo = model.project.metaInfo;

console.log(`Lens name: ${metaInfo.lensName}`);
console.log(`Is lens name valid: ${Editor.Model.MetaInfo.isLensNameValid(metaInfo.lensName)}`);
console.log(`Icon path: ${metaInfo.iconPath.toString()}`);
console.log(`Is icon set: ${metaInfo.isIconSet}`);
console.log(`Activation camera: ${metaInfo.activationCamera}`);

const applicability: Editor.Model.LensApplicability[] = metaInfo.lensApplicability;
console.log(`Lens applicability count: ${applicability.length}`);
for (const a of applicability) {
console.log(` Applicability value: ${a}`);
}

Properties

activationCamera

activationCamera: LensActivationCamera

The camera which will be activated when this Lens is turned on.


buildVersion

buildVersion: string

Build version string of the Lens in major.minor.patch format, for example 1.0.2, shown as Build Version in the Spectacles project settings.


iconPath

readonly iconPath: Path

The absolute path to the Lens Icon.


isIconSet

readonly isIconSet: boolean

Whether an Lens icon has been set.


lensApplicability

lensApplicability: LensApplicability[]

Where the Lens can be used.


lensClientCompatibilities

lensClientCompatibilities: LensClientCompatibility[]

Client surfaces this Lens declares compatibility with.


lensName

lensName: string

The publicly visible name of the Lens.


lensNameLocalizations

readonly lensNameLocalizations: Path

Absolute path to the project's copy of the Lens name localizations file, or an empty path if none is set.


packageId

packageId: string

Package identifier of the Lens, such as com.specs.whiteboard, shown as Package ID in the Spectacles project settings.


videoPreviewPath

readonly videoPreviewPath: Path

Absolute path to the Lens video preview file.

Methods

isLensNameValid()

static isLensNameValid(lensName): boolean

Checks whether the Lens Name is valid. See Project Info guide to learn more.

Parameters

ParameterType
lensNamestring

Returns

boolean


setIcon()

setIcon(externalPath): void

Sets the icon as the Lens' icon.

Parameters

ParameterType
externalPathPath

Returns

void


setLensNameLocalizations()

setLensNameLocalizations(externalPath): void

Sets the JSON file of localized Lens names by copying it into the project; an empty path removes the current file. Paths without a .json extension are ignored.

Parameters

ParameterType
externalPathPath

Returns

void


setVideoPreview()

setVideoPreview(externalPath): void

Sets the video preview shown for the Lens from the given external file.

Parameters

ParameterType
externalPathPath

Returns

void