Skip to main content

Editor.Model.Project

Class

Represents the open Lens Studio project, providing access to the scene, asset manager, and project settings.

Index

Example

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

console.log(`Project file: ${project.projectFile}`);
console.log(`Project directory: ${project.projectDirectory}`);
console.log(`Assets directory: ${project.assetsDirectory}`);
console.log(`Cache directory: ${project.cacheDirectory}`);

const scene = project.scene;
const rootObjects = scene.rootSceneObjects;
console.log(`Scene root objects: ${rootObjects.length}`);

const assetManager = project.assetManager;
console.log(`Total assets: ${assetManager.assets.length}`);

const metaInfo = project.metaInfo;
console.log(`Project meta info: ${metaInfo}`);

// Listen for entity additions (SceneObject type as example)
const conn = project.onEntityAdded('SceneObject').connect((entity) => {
console.log(`Entity added: ${entity.type}`);
});
this.connections.push(conn);

Extends

Properties

assetManager

readonly assetManager: AssetManager

The asset manager for this project, used to create, find, and manage all project assets.


assetsDirectory

readonly assetsDirectory: Path

Path to the project's assets directory on disk.


cacheDirectory

readonly cacheDirectory: Path

Path to the project's cache directory on disk.


history

readonly history: any

The undo/redo history stack for this project.


metaInfo

metaInfo: MetaInfo

Metadata associated with the project, such as name and version info.


projectDirectory

readonly projectDirectory: Path

Root directory path of the project on disk.


projectFile

readonly projectFile: Path

Path to the project's main file on disk.


scene

readonly scene: Scene

The active scene for this project, containing all scene objects and cameras.


targetPlatform

targetPlatform: TargetPlatform

Target platform (Snapchat or Spectacles) currently selected for the project.

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


onEntityAdded()

onEntityAdded(typeName): signal1<Entity, void>

Returns a signal that fires after an entity of the given type name has been added to the project.

Parameters

ParameterType
typeNamestring

Returns

signal1<Entity, void>


onEntityAdding()

onEntityAdding(typeName): signal1<Entity, void>

Returns a signal that fires just before an entity of the given type name is added to the project.

Parameters

ParameterType
typeNamestring

Returns

signal1<Entity, void>


onEntityRemoved()

onEntityRemoved(typeName): signal1<Uuid, void>

Returns a signal that fires after an entity of the given type name has been removed, providing its UUID.

Parameters

ParameterType
typeNamestring

Returns

signal1<Uuid, void>


onEntityUpdated()

onEntityUpdated(typeName): signal1<Entity, void>

Returns a signal that fires after an entity of the given type name has been updated.

Parameters

ParameterType
typeNamestring

Returns

signal1<Entity, void>


onEntityUpdating()

onEntityUpdating(typeName): signal1<Entity, void>

Returns a signal that fires just before an entity of the given type name is updated.

Parameters

ParameterType
typeNamestring

Returns

signal1<Entity, void>


save()

save(): void

Saves the project to its current file location.

Returns

void


saveTo()

saveTo(absoluteFilePath): void

Saves the project to a specified file path.

Parameters

ParameterType
absoluteFilePathPath

Returns

void