Skip to main content

LensStudio:GuiService.GuiService

Class

Plugin class managing GUI service registration and initialization within the editor plugin system.

Index

Example

// GuiService is the base class for GUI-aware editor plugins.
// It extends Editor.IPlugin with start()/stop() lifecycle methods.
//
// Members:
// start(): void — initialize GUI components
// stop(): void — tear down GUI components
// pluginSystem (readonly) — access to the plugin system

export class GuiServiceClassExampleService extends GuiService {
connections: any[];
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.GuiServiceClassExample';
d.name = 'GuiService Class Example';
d.description = 'Demonstrates GuiService class with start/stop lifecycle';
d.dependencies = [Editor.Model.IModel];
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
}
start(): void {
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as unknown as Editor.Model.IModel;
const scene = model.project.scene;
console.log('GuiService started');
console.log(`Scene has ${scene.rootSceneObjects.length} root object(s)`);
}
stop(): void {
this.connections.forEach((c: any) => c?.disconnect());
this.connections = [];
}
}

Extends

Constructors

Constructor

new GuiService(pluginSystem, descriptor?): GuiService

Constructs a GuiService plugin instance with the given plugin system and optional descriptor.

Parameters

ParameterType
pluginSystemPluginSystem
descriptor?Descriptor

Returns

GuiService

Overrides

Editor.IPlugin.constructor

Properties

id

readonly id: string

Unique string identifier of the plugin instance.

Inherited from

IPlugin.id


pluginSystem

readonly pluginSystem: PluginSystem

The plugin system instance this service is registered with.

Methods

getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

IPlugin.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

IPlugin.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

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

IPlugin.isSame


start()

start(): void

Starts the GUI service and initializes its GUI components.

Returns

void


stop()

stop(): void

Stops the GUI service and tears down its GUI components.

Returns

void