Skip to main content

Editor.Model.IModel

Class

Core plugin component interface providing access to the current Lens Studio project and its lifecycle events.

Index

Example

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

console.log('IModel.interfaceId:', Editor.Model.IModel.interfaceId);
console.log('project:', model.project);

// Listen for project lifecycle signals.
// onProjectChanged fires when switching projects (open/new), not for
// in-project edits. onProjectSaving fires after a save completes, so
// it's the place to react to "Save As" landing at a new path.
const c1 = model.onProjectChanged.connect(() => {
console.log('Switched to a new project');
});
this.connections.push(c1);

const c2 = model.onMetaInfoChanged.connect(() => {
console.log('Meta info changed');
});
this.connections.push(c2);

const c3 = model.onProjectAboutToBeChanged.connect(() => {
console.log('Project about to change');
});
this.connections.push(c3);

const c4 = model.onProjectSaving.connect((saveMode: Editor.Model.ProjectSaveMode, path: Editor.Path) => {
console.log('Project saved, mode:', saveMode, 'path:', path);
});
this.connections.push(c4);

Extends

Properties

interfaceId

static interfaceId: InterfaceId

Unique identifier for this interface, used when resolving it via the plugin system.


onMetaInfoChanged

readonly onMetaInfoChanged: signal0<void>

Signal fired when project meta information changes.


onProjectAboutToBeChanged

readonly onProjectAboutToBeChanged: signal0<void>

Signal fired just before the active project is replaced.


onProjectChanged

readonly onProjectChanged: signal0<void>

Signal fired after a new project has been loaded and is ready.


onProjectLocationChanged

readonly onProjectLocationChanged: signal0<void>

Signal fired when the on-disk location of the current project changes, for example after Save As.


onProjectSaving

readonly onProjectSaving: signal2<ProjectSaveMode, Path, void>

Signal fired when the project is about to be saved.


project

readonly project: Project

The currently loaded project instance, providing access to its scene and asset manager.

Methods

getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

IPluginComponent.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

IPluginComponent.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

IPluginComponent.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

IPluginComponent.isSame


openProject()

openProject(path): void

Opens a project at the given file system path.

Parameters

ParameterType
pathPath

Returns

void


setDefaultProject()

setDefaultProject(): void

Loads the default template project.

Returns

void


setEmptyProject()

setEmptyProject(): void

Loads a blank empty project.

Returns

void